當前位置: 首頁>>代碼示例>>Java>>正文


Java PreparedStatement.clearBatch方法代碼示例

本文整理匯總了Java中java.sql.PreparedStatement.clearBatch方法的典型用法代碼示例。如果您正苦於以下問題:Java PreparedStatement.clearBatch方法的具體用法?Java PreparedStatement.clearBatch怎麽用?Java PreparedStatement.clearBatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.sql.PreparedStatement的用法示例。


在下文中一共展示了PreparedStatement.clearBatch方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: insert

import java.sql.PreparedStatement; //導入方法依賴的package包/類
private long insert(Connection con, List<Map<String, String>> list)
		throws SQLException {
	PreparedStatement ps;

	String sql = "insert into travelrecord (id,user_id,traveldate,fee,days) values(?,?,?,?,?)";
	ps = con.prepareStatement(sql);
	for (Map<String, String> map : list) {
		ps.setLong(1, Long.parseLong(map.get("id")));
		ps.setString(2, (String) map.get("user_id"));
		ps.setString(3, (String) map.get("traveldate"));
		ps.setString(4, (String) map.get("fee"));
		ps.setString(5, (String) map.get("days"));
		ps.addBatch();
	}
	ps.executeBatch();
	con.commit();
	ps.clearBatch();
	ps.close();
	return list.size();
}
 
開發者ID:huang-up,項目名稱:mycat-src-1.6.1-RELEASE,代碼行數:21,代碼來源:TravelRecordInsertJob.java

示例2: insert

import java.sql.PreparedStatement; //導入方法依賴的package包/類
private int insert(Connection con, List<Map<String, String>> list)
		throws SQLException {
	PreparedStatement ps;

	String sql = "insert into travelrecord (user_id,traveldate,fee,days) values(?,?,?,?,?)";
	ps = con.prepareStatement(sql);
	for (Map<String, String> map : list) {
		//ps.setLong(1, Long.parseLong(map.get("id")));
		ps.setString(1, (String) map.get("user_id"));
		ps.setString(2, (String) map.get("traveldate"));
		ps.setString(3, (String) map.get("fee"));
		ps.setString(4, (String) map.get("days"));
		ps.addBatch();

	}
	ps.executeBatch();
	con.commit();
	ps.clearBatch();
	ps.close();
	return list.size();
}
 
開發者ID:huang-up,項目名稱:mycat-src-1.6.1-RELEASE,代碼行數:22,代碼來源:TravelRecordGlobalSeqInsertJob.java

示例3: insert

import java.sql.PreparedStatement; //導入方法依賴的package包/類
private long insert(Connection con, List<Map<String, String>> list)
        throws SQLException {
    PreparedStatement ps;

    String sql = "insert into travelrecord (id,user_id,traveldate,fee,days) values(?,?,?,?,?)";
    ps = con.prepareStatement(sql);
    for (Map<String, String> map : list) {
        ps.setLong(1, Long.parseLong(map.get("id")));
        ps.setString(2, (String) map.get("user_id"));
        ps.setString(3, (String) map.get("traveldate"));
        ps.setString(4, (String) map.get("fee"));
        ps.setString(5, (String) map.get("days"));
        ps.addBatch();
    }
    ps.executeBatch();
    con.commit();
    ps.clearBatch();
    ps.close();
    return list.size();
}
 
開發者ID:actiontech,項目名稱:dble,代碼行數:21,代碼來源:TravelRecordInsertJob.java

示例4: insert

import java.sql.PreparedStatement; //導入方法依賴的package包/類
private int insert(Connection con, List<Map<String, String>> list)
        throws SQLException {
    PreparedStatement ps;

    String sql = "insert into travelrecord (user_id,traveldate,fee,days) values(?,?,?,?,?)";
    ps = con.prepareStatement(sql);
    for (Map<String, String> map : list) {
        //ps.setLong(1, Long.parseLong(map.get("id")));
        ps.setString(1, (String) map.get("user_id"));
        ps.setString(2, (String) map.get("traveldate"));
        ps.setString(3, (String) map.get("fee"));
        ps.setString(4, (String) map.get("days"));
        ps.addBatch();

    }
    ps.executeBatch();
    con.commit();
    ps.clearBatch();
    ps.close();
    return list.size();
}
 
開發者ID:actiontech,項目名稱:dble,代碼行數:22,代碼來源:TravelRecordGlobalSeqInsertJob.java

示例5: clearBatch

import java.sql.PreparedStatement; //導入方法依賴的package包/類
protected void clearBatch(PreparedStatement statement) {
	try {
		statement.clearBatch();
	}
	catch ( SQLException e ) {
		LOG.unableToReleaseBatchStatement();
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:AbstractBatchImpl.java

示例6: getPreparedStatement

import java.sql.PreparedStatement; //導入方法依賴的package包/類
/** Returns the PreparedStatement object for the input sql.
 * @param sql the sql statement which needs to be precompiled.
 * @throws SQLException if any database error occurs.
 * @return the PreparedStatement object.
 */
public PreparedStatement getPreparedStatement(String sql) throws SQLException {
    PreparedStatement pstmt = null;
    // Use the regular prepared-statement if the logging is set to warn or higher, else use a proxy
    if (log.getEffectiveLevel().isGreaterOrEqual(Level.WARN))
        pstmt = m_connection.prepareStatement(sql);
    else
        pstmt = new PreparedStatementProxyForDebugging(m_connection, sql);
    pstmt.clearBatch();
    pstmt.clearParameters();
    pstmt.clearWarnings();
    registerStatement(pstmt, null);
    return pstmt;
}
 
開發者ID:jaffa-projects,項目名稱:jaffa-framework,代碼行數:19,代碼來源:DataSource.java


注:本文中的java.sql.PreparedStatement.clearBatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。