return connection;
}
-// public Connection getReplayConnection(String path) {
-// try {
-// if (null != replayConnection) {
-// return replayConnection;
-// }
-// Class.forName("org.h2.Driver");
-// String dbUrl = "jdbc:h2:file:" + path + File.separator
-// + AnalyzerConstants.DATABASE_NAME; //$NON-NLS-1$ //$NON-NLS-2$
-// replayConnection = DriverManager.getConnection(dbUrl, "SA", "");
-// SQLWarning warning = replayConnection.getWarnings();
-// while (warning != null) {
-// System.out.println("Message: " + warning.getMessage());
-// System.out.println("SQL state: " + warning.getSQLState());
-// System.out.println("Vendor code: " + warning.getErrorCode());
-// warning = warning.getNextWarning();
-// }
-// } catch (ClassNotFoundException e) {
-// e.printStackTrace();
-// } catch (SQLException e) {
-// e.printStackTrace();
-// }
-// return replayConnection;
-// }
-//
-// public Connection getConnection(String path) {
-// try {
-// if (null != connection) {
-// return connection;
-// }
-// Class.forName("org.h2.Driver");
-// String dbUrl = "jdbc:h2:file:" + path + File.separator
-// + AnalyzerConstants.DATABASE_NAME; //$NON-NLS-1$ //$NON-NLS-2$
-// connection = DriverManager.getConnection(dbUrl, "SA", "");
-// SQLWarning warning = connection.getWarnings();
-// while (warning != null) {
-// System.out.println("Message: " + warning.getMessage());
-// System.out.println("SQL state: " + warning.getSQLState());
-// System.out.println("Vendor code: " + warning.getErrorCode());
-// warning = warning.getNextWarning();
-// }
-// } catch (ClassNotFoundException e) {
-// e.printStackTrace();
-// } catch (SQLException e) {
-// e.printStackTrace();
-// }
-// return connection;
-// }
+ // public Connection getReplayConnection(String path) {
+ // try {
+ // if (null != replayConnection) {
+ // return replayConnection;
+ // }
+ // Class.forName("org.h2.Driver");
+ // String dbUrl = "jdbc:h2:file:" + path + File.separator
+ // + AnalyzerConstants.DATABASE_NAME; //$NON-NLS-1$ //$NON-NLS-2$
+ // replayConnection = DriverManager.getConnection(dbUrl, "SA", "");
+ // SQLWarning warning = replayConnection.getWarnings();
+ // while (warning != null) {
+ // System.out.println("Message: " + warning.getMessage());
+ // System.out.println("SQL state: " + warning.getSQLState());
+ // System.out.println("Vendor code: " + warning.getErrorCode());
+ // warning = warning.getNextWarning();
+ // }
+ // } catch (ClassNotFoundException e) {
+ // e.printStackTrace();
+ // } catch (SQLException e) {
+ // e.printStackTrace();
+ // }
+ // return replayConnection;
+ // }
+ //
+ // public Connection getConnection(String path) {
+ // try {
+ // if (null != connection) {
+ // return connection;
+ // }
+ // Class.forName("org.h2.Driver");
+ // String dbUrl = "jdbc:h2:file:" + path + File.separator
+ // + AnalyzerConstants.DATABASE_NAME; //$NON-NLS-1$ //$NON-NLS-2$
+ // connection = DriverManager.getConnection(dbUrl, "SA", "");
+ // SQLWarning warning = connection.getWarnings();
+ // while (warning != null) {
+ // System.out.println("Message: " + warning.getMessage());
+ // System.out.println("SQL state: " + warning.getSQLState());
+ // System.out.println("Vendor code: " + warning.getErrorCode());
+ // warning = warning.getNextWarning();
+ // }
+ // } catch (ClassNotFoundException e) {
+ // e.printStackTrace();
+ // } catch (SQLException e) {
+ // e.printStackTrace();
+ // }
+ // return connection;
+ // }
public void semaphoreAcquire() {
- if (connection != null) {
- try {
- semaphore.acquire();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
+// if (connection != null) {
+// try {
+// semaphore.acquire();
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
+// }
}
public void semaphoreRelease() {
- if (connection == null) {
- return;
- } else {
- semaphore.release();
- }
+// if (connection == null) {
+// return;
+// } else {
+// semaphore.release();
+// }
}
public void closeReplayConnection() {
return query.toString();
}
+ private void executeCreateIndexTable(Statement stat, String tableName,
+ String indeColumn) {
+ String createIndexTable = "create index " + tableName + "_index on "//$NON-NLS-1$//$NON-NLS-2$
+ + tableName + CommonConstants.OPEN_BRACKET + indeColumn
+ + CommonConstants.CLOSE_BRACKET;
+ try {
+ executeUpdateCreateTable(stat, createIndexTable);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
public String createDropTableQuery(String target) {
StringBuffer query = new StringBuffer();
query.append("drop table if exists "); //$NON-NLS-1$ TODO
System.out.println("table create failed..."
+ info.getTableName());
}
+ executeCreateIndexTable(stat, info.getTableName(),
+ "seqnumber, time");//$NON-NLS-1$//$NON-NLS-2$
}
} catch (SQLException e) {
e.printStackTrace();