Liran Zelkha has posted comments on this change.
Change subject: core: Introducing Batch updates to DAOs
......................................................................
Patch Set 3: (9 inline comments)
....................................................
File
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/SimpleJdbcCallsHandler.java
Line 33: private DbEngineDialect dialect;
Line 34:
Line 35: private JdbcTemplate template;
Line 36:
Line 37: // private Map<String, List<MapSqlParameterSource>> batchSqls;
Done.
Line 38:
Line 39: public void setDbEngineDialect(DbEngineDialect dialect) {
Line 40: this.dialect = dialect;
Line 41: }
Line 56: * @param executions
Line 57: * A list of parameter maps
Line 58: * @return
Line 59: */
Line 60: public void runBatch(final String procName,
Done
Line 61: final List<MapSqlParameterSource> executions)
Line 62: throws DataAccessException {
Line 63:
Line 64: template.execute(new ConnectionCallback<Object>() {
Line 81: try {
Line 82: stmt.executeBatch();
Line 83: } catch (SQLException e) {
Line 84: log.fatal("Can't execute batch: ", e);
Line 85: log.fatal("Can't execute batch. Next exception is:
",
Done
Line 86: e.getNextException());
Line 87: throw e;
Line 88: }
Line 89:
Line 83: } catch (SQLException e) {
Line 84: log.fatal("Can't execute batch: ", e);
Line 85: log.fatal("Can't execute batch. Next exception is:
",
Line 86: e.getNextException());
Line 87: throw e;
Fixed
Line 88: }
Line 89:
Line 90: stmt.close();
Line 91:
Line 86: e.getNextException());
Line 87: throw e;
Line 88: }
Line 89:
Line 90: stmt.close();
Done
Line 91:
Line 92: return null;
Line 93: }
Line 94:
Line 148:
Line 149: if (params.length() > 0) {
Line 150: params.deleteCharAt(params.length() - 1);
Line 151: }
Line 152: rs2.close();
Done
Line 153:
Line 154: StringBuffer sqlCommand = new StringBuffer();
Line 155: sqlCommand.append("{call ").append(procSchemaFromDB)
Line 156:
.append(".").append(procNameFromDB).append("(")
Line 151: }
Line 152: rs2.close();
Line 153:
Line 154: StringBuffer sqlCommand = new StringBuffer();
Line 155: sqlCommand.append("{call ").append(procSchemaFromDB)
Fixed. In DBDialect now
Line 156:
.append(".").append(procNameFromDB).append("(")
Line 157: .append(params).append(")}");
Line 158:
Line 159: procMetaData.setSqlCommand(sqlCommand.toString());
....................................................
File
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BatchDaoTest.java
Line 14: import org.ovirt.engine.core.compat.NGuid;
Line 15: import org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource;
Line 16: import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
Line 17:
Line 18: public class BatchDaoTest extends BaseDAOTestCase {
True. Fixed.
Line 19:
Line 20: private TagDAO dao;
Line 21:
Line 22: public BatchDaoTest() {
Line 16: import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
Line 17:
Line 18: public class BatchDaoTest extends BaseDAOTestCase {
Line 19:
Line 20: private TagDAO dao;
Any other option will make this test much more complex (create a special stored
procedure for it, etc.)
Line 21:
Line 22: public BatchDaoTest() {
Line 23: }
Line 24:
--
To view, visit http://gerrit.ovirt.org/15039
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: If5ee0aa90bca3b5c257beb7b0eaa236f02f0206f
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Liran Zelkha <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches