Revision 43775
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.Iterator; |
|
9 |
import java.util.List; |
|
10 |
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCSQLException; |
|
8 | 11 |
import org.slf4j.Logger; |
9 | 12 |
import org.slf4j.LoggerFactory; |
10 | 13 |
|
... | ... | |
48 | 51 |
} |
49 | 52 |
} |
50 | 53 |
|
54 |
public static void execute(Connection connection, List<String> sqls) throws SQLException { |
|
55 |
Statement st = null; |
|
56 |
String sql = null; |
|
57 |
try { |
|
58 |
st = connection.createStatement(); |
|
59 |
Iterator<String> it = sqls.iterator(); |
|
60 |
while( it.hasNext() ) { |
|
61 |
sql = it.next(); |
|
62 |
logger.debug("execute SQL: " + sql); |
|
63 |
st.execute(sql); |
|
64 |
} |
|
65 |
} catch (SQLException ex) { |
|
66 |
logger.warn("execute SQL: " + sql, ex); |
|
67 |
throw ex; |
|
68 |
} finally { |
|
69 |
JDBCUtils.closeQuietly(st); |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
51 | 73 |
public static ResultSet executeQuery(PreparedStatement st, String sql) throws SQLException { |
52 | 74 |
logger.debug("execute query SQL: " + sql); |
53 | 75 |
try { |
Also available in: Unified diff