oracle.jdbc.OracleCallableStatement Java Examples

The following examples show how to use oracle.jdbc.OracleCallableStatement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TMDatabaseImpl.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 依据ID值批量更新数据库
 * @param oldPname
 * @param oldContent
 * @param newPname
 * @param newContent
 * @param ids
 * @return
 * @throws SQLException
 *             ;
 */
public boolean updatePropByIds(String oldPname, String oldContent, String newPname, String newContent,
		List<Integer> ids) throws SQLException {
	if (null == ids || ids.isEmpty()) {
		return false;
	}
	String updateSql = dbConfig.getOperateDbSQL("update-mprop-by-content-ids");
	List<List<Integer>> list = groupIds(ids);
	boolean flag = false;
	for (List<Integer> t : list) {
		updateSql = updateSql.replaceAll("_SET_", converList2SetString(t));
		OracleCallableStatement prepareCall = (OracleCallableStatement) conn.prepareCall(updateSql);
		prepareCall.setString(1, newPname);
		prepareCall.setStringForClob(2, newContent);
		prepareCall.setString(3, oldPname);
		prepareCall.setString(4, oldContent);
		int executeUpdate = prepareCall.executeUpdate();
		if (executeUpdate > 0) {
			flag = true;
		}
		prepareCall.close();
	}

	return flag;

}
 
Example #2
Source File: TMDatabaseImpl.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 批量更新整个数据库
 * @param oldPname
 * @param oldContent
 * @param newPname
 * @param newContent
 * @return
 * @throws SQLException
 *             ;
 */
public boolean updateAllProp(String oldPname, String oldContent, String newPname, String newContent)
		throws SQLException {
	String updateSql = dbConfig.getOperateDbSQL("update-mprop-by-content");
	OracleCallableStatement prepareCall = (OracleCallableStatement) conn.prepareCall(updateSql);
	prepareCall.setString(1, newPname);
	prepareCall.setStringForClob(2, newContent);
	prepareCall.setString(3, oldPname);
	prepareCall.setString(4, oldContent);
	int executeUpdate = prepareCall.executeUpdate();
	prepareCall.close();
	if (executeUpdate > 0) {
		return true;
	}
	return false;
}