Package com.landawn.abacus.jdbc
Class JdbcUtils
java.lang.Object
com.landawn.abacus.jdbc.JdbcUtils
- Since:
- 0.8
- Author:
- Haiyang Li
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
copy
(Connection sourceConn, String selectSql, int fetchSize, long offset, long count, Connection targetConn, String insertSql, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, SQLException> stmtSetter) static long
copy
(Connection sourceConn, String selectSql, int fetchSize, Connection targetConn, String insertSql, int batchSize) static long
copy
(Connection sourceConn, String selectSql, int fetchSize, Connection targetConn, String insertSql, int batchSize, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, SQLException> stmtSetter) static long
copy
(Connection sourceConn, String selectSql, Connection targetConn, String insertSql) static long
copy
(Connection sourceConn, String selectSql, Connection targetConn, String insertSql, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, SQLException> stmtSetter) static long
copy
(Connection sourceConn, Connection targetConn, String tableName) static long
copy
(Connection sourceConn, Connection targetConn, String sourceTableName, String targetTableName) static long
copy
(Connection sourceConn, Connection targetConn, String sourceTableName, String targetTableName, int batchSize) static long
copy
(Connection sourceConn, Connection targetConn, String sourceTableName, String targetTableName, Collection<String> selectColumnNames) static long
copy
(Connection sourceConn, Connection targetConn, String sourceTableName, String targetTableName, Collection<String> selectColumnNames, int batchSize) static long
copy
(PreparedStatement selectStmt, long offset, long count, PreparedStatement insertStmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, SQLException> stmtSetter) static long
copy
(PreparedStatement selectStmt, PreparedStatement insertStmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, SQLException> stmtSetter) static long
copy
(DataSource sourceDataSource, String selectSql, int fetchSize, DataSource targetDataSource, String insertSql, int batchSize) static long
copy
(DataSource sourceDataSource, String selectSql, int fetchSize, DataSource targetDataSource, String insertSql, int batchSize, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, SQLException> stmtSetter) static long
copy
(DataSource sourceDataSource, String selectSql, DataSource targetDataSource, String insertSql) static long
copy
(DataSource sourceDataSource, String selectSql, DataSource targetDataSource, String insertSql, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, SQLException> stmtSetter) static long
copy
(DataSource sourceDataSource, DataSource targetDataSource, String tableName) static long
copy
(DataSource sourceDataSource, DataSource targetDataSource, String sourceTableName, String targetTableName) static long
copy
(DataSource sourceDataSource, DataSource targetDataSource, String sourceTableName, String targetTableName, int batchSize) static long
copy
(DataSource sourceDataSource, DataSource targetDataSource, String sourceTableName, String targetTableName, Collection<String> selectColumnNames) static long
copy
(DataSource sourceDataSource, DataSource targetDataSource, String sourceTableName, String targetTableName, Collection<String> selectColumnNames, int batchSize) static com.landawn.abacus.util.Throwables.BiConsumer<PreparedQuery,
ResultSet, SQLException> createParamSetter
(Jdbc.ColumnGetter<?> columnGetterForAll) static long
exportCSV
(File out, Connection conn, String querySQL) Exports the data from database to CVS.static long
exportCSV
(File out, Connection conn, String querySQL, long offset, long count, boolean writeTitle, boolean quoted) Exports the data from database to CVS.static long
exportCSV
(File out, Connection conn, String querySQL, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) Exports the data from database to CVS.static long
exportCSV
(File out, PreparedStatement stmt) Exports the data from database to CVS.static long
exportCSV
(File out, PreparedStatement stmt, long offset, long count, boolean writeTitle, boolean quoted) Exports the data from database to CVS.static long
exportCSV
(File out, PreparedStatement stmt, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) Exports the data from database to CVS.static long
Exports the data from database to CVS.static long
Exports the data from database to CVS.static long
exportCSV
(File out, ResultSet rs, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) Each line in the output file/Writer is an array of JSON String without root bracket.static long
exportCSV
(OutputStream out, ResultSet rs) Exports the data from database to CVS.static long
exportCSV
(OutputStream out, ResultSet rs, long offset, long count, boolean writeTitle, boolean quoted) Exports the data from database to CVS.static long
exportCSV
(OutputStream out, ResultSet rs, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) Exports the data from database to CVS.static long
Exports the data from database to CVS.static long
Exports the data from database to CVS.static long
exportCSV
(Writer out, ResultSet rs, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) Exports the data from database to CVS.static <E extends Exception>
longimportCSV
(File file, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<String[], E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) static <E extends Exception>
longimportCSV
(File file, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<String[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) Imports the data from CSV to database.static long
importCSV
(File file, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) static long
importCSV
(File file, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) static long
importCSV
(File file, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) Imports the data from CSV to database.static long
importCSV
(File file, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) static <E extends Exception>
longimportCSV
(InputStream is, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<String[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) Imports the data from CSV to database.static long
importCSV
(InputStream is, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) static long
importCSV
(InputStream is, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) static <E extends Exception>
longimportCSV
(Reader reader, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<String[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) Imports the data from CSV to database.static long
importCSV
(Reader reader, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) static long
importCSV
(Reader reader, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], SQLException> stmtSetter) static <E extends Exception>
intimportData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], SQLException> stmtSetter) Imports the data fromDataSet
to database.static <E extends Exception>
intimportData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.static <E extends Exception>
intimportData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], SQLException> stmtSetter) Imports the data fromDataSet
to database.static <E extends Exception>
intimportData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], SQLException> stmtSetter) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], SQLException> stmtSetter) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, Connection conn, String insertSQL, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], SQLException> stmtSetter) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], SQLException> stmtSetter) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, int offset, int count, PreparedStatement stmt, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, Connection conn, String insertSQL) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], SQLException> stmtSetter) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, Connection conn, String insertSQL, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, PreparedStatement stmt) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], SQLException> stmtSetter) static int
importData
(com.landawn.abacus.util.DataSet dataset, PreparedStatement stmt, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.static <E extends Exception>
intimportData
(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis) Imports the data fromDataSet
to database.static <E extends Exception>
intimportData
(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, Connection conn, String insertSQL) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, PreparedStatement stmt) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, Connection conn, String insertSQL) Imports the data fromDataSet
to database.static int
importData
(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, PreparedStatement stmt) Imports the data fromDataSet
to database.static <E extends Exception>
longimportData
(File file, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) static <E extends Exception>
longimportData
(File file, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) Imports the data from file to database.static <E extends Exception>
longimportData
(File file, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) static <E extends Exception>
longimportData
(File file, PreparedStatement stmt, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) static <E extends Exception>
longimportData
(InputStream is, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) static <E extends Exception>
longimportData
(InputStream is, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) Imports the data from file to database.static <E extends Exception>
longimportData
(InputStream is, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) static <E extends Exception>
longimportData
(InputStream is, PreparedStatement stmt, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) static <E extends Exception>
longimportData
(Reader reader, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) static <E extends Exception>
longimportData
(Reader reader, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) Imports the data from file to database.static <E extends Exception>
longimportData
(Reader reader, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) static <E extends Exception>
longimportData
(Reader reader, PreparedStatement stmt, com.landawn.abacus.util.Throwables.Function<String, Object[], E> func) static <T,
E extends Exception>
longimportData
(Iterator<? extends T> iter, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<? super T, E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, SQLException> stmtSetter) static <T,
E extends Exception>
longimportData
(Iterator<? extends T> iter, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<? super T, E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, SQLException> stmtSetter) Imports the data from Iterator to database.static <T> long
importData
(Iterator<? extends T> iter, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, SQLException> stmtSetter) static <T> long
importData
(Iterator<? extends T> iter, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, SQLException> stmtSetter) static <T> long
importData
(Iterator<? extends T> iter, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, SQLException> stmtSetter) static <T> long
importData
(Iterator<? extends T> iter, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, SQLException> stmtSetter)
-
Method Details
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, Connection conn, String insertSQL) throws SQLException Imports the data fromDataSet
to database.- Parameters:
dataset
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); - Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, Connection conn, String insertSQL) throws SQLException Imports the data fromDataSet
to database.- Parameters:
dataset
-selectColumnNames
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); - Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, Connection conn, String insertSQL) throws SQLException Imports the data fromDataSet
to database.- Parameters:
dataset
-selectColumnNames
-offset
-count
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); - Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis) throws SQLException Imports the data fromDataSet
to database.- Parameters:
dataset
-selectColumnNames
-offset
-count
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); batchSize
-batchIntervalInMillis
-- Returns:
- Throws:
SQLException
-
importData
public static <E extends Exception> int importData(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis) throws SQLException, EImports the data fromDataSet
to database.- Type Parameters:
E
-- Parameters:
dataset
-selectColumnNames
-offset
-count
-filter
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); batchSize
-batchIntervalInMillis
-- Returns:
- Throws:
SQLException
E
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, Connection conn, String insertSQL, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) throws SQLExceptionImports the data fromDataSet
to database.- Parameters:
dataset
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); columnTypeMap
-- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, Connection conn, String insertSQL, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) throws SQLExceptionImports the data fromDataSet
to database.- Parameters:
dataset
-offset
-count
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); columnTypeMap
-- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) throws SQLExceptionImports the data fromDataSet
to database.- Parameters:
dataset
-offset
-count
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); batchSize
-batchIntervalInMillis
-columnTypeMap
-- Returns:
- Throws:
SQLException
-
importData
public static <E extends Exception> int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, Map<String, throws SQLException, E? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.- Type Parameters:
E
-- Parameters:
dataset
-offset
-count
-filter
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); batchSize
-batchIntervalInMillis
-columnTypeMap
-- Returns:
- Throws:
SQLException
E
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], throws SQLExceptionSQLException> stmtSetter) Imports the data fromDataSet
to database.- Parameters:
dataset
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], throws SQLExceptionSQLException> stmtSetter) Imports the data fromDataSet
to database.- Parameters:
dataset
-offset
-count
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], throws SQLExceptionSQLException> stmtSetter) Imports the data fromDataSet
to database.- Parameters:
dataset
-offset
-count
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static <E extends Exception> int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, throws SQLException, E? super Object[], SQLException> stmtSetter) Imports the data fromDataSet
to database.- Type Parameters:
E
-- Parameters:
dataset
-offset
-count
-filter
-conn
-insertSQL
- the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:List
columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
E
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, PreparedStatement stmt) throws SQLException Imports the data fromDataSet
to database.- Parameters:
dataset
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, PreparedStatement stmt) throws SQLException Imports the data fromDataSet
to database.- Parameters:
dataset
-selectColumnNames
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, PreparedStatement stmt) throws SQLException Imports the data fromDataSet
to database.- Parameters:
dataset
-selectColumnNames
-offset
-count
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis) throws SQLException Imports the data fromDataSet
to database.- Parameters:
dataset
-selectColumnNames
-offset
-count
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.batchSize
-batchIntervalInMillis
-- Returns:
- Throws:
SQLException
-
importData
public static <E extends Exception> int importData(com.landawn.abacus.util.DataSet dataset, Collection<String> selectColumnNames, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis) throws SQLException, EImports the data fromDataSet
to database.- Type Parameters:
E
-- Parameters:
dataset
-selectColumnNames
-offset
-count
-filter
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.batchSize
-batchIntervalInMillis
-- Returns:
- Throws:
SQLException
E
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, PreparedStatement stmt, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) throws SQLExceptionImports the data fromDataSet
to database.- Parameters:
dataset
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.columnTypeMap
-- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, PreparedStatement stmt, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) throws SQLExceptionImports the data fromDataSet
to database.- Parameters:
dataset
-offset
-count
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.columnTypeMap
-- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, Map<String, ? extends com.landawn.abacus.type.Type> columnTypeMap) throws SQLExceptionImports the data fromDataSet
to database.- Parameters:
dataset
-offset
-count
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.batchSize
-batchIntervalInMillis
-columnTypeMap
-- Returns:
- Throws:
SQLException
-
importData
public static <E extends Exception> int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, Map<String, throws SQLException, E? extends com.landawn.abacus.type.Type> columnTypeMap) Imports the data fromDataSet
to database.- Type Parameters:
E
-- Parameters:
dataset
-offset
-count
-filter
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.batchSize
-batchIntervalInMillis
-columnTypeMap
-- Returns:
- Throws:
SQLException
E
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], throws SQLExceptionSQLException> stmtSetter) - Parameters:
dataset
-stmt
-stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], throws SQLExceptionSQLException> stmtSetter) Imports the data fromDataSet
to database.- Parameters:
dataset
-offset
-count
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super Object[], throws SQLExceptionSQLException> stmtSetter) Imports the data fromDataSet
to database.- Parameters:
dataset
-offset
-count
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static <E extends Exception> int importData(com.landawn.abacus.util.DataSet dataset, int offset, int count, com.landawn.abacus.util.Throwables.Predicate<? super Object[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, throws SQLException, E? super Object[], SQLException> stmtSetter) Imports the data fromDataSet
to database.- Type Parameters:
E
-- Parameters:
dataset
-offset
-count
-filter
-stmt
- the column order in the sql must be consistent with the column order in the DataSet.batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
E
-
importData
public static <E extends Exception> long importData(File file, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) - Type Parameters:
E
-- Parameters:
file
-conn
-insertSQL
-func
-- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(File file, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) - Type Parameters:
E
-- Parameters:
file
-offset
-count
-conn
-insertSQL
-batchSize
-batchIntervalInMillis
-func
-- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(File file, PreparedStatement stmt, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) - Type Parameters:
E
-- Parameters:
file
-stmt
-func
-- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(File file, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) Imports the data from file to database.- Type Parameters:
E
-- Parameters:
file
-offset
-count
-stmt
-batchSize
-batchIntervalInMillis
-func
- convert line to the parameters for record insert. Returns anull
array to skip the line.- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(InputStream is, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) - Type Parameters:
E
-- Parameters:
is
-conn
-insertSQL
-func
-- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(InputStream is, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) - Type Parameters:
E
-- Parameters:
is
-offset
-count
-conn
-insertSQL
-batchSize
-batchIntervalInMillis
-func
-- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(InputStream is, PreparedStatement stmt, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) - Type Parameters:
E
-- Parameters:
is
-stmt
-func
-- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(InputStream is, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) Imports the data from file to database.- Type Parameters:
E
-- Parameters:
is
-offset
-count
-stmt
-batchSize
-batchIntervalInMillis
-func
- convert line to the parameters for record insert. Returns anull
array to skip the line.- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(Reader reader, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) - Type Parameters:
E
-- Parameters:
reader
-conn
-insertSQL
-func
-- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(Reader reader, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) - Type Parameters:
E
-- Parameters:
reader
-offset
-count
-conn
-insertSQL
-batchSize
-batchIntervalInMillis
-func
-- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(Reader reader, PreparedStatement stmt, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) - Type Parameters:
E
-- Parameters:
reader
-stmt
-func
-- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <E extends Exception> long importData(Reader reader, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.Function<String, Object[], throws SQLException, IOException, EE> func) Imports the data from file to database.- Type Parameters:
E
-- Parameters:
reader
-offset
-count
-stmt
-batchSize
-batchIntervalInMillis
-func
- convert line to the parameters for record insert. Returns anull
array to skip the line.- Returns:
- Throws:
SQLException
IOException
E
-
importData
public static <T> long importData(Iterator<? extends T> iter, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, throws SQLExceptionSQLException> stmtSetter) - Type Parameters:
T
-- Parameters:
iter
-conn
-insertSQL
-stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static <T> long importData(Iterator<? extends T> iter, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, throws SQLExceptionSQLException> stmtSetter) - Type Parameters:
T
-- Parameters:
iter
-offset
-count
-conn
-insertSQL
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static <T,E extends Exception> long importData(Iterator<? extends T> iter, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<? super T, E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, throws SQLException, E? super T, SQLException> stmtSetter) - Type Parameters:
T
-E
-- Parameters:
iter
-offset
-count
-filter
-conn
-insertSQL
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
E
-
importData
public static <T> long importData(Iterator<? extends T> iter, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, throws SQLExceptionSQLException> stmtSetter) - Type Parameters:
T
-- Parameters:
iter
-stmt
-stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static <T> long importData(Iterator<? extends T> iter, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super T, throws SQLExceptionSQLException> stmtSetter) - Type Parameters:
T
-- Parameters:
iter
-offset
-count
-stmt
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
-
importData
public static <T,E extends Exception> long importData(Iterator<? extends T> iter, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<? super T, E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, throws SQLException, E? super T, SQLException> stmtSetter) Imports the data from Iterator to database.- Type Parameters:
T
-E
-- Parameters:
iter
-offset
-count
-filter
-stmt
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
E
-
importCSV
public static long importCSV(File file, Connection conn, String insertSQL, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], throws SQLException, IOExceptionSQLException> stmtSetter) Imports the data from CSV to database.- Parameters:
file
-conn
-insertSQL
- the column order in the sql should be consistent with the column order in the CSV file.stmtSetter
-- Returns:
- Throws:
SQLException
IOException
-
importCSV
public static long importCSV(File file, long offset, long count, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], throws SQLException, IOExceptionSQLException> stmtSetter) - Parameters:
file
-offset
-count
-conn
-insertSQL
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
-
importCSV
public static <E extends Exception> long importCSV(File file, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<String[], E> filter, Connection conn, String insertSQL, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, throws SQLException, IOException, E? super String[], SQLException> stmtSetter) - Type Parameters:
E
-- Parameters:
file
-offset
-count
-filter
-conn
-insertSQL
- the column order in the sql should be consistent with the column order in the CSV file.batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
E
-
importCSV
public static long importCSV(File file, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], throws SQLException, IOExceptionSQLException> stmtSetter) - Parameters:
file
-stmt
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
-
importCSV
public static long importCSV(File file, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], throws SQLException, IOExceptionSQLException> stmtSetter) - Parameters:
file
-offset
-count
-stmt
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
-
importCSV
public static <E extends Exception> long importCSV(File file, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<String[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, throws SQLException, IOException, E? super String[], SQLException> stmtSetter) Imports the data from CSV to database.- Type Parameters:
E
-- Parameters:
file
-offset
-count
-filter
-stmt
- the column order in the sql should be consistent with the column order in the CSV file.batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
E
-
importCSV
public static long importCSV(InputStream is, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], throws SQLException, IOExceptionSQLException> stmtSetter) - Parameters:
is
-stmt
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
-
importCSV
public static long importCSV(InputStream is, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], throws SQLException, IOExceptionSQLException> stmtSetter) - Parameters:
is
-offset
-count
-stmt
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
-
importCSV
public static <E extends Exception> long importCSV(InputStream is, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<String[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, throws SQLException, IOException, E? super String[], SQLException> stmtSetter) Imports the data from CSV to database.- Type Parameters:
E
-- Parameters:
is
-offset
-count
-filter
-stmt
- the column order in the sql should be consistent with the column order in the CSV file.batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
E
-
importCSV
public static long importCSV(Reader reader, PreparedStatement stmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], throws SQLException, IOExceptionSQLException> stmtSetter) - Parameters:
reader
-stmt
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
-
importCSV
public static long importCSV(Reader reader, long offset, long count, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super String[], throws SQLException, IOExceptionSQLException> stmtSetter) - Parameters:
reader
-offset
-count
-stmt
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
-
importCSV
public static <E extends Exception> long importCSV(Reader reader, long offset, long count, com.landawn.abacus.util.Throwables.Predicate<String[], E> filter, PreparedStatement stmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, throws SQLException, IOException, E? super String[], SQLException> stmtSetter) Imports the data from CSV to database.- Type Parameters:
E
-- Parameters:
reader
-offset
-count
-filter
-stmt
- the column order in the sql should be consistent with the column order in the CSV file.batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
IOException
E
-
exportCSV
public static long exportCSV(File out, Connection conn, String querySQL) throws SQLException, IOException Exports the data from database to CVS. Title will be added at the first line and columns will be quoted.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-conn
-querySQL
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(File out, Connection conn, String querySQL, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Exports the data from database to CVS.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-conn
-querySQL
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(File out, Connection conn, String querySQL, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Exports the data from database to CVS.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-conn
-querySQL
-selectColumnNames
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
Exports the data from database to CVS. Title will be added at the first line and columns will be quoted.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-stmt
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(File out, PreparedStatement stmt, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Exports the data from database to CVS.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-stmt
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(File out, PreparedStatement stmt, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Exports the data from database to CVS.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-stmt
-selectColumnNames
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
Exports the data from database to CVS. Title will be added at the first line and columns will be quoted.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-rs
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(File out, ResultSet rs, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Exports the data from database to CVS.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-rs
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(File out, ResultSet rs, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-rs
-selectColumnNames
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
Exports the data from database to CVS. Title will be added at the first line and columns will be quoted.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-rs
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(OutputStream out, ResultSet rs, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Exports the data from database to CVS.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-rs
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(OutputStream out, ResultSet rs, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Exports the data from database to CVS.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-rs
-selectColumnNames
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
Exports the data from database to CVS. Title will be added at the first line and columns will be quoted.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-rs
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(Writer out, ResultSet rs, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Exports the data from database to CVS.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-rs
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
exportCSV
public static long exportCSV(Writer out, ResultSet rs, Collection<String> selectColumnNames, long offset, long count, boolean writeTitle, boolean quoted) throws SQLException, IOException Exports the data from database to CVS.
Each line in the output file/Writer is an array of JSON String without root bracket.- Parameters:
out
-rs
-selectColumnNames
-offset
-count
-writeTitle
-quoted
-- Returns:
- Throws:
SQLException
IOException
-
createParamSetter
@Beta @SequentialOnly @Stateful public static com.landawn.abacus.util.Throwables.BiConsumer<PreparedQuery,ResultSet, createParamSetterSQLException> (Jdbc.ColumnGetter<?> columnGetterForAll) - Parameters:
columnGetterForAll
-- Returns:
-
copy
public static long copy(DataSource sourceDataSource, DataSource targetDataSource, String tableName) throws SQLException - Parameters:
sourceDataSource
-targetDataSource
-tableName
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(DataSource sourceDataSource, DataSource targetDataSource, String sourceTableName, String targetTableName) throws SQLException - Parameters:
sourceDataSource
-targetDataSource
-sourceTableName
-targetTableName
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(DataSource sourceDataSource, DataSource targetDataSource, String sourceTableName, String targetTableName, int batchSize) throws SQLException - Parameters:
sourceDataSource
-targetDataSource
-sourceTableName
-targetTableName
-batchSize
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(DataSource sourceDataSource, DataSource targetDataSource, String sourceTableName, String targetTableName, Collection<String> selectColumnNames) throws SQLException - Parameters:
sourceDataSource
-targetDataSource
-sourceTableName
-targetTableName
-selectColumnNames
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(DataSource sourceDataSource, DataSource targetDataSource, String sourceTableName, String targetTableName, Collection<String> selectColumnNames, int batchSize) throws SQLException - Parameters:
sourceDataSource
-targetDataSource
-sourceTableName
-targetTableName
-selectColumnNames
-batchSize
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(DataSource sourceDataSource, String selectSql, DataSource targetDataSource, String insertSql) throws SQLException - Parameters:
sourceDataSource
-selectSql
-targetDataSource
-insertSql
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(DataSource sourceDataSource, String selectSql, int fetchSize, DataSource targetDataSource, String insertSql, int batchSize) throws SQLException - Parameters:
sourceDataSource
-selectSql
-fetchSize
- it should be bigger thanbatchSize
. It can be x timesbatchSize
, depends on how big one record is and how much memory is available.targetDataSource
-insertSql
-batchSize
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(DataSource sourceDataSource, String selectSql, DataSource targetDataSource, String insertSql, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, throws SQLExceptionSQLException> stmtSetter) - Parameters:
sourceDataSource
-selectSql
-targetDataSource
-insertSql
-stmtSetter
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(DataSource sourceDataSource, String selectSql, int fetchSize, DataSource targetDataSource, String insertSql, int batchSize, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, throws SQLExceptionSQLException> stmtSetter) - Parameters:
sourceDataSource
-selectSql
-fetchSize
- it should be bigger thanbatchSize
. It can be x timesbatchSize
, depends on how big one record is and how much memory is available.targetDataSource
-insertSql
-batchSize
-stmtSetter
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, Connection targetConn, String tableName) throws SQLException - Parameters:
sourceConn
-targetConn
-tableName
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, Connection targetConn, String sourceTableName, String targetTableName) throws SQLException - Parameters:
sourceConn
-targetConn
-sourceTableName
-targetTableName
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, Connection targetConn, String sourceTableName, String targetTableName, int batchSize) throws SQLException - Parameters:
sourceConn
-targetConn
-sourceTableName
-targetTableName
-batchSize
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, Connection targetConn, String sourceTableName, String targetTableName, Collection<String> selectColumnNames) throws SQLException - Parameters:
sourceConn
-targetConn
-sourceTableName
-targetTableName
-selectColumnNames
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, Connection targetConn, String sourceTableName, String targetTableName, Collection<String> selectColumnNames, int batchSize) throws SQLException - Parameters:
sourceConn
-targetConn
-sourceTableName
-targetTableName
-selectColumnNames
-batchSize
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, String selectSql, Connection targetConn, String insertSql) throws SQLException - Parameters:
sourceConn
-selectSql
-targetConn
-insertSql
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, String selectSql, int fetchSize, Connection targetConn, String insertSql, int batchSize) throws SQLException - Parameters:
sourceConn
-selectSql
-fetchSize
- it should be bigger thanbatchSize
. It can be x timesbatchSize
, depends on how big one record is and how much memory is available.targetConn
-insertSql
-batchSize
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, String selectSql, Connection targetConn, String insertSql, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, throws SQLExceptionSQLException> stmtSetter) - Parameters:
sourceConn
-selectSql
-targetConn
-insertSql
-stmtSetter
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, String selectSql, int fetchSize, Connection targetConn, String insertSql, int batchSize, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, throws SQLExceptionSQLException> stmtSetter) - Parameters:
sourceConn
-selectSql
-fetchSize
- it should be bigger thanbatchSize
. It can be x timesbatchSize
, depends on how big one record is and how much memory is available.targetConn
-insertSql
-batchSize
-stmtSetter
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(Connection sourceConn, String selectSql, int fetchSize, long offset, long count, Connection targetConn, String insertSql, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, throws SQLExceptionSQLException> stmtSetter) - Parameters:
sourceConn
-selectSql
-fetchSize
- it should be bigger thanbatchSize
. It can be x timesbatchSize
, depends on how big one record is and how much memory is available.offset
-count
-targetConn
-insertSql
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(PreparedStatement selectStmt, PreparedStatement insertStmt, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, throws SQLExceptionSQLException> stmtSetter) - Parameters:
selectStmt
-insertStmt
-stmtSetter
-- Returns:
- Throws:
SQLException
-
copy
public static long copy(PreparedStatement selectStmt, long offset, long count, PreparedStatement insertStmt, int batchSize, long batchIntervalInMillis, com.landawn.abacus.util.Throwables.BiConsumer<? super PreparedQuery, ? super ResultSet, throws SQLExceptionSQLException> stmtSetter) - Parameters:
selectStmt
-offset
-count
-insertStmt
-batchSize
-batchIntervalInMillis
-stmtSetter
-- Returns:
- Throws:
SQLException
-