use of org.jumpmind.db.sql.ISqlTransaction in project symmetric-ds by JumpMind.
the class TestTablesService method updateTestUseStreamLob.
// TODO support insert of blob test for postgres and informix
public boolean updateTestUseStreamLob(int id, String tableName, String lobValue) {
if (symmetricDialect.isBlobSyncSupported()) {
if (!DatabaseNamesConstants.INFORMIX.equals(platform.getName())) {
ISqlTransaction transaction = null;
try {
transaction = sqlTemplate.startSqlTransaction();
boolean updated = transaction.prepareAndExecute(String.format("update %s set test_blob=? where test_id=?", tableName), new Object[] { lobValue.getBytes(), id }, new int[] { Types.BLOB, Types.INTEGER }) > 0;
transaction.commit();
return updated;
} finally {
if (transaction != null) {
transaction.close();
}
}
} else {
return false;
}
} else {
return false;
}
}
use of org.jumpmind.db.sql.ISqlTransaction in project symmetric-ds by JumpMind.
the class TestTablesService method insertIntoTestUseStreamLob.
// TODO support insert of blob test for postgres and informix
public boolean insertIntoTestUseStreamLob(int id, String tableName, String lobValue) {
if (symmetricDialect.isBlobSyncSupported()) {
ISqlTransaction transaction = null;
try {
transaction = sqlTemplate.startSqlTransaction();
boolean updated = transaction.prepareAndExecute(String.format("insert into %s (test_id, test_blob) values(?, ?)", tableName), new Object[] { id, lobValue.getBytes() }, new int[] { Types.INTEGER, Types.BLOB }) > 0;
transaction.commit();
return updated;
} finally {
if (transaction != null) {
transaction.close();
}
}
} else {
return false;
}
}
use of org.jumpmind.db.sql.ISqlTransaction in project symmetric-ds by JumpMind.
the class TestTablesService method insertIntoTestTriggerTable.
public void insertIntoTestTriggerTable(Object[] values) {
Table testTriggerTable = platform.getTableFromCache(null, null, "test_triggers_table", true);
DatabaseInfo dbInfo = getSymmetricDialect().getPlatform().getDatabaseInfo();
String quote = dbInfo.getDelimiterToken();
String catalogSeparator = dbInfo.getCatalogSeparator();
String schemaSeparator = dbInfo.getSchemaSeparator();
ISqlTransaction transaction = sqlTemplate.startSqlTransaction();
try {
transaction.allowInsertIntoAutoIncrementColumns(true, testTriggerTable, quote, catalogSeparator, schemaSeparator);
transaction.prepareAndExecute(getSql("insertIntoTestTriggersTableSql"), values);
transaction.commit();
} finally {
transaction.allowInsertIntoAutoIncrementColumns(false, testTriggerTable, quote, catalogSeparator, schemaSeparator);
transaction.close();
}
}
Aggregations