Revision 43756
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/JDBCUtils.java | ||
---|---|---|
5 | 5 |
import java.sql.ResultSet; |
6 | 6 |
import java.sql.SQLException; |
7 | 7 |
import java.sql.Statement; |
8 |
import java.util.List; |
|
9 |
import org.gvsig.fmap.dal.ExpressionBuilder.GeometrySupportType; |
|
10 |
import static org.gvsig.fmap.dal.ExpressionBuilder.GeometrySupportType.EWKB; |
|
11 |
import static org.gvsig.fmap.dal.ExpressionBuilder.GeometrySupportType.WKB; |
|
12 |
import static org.gvsig.fmap.dal.ExpressionBuilder.GeometrySupportType.WKT; |
|
13 |
import org.gvsig.fmap.geom.Geometry; |
|
14 | 8 |
import org.slf4j.Logger; |
15 | 9 |
import org.slf4j.LoggerFactory; |
16 | 10 |
|
... | ... | |
24 | 18 |
|
25 | 19 |
public static ResultSet executeQuery(Statement st, String sql) throws SQLException { |
26 | 20 |
logger.debug("execute query SQL: " + sql); |
27 |
ResultSet rs = st.executeQuery(sql); |
|
28 |
return rs; |
|
21 |
try { |
|
22 |
ResultSet rs = st.executeQuery(sql); |
|
23 |
return rs; |
|
24 |
} catch(Exception ex) { |
|
25 |
logger.warn("execute SQL: " + sql, ex); |
|
26 |
throw ex; |
|
27 |
} |
|
29 | 28 |
} |
30 | 29 |
|
31 | 30 |
public static void execute(Statement st, String sql) throws SQLException { |
32 | 31 |
logger.debug("execute SQL: " + sql); |
33 |
st.execute(sql); |
|
32 |
try { |
|
33 |
st.execute(sql); |
|
34 |
} catch(Exception ex) { |
|
35 |
logger.warn("execute SQL: " + sql, ex); |
|
36 |
throw ex; |
|
37 |
} |
|
34 | 38 |
} |
35 | 39 |
|
36 | 40 |
public static void execute(Connection connection, String sql) throws SQLException { |
37 | 41 |
logger.debug("execute SQL: " + sql); |
38 | 42 |
Statement st = connection.createStatement(); |
39 |
st.execute(sql); |
|
43 |
try { |
|
44 |
st.execute(sql); |
|
45 |
} catch(Exception ex) { |
|
46 |
logger.warn("execute SQL: " + sql, ex); |
|
47 |
throw ex; |
|
48 |
} |
|
40 | 49 |
} |
41 | 50 |
|
42 | 51 |
public static ResultSet executeQuery(PreparedStatement st, String sql) throws SQLException { |
43 | 52 |
logger.debug("execute query SQL: " + sql); |
44 |
ResultSet rs = st.executeQuery(); |
|
45 |
return rs; |
|
53 |
try { |
|
54 |
ResultSet rs = st.executeQuery(); |
|
55 |
return rs; |
|
56 |
} catch(Exception ex) { |
|
57 |
logger.warn("execute SQL: " + sql, ex); |
|
58 |
throw ex; |
|
59 |
} |
|
46 | 60 |
} |
47 | 61 |
|
48 | 62 |
public static void execute(PreparedStatement st, String sql) throws SQLException { |
49 | 63 |
logger.debug("execute SQL: " + sql); |
50 |
st.execute(); |
|
64 |
try { |
|
65 |
st.execute(); |
|
66 |
} catch(Exception ex) { |
|
67 |
logger.warn("execute SQL: " + sql, ex); |
|
68 |
throw ex; |
|
69 |
} |
|
51 | 70 |
} |
52 | 71 |
|
53 | 72 |
public static int executeUpdate(PreparedStatement st, String sql) throws SQLException { |
54 | 73 |
logger.debug("execute update SQL: "+ sql); |
55 |
return st.executeUpdate(); |
|
74 |
try { |
|
75 |
return st.executeUpdate(); |
|
76 |
} catch(Exception ex) { |
|
77 |
logger.warn("execute SQL: " + sql, ex); |
|
78 |
throw ex; |
|
79 |
} |
|
56 | 80 |
} |
57 | 81 |
|
58 | 82 |
public static void closeQuietly(Statement obj) { |
Also available in: Unified diff