当前位置: 首页>>代码示例>>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;未经允许,请勿转载。