提交 572abc02 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 b4f64a3d
...@@ -55,9 +55,9 @@ public class ShowProgress implements DatabaseEventListener { ...@@ -55,9 +55,9 @@ public class ShowProgress implements DatabaseEventListener {
time = System.currentTimeMillis(); time = System.currentTimeMillis();
int len = 1000; int len = 1000;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
long last = System.currentTimeMillis(); long now = System.currentTimeMillis();
if (last > time + 1000) { if (now > time + 1000) {
time = last; time = now;
System.out.println("Inserting " + (100L * i / len) + "%"); System.out.println("Inserting " + (100L * i / len) + "%");
} }
prep.setInt(1, i); prep.setInt(1, i);
......
...@@ -22,16 +22,16 @@ public class BenchA implements Bench { ...@@ -22,16 +22,16 @@ public class BenchA implements Bench {
private static final String FILLER = "abcdefghijklmnopqrstuvwxyz"; private static final String FILLER = "abcdefghijklmnopqrstuvwxyz";
private static final int DELTA = 10000; private static final int DELTA = 10000;
private Database db; private Database database;
private int branches; private int branches;
private int tellers; private int tellers;
private int accounts; private int accounts;
private int size; private int transactions;
public void init(Database db, int size) throws SQLException { public void init(Database db, int size) throws SQLException {
this.db = db; this.database = db;
this.size = size; transactions = size * 30;
int scale = 1; int scale = 1;
accounts = size * 50; accounts = size * 50;
...@@ -100,32 +100,31 @@ public class BenchA implements Bench { ...@@ -100,32 +100,31 @@ public class BenchA implements Bench {
public void runTest() throws SQLException { public void runTest() throws SQLException {
db.start(this, "Transactions"); database.start(this, "Transactions");
db.openConnection(); database.openConnection();
processTransactions(); processTransactions();
db.closeConnection(); database.closeConnection();
db.end(); database.end();
db.openConnection(); database.openConnection();
processTransactions(); processTransactions();
db.logMemory(this, "Memory Usage"); database.logMemory(this, "Memory Usage");
db.closeConnection(); database.closeConnection();
} }
private void processTransactions() throws SQLException { private void processTransactions() throws SQLException {
Random random = db.getRandom(); Random random = database.getRandom();
int branch = random.nextInt(branches); int branch = random.nextInt(branches);
int teller = random.nextInt(tellers); int teller = random.nextInt(tellers);
int transactions = size * 30;
PreparedStatement updateAccount = db.prepare("UPDATE ACCOUNTS SET ABALANCE=ABALANCE+? WHERE AID=?"); PreparedStatement updateAccount = database.prepare("UPDATE ACCOUNTS SET ABALANCE=ABALANCE+? WHERE AID=?");
PreparedStatement selectBalance = db.prepare("SELECT ABALANCE FROM ACCOUNTS WHERE AID=?"); PreparedStatement selectBalance = database.prepare("SELECT ABALANCE FROM ACCOUNTS WHERE AID=?");
PreparedStatement updateTeller = db.prepare("UPDATE TELLERS SET TBALANCE=TBALANCE+? WHERE TID=?"); PreparedStatement updateTeller = database.prepare("UPDATE TELLERS SET TBALANCE=TBALANCE+? WHERE TID=?");
PreparedStatement updateBranch = db.prepare("UPDATE BRANCHES SET BBALANCE=BBALANCE+? WHERE BID=?"); PreparedStatement updateBranch = database.prepare("UPDATE BRANCHES SET BBALANCE=BBALANCE+? WHERE BID=?");
PreparedStatement insertHistory = db.prepare("INSERT INTO HISTORY(AID,TID,BID,DELTA,HTIME,FILLER) VALUES(?,?,?,?,?,?)"); PreparedStatement insertHistory = database.prepare("INSERT INTO HISTORY(AID,TID,BID,DELTA,HTIME,FILLER) VALUES(?,?,?,?,?,?)");
int accountsPerBranch = accounts / branches; int accountsPerBranch = accounts / branches;
db.setAutoCommit(false); database.setAutoCommit(false);
for (int i = 0; i < transactions; i++) { for (int i = 0; i < transactions; i++) {
int account; int account;
...@@ -142,18 +141,18 @@ public class BenchA implements Bench { ...@@ -142,18 +141,18 @@ public class BenchA implements Bench {
updateAccount.setBigDecimal(1, delta); updateAccount.setBigDecimal(1, delta);
updateAccount.setInt(2, account); updateAccount.setInt(2, account);
db.update(updateAccount, "updateAccount"); database.update(updateAccount, "updateAccount");
updateTeller.setBigDecimal(1, delta); updateTeller.setBigDecimal(1, delta);
updateTeller.setInt(2, teller); updateTeller.setInt(2, teller);
db.update(updateTeller, "updateTeller"); database.update(updateTeller, "updateTeller");
updateBranch.setBigDecimal(1, delta); updateBranch.setBigDecimal(1, delta);
updateBranch.setInt(2, branch); updateBranch.setInt(2, branch);
db.update(updateBranch, "updateBranch"); database.update(updateBranch, "updateBranch");
selectBalance.setInt(1, account); selectBalance.setInt(1, account);
db.queryReadResult(selectBalance); database.queryReadResult(selectBalance);
insertHistory.setInt(1, account); insertHistory.setInt(1, account);
insertHistory.setInt(2, teller); insertHistory.setInt(2, teller);
...@@ -164,9 +163,9 @@ public class BenchA implements Bench { ...@@ -164,9 +163,9 @@ public class BenchA implements Bench {
// insertHistory.setDate(5, new java.sql.Date(current)); // insertHistory.setDate(5, new java.sql.Date(current));
insertHistory.setTimestamp(5, new java.sql.Timestamp(current)); insertHistory.setTimestamp(5, new java.sql.Timestamp(current));
insertHistory.setString(6, BenchA.FILLER); insertHistory.setString(6, BenchA.FILLER);
db.update(insertHistory, "insertHistory"); database.update(insertHistory, "insertHistory");
db.commit(); database.commit();
} }
updateAccount.close(); updateAccount.close();
selectBalance.close(); selectBalance.close();
......
...@@ -22,7 +22,7 @@ import java.util.Random; ...@@ -22,7 +22,7 @@ import java.util.Random;
public class BenchB implements Bench, Runnable { public class BenchB implements Bench, Runnable {
// master data // master data
private Database db; private Database database;
private int scale = 1; private int scale = 1;
private int branches = 1; private int branches = 1;
private int tellers = 10; private int tellers = 10;
...@@ -47,7 +47,7 @@ public class BenchB implements Bench, Runnable { ...@@ -47,7 +47,7 @@ public class BenchB implements Bench, Runnable {
private BenchB(BenchB master, int seed) throws SQLException { private BenchB(BenchB master, int seed) throws SQLException {
this.master = master; this.master = master;
random = new Random(seed); random = new Random(seed);
conn = master.db.openNewConnection(); conn = master.database.openNewConnection();
conn.setAutoCommit(false); conn.setAutoCommit(false);
updateAccount = conn.prepareStatement( updateAccount = conn.prepareStatement(
"UPDATE ACCOUNTS SET ABALANCE=ABALANCE+? WHERE AID=?"); "UPDATE ACCOUNTS SET ABALANCE=ABALANCE+? WHERE AID=?");
...@@ -62,7 +62,7 @@ public class BenchB implements Bench, Runnable { ...@@ -62,7 +62,7 @@ public class BenchB implements Bench, Runnable {
} }
public void init(Database db, int size) throws SQLException { public void init(Database db, int size) throws SQLException {
this.db = db; this.database = db;
this.transactionPerClient = size; this.transactionPerClient = size;
db.start(this, "Init"); db.start(this, "Init");
...@@ -181,6 +181,7 @@ public class BenchB implements Bench, Runnable { ...@@ -181,6 +181,7 @@ public class BenchB implements Bench, Runnable {
public void runTest() throws Exception { public void runTest() throws Exception {
Database db = database;
db.start(this, "Transactions"); db.start(this, "Transactions");
db.openConnection(); db.openConnection();
processTransactions(); processTransactions();
......
...@@ -169,7 +169,7 @@ public class BenchC implements Bench { ...@@ -169,7 +169,7 @@ public class BenchC implements Bench {
int districtsPerWarehouse = 10; int districtsPerWarehouse = 10;
int customersPerDistrict = 300; int customersPerDistrict = 300;
private Database db; private Database database;
private int ordersPerDistrict = 300; private int ordersPerDistrict = 300;
...@@ -180,7 +180,7 @@ public class BenchC implements Bench { ...@@ -180,7 +180,7 @@ public class BenchC implements Bench {
public void init(Database db, int size) throws SQLException { public void init(Database db, int size) throws SQLException {
this.db = db; this.database = db;
random = new BenchCRandom(); random = new BenchCRandom();
...@@ -206,17 +206,17 @@ public class BenchC implements Bench { ...@@ -206,17 +206,17 @@ public class BenchC implements Bench {
private void load() throws SQLException { private void load() throws SQLException {
for (String sql : TABLES) { for (String sql : TABLES) {
db.dropTable(sql); database.dropTable(sql);
} }
for (String sql : CREATE_SQL) { for (String sql : CREATE_SQL) {
db.update(sql); database.update(sql);
} }
db.setAutoCommit(false); database.setAutoCommit(false);
loadItem(); loadItem();
loadWarehouse(); loadWarehouse();
loadCustomer(); loadCustomer();
loadOrder(); loadOrder();
db.commit(); database.commit();
trace("Load done"); trace("Load done");
} }
...@@ -225,13 +225,13 @@ public class BenchC implements Bench { ...@@ -225,13 +225,13 @@ public class BenchC implements Bench {
} }
private void trace(int i, int max) { private void trace(int i, int max) {
db.trace(action, i, max); database.trace(action, i, max);
} }
private void loadItem() throws SQLException { private void loadItem() throws SQLException {
trace("Loading item table"); trace("Loading item table");
boolean[] original = random.getBoolean(items, items / 10); boolean[] original = random.getBoolean(items, items / 10);
PreparedStatement prep = db.prepare( PreparedStatement prep = database.prepare(
"INSERT INTO ITEM(I_ID, I_IM_ID, I_NAME, I_PRICE, I_DATA) " + "INSERT INTO ITEM(I_ID, I_IM_ID, I_NAME, I_PRICE, I_DATA) " +
"VALUES(?, ?, ?, ?, ?)"); "VALUES(?, ?, ?, ?, ?)");
for (int id = 1; id <= items; id++) { for (int id = 1; id <= items; id++) {
...@@ -246,17 +246,17 @@ public class BenchC implements Bench { ...@@ -246,17 +246,17 @@ public class BenchC implements Bench {
prep.setString(3, name); prep.setString(3, name);
prep.setBigDecimal(4, price); prep.setBigDecimal(4, price);
prep.setString(5, data); prep.setString(5, data);
db.update(prep, "insertItem"); database.update(prep, "insertItem");
trace(id, items); trace(id, items);
if (id % commitEvery == 0) { if (id % commitEvery == 0) {
db.commit(); database.commit();
} }
} }
} }
private void loadWarehouse() throws SQLException { private void loadWarehouse() throws SQLException {
trace("Loading warehouse table"); trace("Loading warehouse table");
PreparedStatement prep = db.prepare( PreparedStatement prep = database.prepare(
"INSERT INTO WAREHOUSE(W_ID, W_NAME, W_STREET_1, " + "INSERT INTO WAREHOUSE(W_ID, W_NAME, W_STREET_1, " +
"W_STREET_2, W_CITY, W_STATE, W_ZIP, W_TAX, W_YTD) " + "W_STREET_2, W_CITY, W_STATE, W_ZIP, W_TAX, W_YTD) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"); "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)");
...@@ -279,11 +279,11 @@ public class BenchC implements Bench { ...@@ -279,11 +279,11 @@ public class BenchC implements Bench {
prep.setString(7, zip); prep.setString(7, zip);
prep.setBigDecimal(8, tax); prep.setBigDecimal(8, tax);
prep.setBigDecimal(9, ytd); prep.setBigDecimal(9, ytd);
db.update(prep, "insertWarehouse"); database.update(prep, "insertWarehouse");
loadStock(id); loadStock(id);
loadDistrict(id); loadDistrict(id);
if (id % commitEvery == 0) { if (id % commitEvery == 0) {
db.commit(); database.commit();
} }
} }
} }
...@@ -297,7 +297,7 @@ public class BenchC implements Bench { ...@@ -297,7 +297,7 @@ public class BenchC implements Bench {
loadCustomerSub(districtId, id); loadCustomerSub(districtId, id);
trace(i++, max); trace(i++, max);
if (i % commitEvery == 0) { if (i % commitEvery == 0) {
db.commit(); database.commit();
} }
} }
} }
...@@ -305,7 +305,7 @@ public class BenchC implements Bench { ...@@ -305,7 +305,7 @@ public class BenchC implements Bench {
private void loadCustomerSub(int dId, int wId) throws SQLException { private void loadCustomerSub(int dId, int wId) throws SQLException {
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
PreparedStatement prepCustomer = db.prepare( PreparedStatement prepCustomer = database.prepare(
"INSERT INTO CUSTOMER(C_ID, C_D_ID, C_W_ID, " + "INSERT INTO CUSTOMER(C_ID, C_D_ID, C_W_ID, " +
"C_FIRST, C_MIDDLE, C_LAST, " + "C_FIRST, C_MIDDLE, C_LAST, " +
"C_STREET_1, C_STREET_2, C_CITY, C_STATE, C_ZIP, " + "C_STREET_1, C_STREET_2, C_CITY, C_STATE, C_ZIP, " +
...@@ -313,7 +313,7 @@ public class BenchC implements Bench { ...@@ -313,7 +313,7 @@ public class BenchC implements Bench {
"C_CREDIT_LIM, C_DISCOUNT, C_BALANCE, C_DATA, " + "C_CREDIT_LIM, C_DISCOUNT, C_BALANCE, C_DATA, " +
"C_YTD_PAYMENT, C_PAYMENT_CNT, C_DELIVERY_CNT) " + "C_YTD_PAYMENT, C_PAYMENT_CNT, C_DELIVERY_CNT) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PreparedStatement prepHistory = db.prepare( PreparedStatement prepHistory = database.prepare(
"INSERT INTO HISTORY(H_C_ID, H_C_D_ID, H_C_W_ID, " + "INSERT INTO HISTORY(H_C_ID, H_C_D_ID, H_C_W_ID, " +
"H_W_ID, H_D_ID, H_DATE, H_AMOUNT, H_DATA) " + "H_W_ID, H_D_ID, H_DATE, H_AMOUNT, H_DATA) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); "VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
...@@ -367,7 +367,7 @@ public class BenchC implements Bench { ...@@ -367,7 +367,7 @@ public class BenchC implements Bench {
prepCustomer.setBigDecimal(19, ytdPayment); prepCustomer.setBigDecimal(19, ytdPayment);
prepCustomer.setInt(20, paymentCnt); prepCustomer.setInt(20, paymentCnt);
prepCustomer.setInt(21, deliveryCnt); prepCustomer.setInt(21, deliveryCnt);
db.update(prepCustomer, "insertCustomer"); database.update(prepCustomer, "insertCustomer");
BigDecimal amount = new BigDecimal("10.00"); BigDecimal amount = new BigDecimal("10.00");
String hData = random.getString(12, 24); String hData = random.getString(12, 24);
prepHistory.setInt(1, cId); prepHistory.setInt(1, cId);
...@@ -378,7 +378,7 @@ public class BenchC implements Bench { ...@@ -378,7 +378,7 @@ public class BenchC implements Bench {
prepHistory.setTimestamp(6, timestamp); prepHistory.setTimestamp(6, timestamp);
prepHistory.setBigDecimal(7, amount); prepHistory.setBigDecimal(7, amount);
prepHistory.setString(8, hData); prepHistory.setString(8, hData);
db.update(prepHistory, "insertHistory"); database.update(prepHistory, "insertHistory");
} }
} }
...@@ -397,14 +397,14 @@ public class BenchC implements Bench { ...@@ -397,14 +397,14 @@ public class BenchC implements Bench {
private void loadOrderSub(int dId, int wId) throws SQLException { private void loadOrderSub(int dId, int wId) throws SQLException {
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
int[] orderid = random.getPermutation(ordersPerDistrict); int[] orderid = random.getPermutation(ordersPerDistrict);
PreparedStatement prepOrder = db.prepare( PreparedStatement prepOrder = database.prepare(
"INSERT INTO ORDERS(O_ID, O_C_ID, O_D_ID, O_W_ID, " + "INSERT INTO ORDERS(O_ID, O_C_ID, O_D_ID, O_W_ID, " +
"O_ENTRY_D, O_CARRIER_ID, O_OL_CNT, O_ALL_LOCAL) " + "O_ENTRY_D, O_CARRIER_ID, O_OL_CNT, O_ALL_LOCAL) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, 1)"); "VALUES(?, ?, ?, ?, ?, ?, ?, 1)");
PreparedStatement prepNewOrder = db.prepare( PreparedStatement prepNewOrder = database.prepare(
"INSERT INTO NEW_ORDER (NO_O_ID, NO_D_ID, NO_W_ID) " + "INSERT INTO NEW_ORDER (NO_O_ID, NO_D_ID, NO_W_ID) " +
"VALUES (?, ?, ?)"); "VALUES (?, ?, ?)");
PreparedStatement prepLine = db.prepare( PreparedStatement prepLine = database.prepare(
"INSERT INTO ORDER_LINE(" + "INSERT INTO ORDER_LINE(" +
"OL_O_ID, OL_D_ID, OL_W_ID, OL_NUMBER, " + "OL_O_ID, OL_D_ID, OL_W_ID, OL_NUMBER, " +
"OL_I_ID, OL_SUPPLY_W_ID, OL_QUANTITY, OL_AMOUNT, " + "OL_I_ID, OL_SUPPLY_W_ID, OL_QUANTITY, OL_AMOUNT, " +
...@@ -428,9 +428,9 @@ public class BenchC implements Bench { ...@@ -428,9 +428,9 @@ public class BenchC implements Bench {
prepNewOrder.setInt(1, oId); prepNewOrder.setInt(1, oId);
prepNewOrder.setInt(2, dId); prepNewOrder.setInt(2, dId);
prepNewOrder.setInt(3, wId); prepNewOrder.setInt(3, wId);
db.update(prepNewOrder, "newNewOrder"); database.update(prepNewOrder, "newNewOrder");
} }
db.update(prepOrder, "insertOrder"); database.update(prepOrder, "insertOrder");
for (int ol = 1; ol <= olCnt; ol++) { for (int ol = 1; ol <= olCnt; ol++) {
int id = random.getInt(1, items); int id = random.getInt(1, items);
int supplyId = wId; int supplyId = wId;
...@@ -451,9 +451,9 @@ public class BenchC implements Bench { ...@@ -451,9 +451,9 @@ public class BenchC implements Bench {
prepLine.setInt(7, quantity); prepLine.setInt(7, quantity);
prepLine.setBigDecimal(8, amount); prepLine.setBigDecimal(8, amount);
prepLine.setString(9, distInfo); prepLine.setString(9, distInfo);
db.update(prepLine, "insertOrderLine"); database.update(prepLine, "insertOrderLine");
if (i++ % commitEvery == 0) { if (i++ % commitEvery == 0) {
db.commit(); database.commit();
} }
} }
} }
...@@ -462,7 +462,7 @@ public class BenchC implements Bench { ...@@ -462,7 +462,7 @@ public class BenchC implements Bench {
private void loadStock(int wId) throws SQLException { private void loadStock(int wId) throws SQLException {
trace("Loading stock table (warehouse " + wId + ")"); trace("Loading stock table (warehouse " + wId + ")");
boolean[] original = random.getBoolean(items, items / 10); boolean[] original = random.getBoolean(items, items / 10);
PreparedStatement prep = db.prepare( PreparedStatement prep = database.prepare(
"INSERT INTO STOCK(S_I_ID, S_W_ID, S_QUANTITY, " + "INSERT INTO STOCK(S_I_ID, S_W_ID, S_QUANTITY, " +
"S_DIST_01, S_DIST_02, S_DIST_03, S_DIST_04, S_DIST_05, " + "S_DIST_01, S_DIST_02, S_DIST_03, S_DIST_04, S_DIST_05, " +
"S_DIST_06, S_DIST_07, S_DIST_08, S_DIST_09, S_DIST_10, " + "S_DIST_06, S_DIST_07, S_DIST_08, S_DIST_09, S_DIST_10, " +
...@@ -501,9 +501,9 @@ public class BenchC implements Bench { ...@@ -501,9 +501,9 @@ public class BenchC implements Bench {
prep.setInt(15, 0); prep.setInt(15, 0);
prep.setInt(16, 0); prep.setInt(16, 0);
prep.setInt(17, 0); prep.setInt(17, 0);
db.update(prep, "insertStock"); database.update(prep, "insertStock");
if (id % commitEvery == 0) { if (id % commitEvery == 0) {
db.commit(); database.commit();
} }
trace(id, items); trace(id, items);
} }
...@@ -512,7 +512,7 @@ public class BenchC implements Bench { ...@@ -512,7 +512,7 @@ public class BenchC implements Bench {
private void loadDistrict(int wId) throws SQLException { private void loadDistrict(int wId) throws SQLException {
BigDecimal ytd = new BigDecimal("300000.00"); BigDecimal ytd = new BigDecimal("300000.00");
int nextId = 3001; int nextId = 3001;
PreparedStatement prep = db.prepare( PreparedStatement prep = database.prepare(
"INSERT INTO DISTRICT(D_ID, D_W_ID, D_NAME, " + "INSERT INTO DISTRICT(D_ID, D_W_ID, D_NAME, " +
"D_STREET_1, D_STREET_2, D_CITY, D_STATE, D_ZIP, " + "D_STREET_1, D_STREET_2, D_CITY, D_STATE, D_ZIP, " +
"D_TAX, D_YTD, D_NEXT_O_ID) " + "D_TAX, D_YTD, D_NEXT_O_ID) " +
...@@ -537,26 +537,26 @@ public class BenchC implements Bench { ...@@ -537,26 +537,26 @@ public class BenchC implements Bench {
prep.setBigDecimal(9, tax); prep.setBigDecimal(9, tax);
prep.setBigDecimal(10, ytd); prep.setBigDecimal(10, ytd);
prep.setInt(11, nextId); prep.setInt(11, nextId);
db.update(prep, "insertDistrict"); database.update(prep, "insertDistrict");
trace(dId, districtsPerWarehouse); trace(dId, districtsPerWarehouse);
} }
} }
public void runTest() throws SQLException { public void runTest() throws SQLException {
db.start(this, "Transactions"); database.start(this, "Transactions");
db.openConnection(); database.openConnection();
for (int i = 0; i < 70; i++) { for (int i = 0; i < 70; i++) {
BenchCThread process = new BenchCThread(db, this, random, i); BenchCThread process = new BenchCThread(database, this, random, i);
process.process(); process.process();
} }
db.closeConnection(); database.closeConnection();
db.end(); database.end();
db.openConnection(); database.openConnection();
BenchCThread process = new BenchCThread(db, this, random, 0); BenchCThread process = new BenchCThread(database, this, random, 0);
process.process(); process.process();
db.logMemory(this, "Memory Usage"); database.logMemory(this, "Memory Usage");
db.closeConnection(); database.closeConnection();
} }
public String getName() { public String getName() {
......
...@@ -17,11 +17,11 @@ import java.util.Random; ...@@ -17,11 +17,11 @@ import java.util.Random;
*/ */
public class BenchSimple implements Bench { public class BenchSimple implements Bench {
Database db; Database database;
int records; int records;
public void init(Database db, int size) throws SQLException { public void init(Database db, int size) throws SQLException {
this.db = db; this.database = db;
this.records = size * 60; this.records = size * 60;
db.start(this, "Init"); db.start(this, "Init");
...@@ -53,6 +53,7 @@ public class BenchSimple implements Bench { ...@@ -53,6 +53,7 @@ public class BenchSimple implements Bench {
public void runTest() throws SQLException { public void runTest() throws SQLException {
PreparedStatement prep; PreparedStatement prep;
Database db = database;
Random random = db.getRandom(); Random random = db.getRandom();
db.openConnection(); db.openConnection();
......
...@@ -34,7 +34,7 @@ class Database { ...@@ -34,7 +34,7 @@ class Database {
private int id; private int id;
private String name, url, user, password; private String name, url, user, password;
private ArrayList<String[]> replace = new ArrayList<String[]>(); private ArrayList<String[]> replace = new ArrayList<String[]>();
private String action; private String currentAction;
private long startTime; private long startTime;
private Connection conn; private Connection conn;
private Statement stat; private Statement stat;
...@@ -182,12 +182,12 @@ class Database { ...@@ -182,12 +182,12 @@ class Database {
* @return the opened connection * @return the opened connection
*/ */
Connection openNewConnection() throws SQLException { Connection openNewConnection() throws SQLException {
Connection conn = DriverManager.getConnection(url, user, password); Connection newConn = DriverManager.getConnection(url, user, password);
if (url.startsWith("jdbc:derby:")) { if (url.startsWith("jdbc:derby:")) {
// Derby: use higher cache size // Derby: use higher cache size
Statement stat = null; Statement s = null;
try { try {
stat = conn.createStatement(); s = newConn.createStatement();
// stat.execute("CALL // stat.execute("CALL
// SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageCacheSize', // SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageCacheSize',
// '64')"); // '64')");
...@@ -195,19 +195,19 @@ class Database { ...@@ -195,19 +195,19 @@ class Database {
// SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', // SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize',
// '8192')"); // '8192')");
} finally { } finally {
JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(s);
} }
} else if (url.startsWith("jdbc:hsqldb:")) { } else if (url.startsWith("jdbc:hsqldb:")) {
// HSQLDB: use a WRITE_DELAY of 1 second // HSQLDB: use a WRITE_DELAY of 1 second
Statement stat = null; Statement s = null;
try { try {
stat = conn.createStatement(); s = newConn.createStatement();
stat.execute("SET WRITE_DELAY 1"); s.execute("SET WRITE_DELAY 1");
} finally { } finally {
JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(s);
} }
} }
return conn; return newConn;
} }
/** /**
...@@ -222,9 +222,9 @@ class Database { ...@@ -222,9 +222,9 @@ class Database {
* Close the database connection. * Close the database connection.
*/ */
void closeConnection() throws SQLException { void closeConnection() throws SQLException {
// if(!serverHSQLDB && url.startsWith("jdbc:hsqldb:")) { // if(!serverHSQLDB && url.startsWith("jdbc:hsqldb:")) {
// stat.execute("SHUTDOWN"); // stat.execute("SHUTDOWN");
// } // }
conn.close(); conn.close();
stat = null; stat = null;
conn = null; conn = null;
...@@ -236,12 +236,12 @@ class Database { ...@@ -236,12 +236,12 @@ class Database {
* @param prop the properties with the translations to use * @param prop the properties with the translations to use
*/ */
void setTranslations(Properties prop) { void setTranslations(Properties prop) {
String id = url.substring("jdbc:".length()); String databaseType = url.substring("jdbc:".length());
id = id.substring(0, id.indexOf(':')); databaseType = databaseType.substring(0, databaseType.indexOf(':'));
for (Object k : prop.keySet()) { for (Object k : prop.keySet()) {
String key = (String) k; String key = (String) k;
if (key.startsWith(id + ".")) { if (key.startsWith(databaseType + ".")) {
String pattern = key.substring(id.length() + 1); String pattern = key.substring(databaseType.length() + 1);
pattern = StringUtils.replaceAll(pattern, "_", " "); pattern = StringUtils.replaceAll(pattern, "_", " ");
pattern = StringUtils.toUpperEnglish(pattern); pattern = StringUtils.toUpperEnglish(pattern);
String replacement = prop.getProperty(key); String replacement = prop.getProperty(key);
...@@ -264,8 +264,8 @@ class Database { ...@@ -264,8 +264,8 @@ class Database {
private String getSQL(String sql) { private String getSQL(String sql) {
for (String[] pair : replace) { for (String[] pair : replace) {
String pattern = pair[0]; String pattern = pair[0];
String replace = pair[1]; String replacement = pair[1];
sql = StringUtils.replaceAll(sql, pattern, replace); sql = StringUtils.replaceAll(sql, pattern, replacement);
} }
return sql; return sql;
} }
...@@ -277,7 +277,7 @@ class Database { ...@@ -277,7 +277,7 @@ class Database {
* @param action the action * @param action the action
*/ */
void start(Bench bench, String action) { void start(Bench bench, String action) {
this.action = bench.getName() + ": " + action; this.currentAction = bench.getName() + ": " + action;
this.startTime = System.currentTimeMillis(); this.startTime = System.currentTimeMillis();
} }
...@@ -287,7 +287,7 @@ class Database { ...@@ -287,7 +287,7 @@ class Database {
*/ */
void end() { void end() {
long time = System.currentTimeMillis() - startTime; long time = System.currentTimeMillis() - startTime;
log(action, "ms", (int) time); log(currentAction, "ms", (int) time);
if (test.collect) { if (test.collect) {
totalTime += time; totalTime += time;
} }
...@@ -310,10 +310,10 @@ class Database { ...@@ -310,10 +310,10 @@ class Database {
* Execute an SQL statement. * Execute an SQL statement.
* *
* @param prep the prepared statement * @param prep the prepared statement
* @param trace the trace message * @param traceMessage the trace message
*/ */
void update(PreparedStatement prep, String trace) throws SQLException { void update(PreparedStatement prep, String traceMessage) throws SQLException {
test.trace(trace); test.trace(traceMessage);
prep.executeUpdate(); prep.executeUpdate();
if (test.collect) { if (test.collect) {
executedStatements++; executedStatements++;
...@@ -410,12 +410,12 @@ class Database { ...@@ -410,12 +410,12 @@ class Database {
* @return the result set * @return the result set
*/ */
ResultSet query(PreparedStatement prep) throws SQLException { ResultSet query(PreparedStatement prep) throws SQLException {
// long time = System.currentTimeMillis(); // long time = System.currentTimeMillis();
ResultSet rs = prep.executeQuery(); ResultSet rs = prep.executeQuery();
// time = System.currentTimeMillis() - time; // time = System.currentTimeMillis() - time;
// if(time > 100) { // if(time > 100) {
// System.out.println("time="+time); // System.out.println("time="+time);
// } // }
if (test.collect) { if (test.collect) {
executedStatements++; executedStatements++;
} }
......
...@@ -92,8 +92,8 @@ public class Coverage { ...@@ -92,8 +92,8 @@ public class Coverage {
} }
} }
private void addExclude(String file) { private void addExclude(String fileName) {
exclude.add(file); exclude.add(fileName);
} }
private boolean isExcluded(String s) { private boolean isExcluded(String s) {
......
...@@ -108,12 +108,12 @@ public class TestIndex extends TestBase { ...@@ -108,12 +108,12 @@ public class TestIndex extends TestBase {
private void testRandomized() throws SQLException { private void testRandomized() throws SQLException {
boolean reopen = !config.memory; boolean reopen = !config.memory;
Random random = new Random(1); Random rand = new Random(1);
reconnect(); reconnect();
stat.execute("CREATE TABLE TEST(ID identity)"); stat.execute("CREATE TABLE TEST(ID identity)");
int len = getSize(100, 1000); int len = getSize(100, 1000);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
switch (random.nextInt(4)) { switch (rand.nextInt(4)) {
case 0: case 0:
if (reopen) { if (reopen) {
trace("reconnect"); trace("reconnect");
...@@ -144,16 +144,16 @@ public class TestIndex extends TestBase { ...@@ -144,16 +144,16 @@ public class TestIndex extends TestBase {
int len = getSize(1000, 10000); int len = getSize(1000, 10000);
stat.execute("insert into testA select x, 'Hello' from system_range(1, " + len + ")"); stat.execute("insert into testA select x, 'Hello' from system_range(1, " + len + ")");
stat.execute("insert into testB select x, 'Hello' from system_range(1, " + len + ")"); stat.execute("insert into testB select x, 'Hello' from system_range(1, " + len + ")");
Random random = new Random(1); Random rand = new Random(1);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
int x = random.nextInt(len); int x = rand.nextInt(len);
String sql = ""; String sql = "";
switch(random.nextInt(3)) { switch(rand.nextInt(3)) {
case 0: case 0:
sql = "delete from testA where id = " + x; sql = "delete from testA where id = " + x;
break; break;
case 1: case 1:
sql = "update testA set name = " + random.nextInt(100) + " where id = " + x; sql = "update testA set name = " + rand.nextInt(100) + " where id = " + x;
break; break;
case 2: case 2:
sql = "select name from testA where id = " + x; sql = "select name from testA where id = " + x;
...@@ -314,21 +314,21 @@ public class TestIndex extends TestBase { ...@@ -314,21 +314,21 @@ public class TestIndex extends TestBase {
prep.setInt(1, a); prep.setInt(1, a);
prep.setInt(2, a); prep.setInt(2, a);
prep.execute(); prep.execute();
assertEquals(1, getValue(stat, "SELECT COUNT(*) FROM TEST WHERE A=" + a)); assertEquals(1, getValue("SELECT COUNT(*) FROM TEST WHERE A=" + a));
assertEquals(0, getValue(stat, "SELECT COUNT(*) FROM TEST WHERE A=-1-" + a)); assertEquals(0, getValue("SELECT COUNT(*) FROM TEST WHERE A=-1-" + a));
} }
reconnect(); reconnect();
prep = conn.prepareStatement("DELETE FROM TEST WHERE A=?"); prep = conn.prepareStatement("DELETE FROM TEST WHERE A=?");
for (int a = 0; a < len; a++) { for (int a = 0; a < len; a++) {
if (getValue(stat, "SELECT COUNT(*) FROM TEST WHERE A=" + a) != 1) { if (getValue("SELECT COUNT(*) FROM TEST WHERE A=" + a) != 1) {
assertEquals(1, getValue(stat, "SELECT COUNT(*) FROM TEST WHERE A=" + a)); assertEquals(1, getValue("SELECT COUNT(*) FROM TEST WHERE A=" + a));
} }
prep.setInt(1, a); prep.setInt(1, a);
assertEquals(1, prep.executeUpdate()); assertEquals(1, prep.executeUpdate());
} }
assertEquals(0, getValue(stat, "SELECT COUNT(*) FROM TEST")); assertEquals(0, getValue("SELECT COUNT(*) FROM TEST"));
} }
private void testMultiColumnIndex() throws SQLException { private void testMultiColumnIndex() throws SQLException {
...@@ -346,13 +346,13 @@ public class TestIndex extends TestBase { ...@@ -346,13 +346,13 @@ public class TestIndex extends TestBase {
stat.execute("CREATE INDEX ON TEST(A, B)"); stat.execute("CREATE INDEX ON TEST(A, B)");
prep = conn.prepareStatement("DELETE FROM TEST WHERE A=?"); prep = conn.prepareStatement("DELETE FROM TEST WHERE A=?");
for (int a = 0; a < len; a++) { for (int a = 0; a < len; a++) {
log(stat, "SELECT * FROM TEST"); log("SELECT * FROM TEST");
assertEquals(2, getValue(stat, "SELECT COUNT(*) FROM TEST WHERE A=" + (len - a - 1))); assertEquals(2, getValue("SELECT COUNT(*) FROM TEST WHERE A=" + (len - a - 1)));
assertEquals((len - a) * 2, getValue(stat, "SELECT COUNT(*) FROM TEST")); assertEquals((len - a) * 2, getValue("SELECT COUNT(*) FROM TEST"));
prep.setInt(1, len - a - 1); prep.setInt(1, len - a - 1);
prep.execute(); prep.execute();
} }
assertEquals(0, getValue(stat, "SELECT COUNT(*) FROM TEST")); assertEquals(0, getValue("SELECT COUNT(*) FROM TEST"));
} }
private void testMultiColumnHashIndex() throws SQLException { private void testMultiColumnHashIndex() throws SQLException {
...@@ -392,17 +392,17 @@ public class TestIndex extends TestBase { ...@@ -392,17 +392,17 @@ public class TestIndex extends TestBase {
ResultSet rs = stat.executeQuery("SELECT * FROM TEST WHERE DATA <> 'i('||a||','||b||')u('||a||','||b||')'"); ResultSet rs = stat.executeQuery("SELECT * FROM TEST WHERE DATA <> 'i('||a||','||b||')u('||a||','||b||')'");
assertFalse(rs.next()); assertFalse(rs.next());
assertEquals(len * (len / 2), getValue(stat, "SELECT COUNT(*) FROM TEST")); assertEquals(len * (len / 2), getValue("SELECT COUNT(*) FROM TEST"));
stat.execute("DROP TABLE TEST"); stat.execute("DROP TABLE TEST");
} }
private int getValue(Statement stat, String sql) throws SQLException { private int getValue(String sql) throws SQLException {
ResultSet rs = stat.executeQuery(sql); ResultSet rs = stat.executeQuery(sql);
rs.next(); rs.next();
return rs.getInt(1); return rs.getInt(1);
} }
private void log(Statement stat, String sql) throws SQLException { private void log(String sql) throws SQLException {
trace(sql); trace(sql);
ResultSet rs = stat.executeQuery(sql); ResultSet rs = stat.executeQuery(sql);
int cols = rs.getMetaData().getColumnCount(); int cols = rs.getMetaData().getColumnCount();
......
...@@ -23,7 +23,7 @@ public class TestListener extends TestBase implements DatabaseEventListener { ...@@ -23,7 +23,7 @@ public class TestListener extends TestBase implements DatabaseEventListener {
private long last; private long last;
private int lastState = -1; private int lastState = -1;
private String url; private String databaseUrl;
public TestListener() { public TestListener() {
start = last = System.currentTimeMillis(); start = last = System.currentTimeMillis();
...@@ -102,12 +102,12 @@ public class TestListener extends TestBase implements DatabaseEventListener { ...@@ -102,12 +102,12 @@ public class TestListener extends TestBase implements DatabaseEventListener {
} }
public void closingDatabase() { public void closingDatabase() {
if (url.toUpperCase().indexOf("CIPHER") >= 0) { if (databaseUrl.toUpperCase().indexOf("CIPHER") >= 0) {
return; return;
} }
Connection conn = null; Connection conn = null;
try { try {
conn = DriverManager.getConnection(url, getUser(), getPassword()); conn = DriverManager.getConnection(databaseUrl, getUser(), getPassword());
conn.createStatement().execute("DROP TABLE TEST2"); conn.createStatement().execute("DROP TABLE TEST2");
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
...@@ -118,16 +118,16 @@ public class TestListener extends TestBase implements DatabaseEventListener { ...@@ -118,16 +118,16 @@ public class TestListener extends TestBase implements DatabaseEventListener {
} }
public void init(String url) { public void init(String url) {
this.url = url; this.databaseUrl = url;
} }
public void opened() { public void opened() {
if (url.toUpperCase().indexOf("CIPHER") >= 0) { if (databaseUrl.toUpperCase().indexOf("CIPHER") >= 0) {
return; return;
} }
Connection conn = null; Connection conn = null;
try { try {
conn = DriverManager.getConnection(url, getUser(), getPassword()); conn = DriverManager.getConnection(databaseUrl, getUser(), getPassword());
conn.createStatement().execute("CREATE TABLE IF NOT EXISTS TEST2(ID INT)"); conn.createStatement().execute("CREATE TABLE IF NOT EXISTS TEST2(ID INT)");
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
......
...@@ -590,10 +590,10 @@ public class TestLob extends TestBase { ...@@ -590,10 +590,10 @@ public class TestLob extends TestBase {
len = 100; len = 100;
} }
int start = 1, increment = 19; int first = 1, increment = 19;
PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST(ID, B, C) VALUES(?, ?, ?)"); PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST(ID, B, C) VALUES(?, ?, ?)");
for (int i = start; i < len; i += increment) { for (int i = first; i < len; i += increment) {
int l = i; int l = i;
prep.setInt(1, i); prep.setInt(1, i);
prep.setBinaryStream(2, getRandomStream(l, i), -1); prep.setBinaryStream(2, getRandomStream(l, i), -1);
...@@ -615,7 +615,7 @@ public class TestLob extends TestBase { ...@@ -615,7 +615,7 @@ public class TestLob extends TestBase {
} }
prep = conn.prepareStatement("UPDATE TEST SET B=?, C=? WHERE ID=?"); prep = conn.prepareStatement("UPDATE TEST SET B=?, C=? WHERE ID=?");
for (int i = start; i < len; i += increment) { for (int i = first; i < len; i += increment) {
int l = i; int l = i;
prep.setBinaryStream(1, getRandomStream(l, -i), -1); prep.setBinaryStream(1, getRandomStream(l, -i), -1);
prep.setCharacterStream(2, getRandomReader(l, -i), -1); prep.setCharacterStream(2, getRandomReader(l, -i), -1);
......
...@@ -81,20 +81,20 @@ public class TestMemoryUsage extends TestBase { ...@@ -81,20 +81,20 @@ public class TestMemoryUsage extends TestBase {
return; return;
} }
deleteDb("memoryUsage"); deleteDb("memoryUsage");
Connection conn = getConnection("memoryUsage"); conn = getConnection("memoryUsage");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("SET MAX_LENGTH_INPLACE_LOB 32768"); stat.execute("SET MAX_LENGTH_INPLACE_LOB 32768");
stat.execute("SET CACHE_SIZE 8000"); stat.execute("SET CACHE_SIZE 8000");
stat.execute("CREATE TABLE TEST(ID IDENTITY, DATA CLOB)"); stat.execute("CREATE TABLE TEST(ID IDENTITY, DATA CLOB)");
freeSoftReferences(); freeSoftReferences();
try { try {
int start = MemoryUtils.getMemoryUsed(); int base = MemoryUtils.getMemoryUsed();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
stat.execute("INSERT INTO TEST(DATA) SELECT SPACE(32000) FROM SYSTEM_RANGE(1, 200)"); stat.execute("INSERT INTO TEST(DATA) SELECT SPACE(32000) FROM SYSTEM_RANGE(1, 200)");
freeSoftReferences(); freeSoftReferences();
int used = MemoryUtils.getMemoryUsed(); int used = MemoryUtils.getMemoryUsed();
if ((used - start) > 16000) { if ((used - base) > 16000) {
fail("Used: " + (used - start)); fail("Used: " + (used - base));
} }
} }
} finally { } finally {
...@@ -122,7 +122,7 @@ public class TestMemoryUsage extends TestBase { ...@@ -122,7 +122,7 @@ public class TestMemoryUsage extends TestBase {
return; return;
} }
deleteDb("memoryUsage"); deleteDb("memoryUsage");
Connection conn = getConnection("memoryUsage"); conn = getConnection("memoryUsage");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table test(id int, name varchar(255))"); stat.execute("create table test(id int, name varchar(255))");
PreparedStatement prep = conn.prepareStatement("insert into test values(?, space(200))"); PreparedStatement prep = conn.prepareStatement("insert into test values(?, space(200))");
...@@ -134,13 +134,13 @@ public class TestMemoryUsage extends TestBase { ...@@ -134,13 +134,13 @@ public class TestMemoryUsage extends TestBase {
prep.setInt(1, i); prep.setInt(1, i);
prep.executeUpdate(); prep.executeUpdate();
} }
int start = MemoryUtils.getMemoryUsed(); int base = MemoryUtils.getMemoryUsed();
stat.execute("create index idx_test_id on test(id)"); stat.execute("create index idx_test_id on test(id)");
System.gc(); System.gc();
System.gc(); System.gc();
int used = MemoryUtils.getMemoryUsed(); int used = MemoryUtils.getMemoryUsed();
if ((used - start) > getSize(7500, 12000)) { if ((used - base) > getSize(7500, 12000)) {
fail("Used: " + (used - start)); fail("Used: " + (used - base));
} }
stat.execute("drop table test"); stat.execute("drop table test");
conn.close(); conn.close();
......
...@@ -49,9 +49,8 @@ public class TestMultiThread extends TestBase implements Runnable { ...@@ -49,9 +49,8 @@ public class TestMultiThread extends TestBase implements Runnable {
} }
public void test() throws Exception { public void test() throws Exception {
conn = getConnection();
Connection conn = getConnection(); stat = conn.createStatement();
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(ID IDENTITY, NAME VARCHAR)"); stat.execute("CREATE TABLE TEST(ID IDENTITY, NAME VARCHAR)");
int len = getSize(10, 200); int len = getSize(10, 200);
Thread[] threads = new Thread[len]; Thread[] threads = new Thread[len];
......
...@@ -50,7 +50,7 @@ public class TestMultiThreadedKernel extends TestBase { ...@@ -50,7 +50,7 @@ public class TestMultiThreadedKernel extends TestBase {
public void run() { public void run() {
Connection conn = null; Connection conn = null;
try { try {
for (int i = 0; i < 100 && !stop; i++) { for (int j = 0; j < 100 && !stop; j++) {
conn = DriverManager.getConnection(url, user, password); conn = DriverManager.getConnection(url, user, password);
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create local temporary table temp(id identity)"); stat.execute("create local temporary table temp(id identity)");
......
...@@ -145,13 +145,13 @@ public class TestOpenClose extends TestBase implements DatabaseEventListener { ...@@ -145,13 +145,13 @@ public class TestOpenClose extends TestBase implements DatabaseEventListener {
threads[i] = new Thread() { threads[i] = new Thread() {
public void run() { public void run() {
try { try {
Connection conn = DriverManager.getConnection(url, user, password); Connection c = DriverManager.getConnection(url, user, password);
PreparedStatement prep = conn.prepareStatement("insert into employee values(?, ?, 0)"); PreparedStatement prep = c.prepareStatement("insert into employee values(?, ?, 0)");
int id = getNextId(); int id = getNextId();
prep.setInt(1, id); prep.setInt(1, id);
prep.setString(2, "employee " + id); prep.setString(2, "employee " + id);
prep.execute(); prep.execute();
conn.close(); c.close();
} catch (Throwable e) { } catch (Throwable e) {
TestBase.logError("insert", e); TestBase.logError("insert", e);
} }
......
...@@ -270,16 +270,16 @@ public class TestTriggersConstraints extends TestBase implements Trigger { ...@@ -270,16 +270,16 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
} }
} }
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) { public void init(Connection conn, String schemaName, String trigger, String tableName, boolean before, int type) {
this.triggerName = triggerName; this.triggerName = trigger;
if (!"TEST".equals(tableName)) { if (!"TEST".equals(tableName)) {
throw new AssertionError("supposed to be TEST"); throw new AssertionError("supposed to be TEST");
} }
if ((triggerName.endsWith("AFTER") && before) || (triggerName.endsWith("BEFORE") && !before)) { if ((trigger.endsWith("AFTER") && before) || (trigger.endsWith("BEFORE") && !before)) {
throw new AssertionError("triggerName: " + triggerName + " before:" + before); throw new AssertionError("triggerName: " + trigger + " before:" + before);
} }
if ((triggerName.startsWith("UPD") && type != UPDATE) || (triggerName.startsWith("INS") && type != INSERT) || (triggerName.startsWith("DEL") && type != DELETE)) { if ((trigger.startsWith("UPD") && type != UPDATE) || (trigger.startsWith("INS") && type != INSERT) || (trigger.startsWith("DEL") && type != DELETE)) {
throw new AssertionError("triggerName: " + triggerName + " type:" + type); throw new AssertionError("triggerName: " + trigger + " type:" + type);
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论