本文整理汇总了Java中java.sql.CallableStatement.setTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Java CallableStatement.setTimestamp方法的具体用法?Java CallableStatement.setTimestamp怎么用?Java CallableStatement.setTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.CallableStatement
的用法示例。
在下文中一共展示了CallableStatement.setTimestamp方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endRun
import java.sql.CallableStatement; //导入方法依赖的package包/类
/**
* End a run in the database
*
* @param timestamp
* @param runId
*/
public void endRun(
long timestamp,
int runId,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to end run with id " + runId;
final int indexRowsInserted = 3;
timestamp = inUTC(timestamp);
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_end_run(?, ?, ?) }");
callableStatement.setInt(1, runId);
callableStatement.setTimestamp(2, new Timestamp(timestamp));
callableStatement.registerOutParameter(indexRowsInserted, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsInserted) != 1) {
throw new DatabaseAccessException(errMsg);
}
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例2: endSuite
import java.sql.CallableStatement; //导入方法依赖的package包/类
public void endSuite(
long timestamp,
int suiteId,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to end suite with id " + suiteId;
timestamp = inUTC(timestamp);
final int indexRowsInserted = 3;
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_end_suite(?, ?, ?) }");
callableStatement.setInt(1, suiteId);
callableStatement.setTimestamp(2, new Timestamp(timestamp));
callableStatement.registerOutParameter(indexRowsInserted, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsInserted) != 1) {
throw new DatabaseAccessException(errMsg);
}
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例3: endTestCase
import java.sql.CallableStatement; //导入方法依赖的package包/类
public void endTestCase(
int testcaseResult,
long timestamp,
int testcaseId,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to end testcase with id " + testcaseId;
timestamp = inUTC(timestamp);
final int indexRowsInserted = 4;
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_end_testcase(?, ?, ?, ?) }");
callableStatement.setInt(1, testcaseId);
callableStatement.setInt(2, testcaseResult);
callableStatement.setTimestamp(3, new Timestamp(timestamp));
callableStatement.registerOutParameter(indexRowsInserted, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsInserted) != 1) {
throw new DatabaseAccessException(errMsg);
}
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例4: endLoadQueue
import java.sql.CallableStatement; //导入方法依赖的package包/类
public void endLoadQueue(
int result,
long timestamp,
int loadQueueId,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to end load queue with id " + loadQueueId;
timestamp = inUTC(timestamp);
final int indexRowsInserted = 4;
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_end_loadqueue(?, ?, ?, ?) }");
callableStatement.setInt(1, loadQueueId);
callableStatement.setInt(2, result);
callableStatement.setTimestamp(3, new Timestamp(timestamp));
callableStatement.registerOutParameter(indexRowsInserted, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsInserted) != 1) {
throw new DatabaseAccessException(errMsg);
}
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例5: insertSystemStatistics
import java.sql.CallableStatement; //导入方法依赖的package包/类
public void insertSystemStatistics(
int testCaseId,
String machine,
String statisticIds,
String statisticValues,
long timestamp,
boolean closeConnection ) throws DatabaseAccessException {
timestamp = inUTC(timestamp);
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_insert_system_statistic_by_ids(?, ?, ?, ?, ?) }");
callableStatement.setString(3, statisticIds);
callableStatement.setInt(1, testCaseId);
callableStatement.setString(2, machine);
callableStatement.setString(4, statisticValues);
callableStatement.setTimestamp(5, new Timestamp(timestamp));
callableStatement.execute();
} catch (Exception e) {
String errMsg = "Unable to insert system statistics, statistic IDs '" + statisticIds
+ "', statistic values '" + statisticValues + "', timestamp " + timestamp;
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例6: insertUserActivityStatistics
import java.sql.CallableStatement; //导入方法依赖的package包/类
public void insertUserActivityStatistics(
int testCaseId,
String machine,
String statisticIds,
String statisticValues,
long timestamp,
boolean closeConnection ) throws DatabaseAccessException {
timestamp = inUTC(timestamp);
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_insert_user_activity_statistic_by_ids(?, ?, ?, ?, ?) }");
callableStatement.setString(3, statisticIds);
callableStatement.setInt(1, testCaseId);
callableStatement.setString(2, machine);
callableStatement.setString(4, statisticValues);
callableStatement.setTimestamp(5, new Timestamp(timestamp));
callableStatement.execute();
} catch (Exception e) {
String errMsg = "Unable to insert user activity statistics, statistic IDs '" + statisticIds
+ "', statistic values '" + statisticValues + "', timestamp " + timestamp;
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例7: insertUserActivityStatistics
import java.sql.CallableStatement; //导入方法依赖的package包/类
@Override
public void insertUserActivityStatistics( int testCaseId, String machine, String statisticIds,
String statisticValues, long timestamp,
boolean closeConnection ) throws DatabaseAccessException {
timestamp = inUTC(timestamp);
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_insert_user_activity_statistic_by_ids(?, ?, ?, ?, ?) }");
callableStatement.setInt(1, testCaseId);
callableStatement.setString(2, machine);
callableStatement.setString(3, statisticIds);
callableStatement.setString(4, statisticValues);
callableStatement.setTimestamp(5, new Timestamp(timestamp));
callableStatement.execute();
} catch (Exception e) {
String errMsg = "Unable to insert user activity statistics, statistic IDs '" + statisticIds
+ "', statistic values '" + statisticValues + "', timestamp " + timestamp;
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例8: startRun
import java.sql.CallableStatement; //导入方法依赖的package包/类
/**
* Insert a new run in the database
*
* @param runName
* name of the run
* @param osName
* name of the OS
* @param productName
* name of the product
* @param versionName
* version of the product
* @param buildName
* build version
* @param timestamp
* @param hostName
* name/IP of the machine , from which the run was started
* @return
*/
public int startRun(
String runName,
String osName,
String productName,
String versionName,
String buildName,
long timestamp,
String hostName,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to insert run with name " + runName;
timestamp = inUTC(timestamp);
// then start the run
final int indexRowsInserted = 8;
final int indexRunId = 9;
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_start_run(?, ?, ?, ?, ?, ?, ?, ? ,?) }");
callableStatement.setString(1, productName);
callableStatement.setString(2, versionName);
callableStatement.setString(3, buildName);
callableStatement.setString(4, runName);
callableStatement.setString(5, osName);
callableStatement.setTimestamp(6, new Timestamp(timestamp));
callableStatement.setString(7, hostName);
callableStatement.registerOutParameter(indexRowsInserted, Types.INTEGER);
callableStatement.registerOutParameter(indexRunId, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsInserted) == 1) {
// check if the run ID is correct
if (callableStatement.getInt(indexRunId) == 0) {
throw new DatabaseAccessException(errMsg + " - run ID returned was 0");
}
} else {
throw new DatabaseAccessException(errMsg);
}
// get the result
return callableStatement.getInt(indexRunId);
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例9: startSuite
import java.sql.CallableStatement; //导入方法依赖的package包/类
public int startSuite(
String packageName,
String suiteName,
long timestamp,
int runId,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to start suite with name " + suiteName;
// create a new suite
timestamp = inUTC(timestamp);
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
// TODO : remove me after 3.6.0
String dbVersionString = getDatabaseVersion();
int dbVersion = Integer.parseInt(dbVersionString.replace(".", ""));
if (dbVersion >= 350) {
callableStatement = connection.prepareCall("{ call sp_start_suite(?, ?, ?, ?, ?, ?) }");
if (packageName == null) {
packageName = "";
}
callableStatement.setString("@package", packageName);
} else {
callableStatement = connection.prepareCall("{ call sp_start_suite(?, ?, ?, ?, ?) }");
}
callableStatement.setString("@suiteName", suiteName);
callableStatement.setInt("@runId", runId);
callableStatement.setTimestamp("@dateStart", new Timestamp(timestamp));
callableStatement.registerOutParameter("@RowsInserted", Types.INTEGER);
callableStatement.registerOutParameter("@suiteId", Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt("@RowsInserted") != 1) {
throw new DatabaseAccessException(errMsg);
} else {
if (callableStatement.getInt("@suiteId") == 0) {
throw new DatabaseAccessException(errMsg + " - suite ID returned was 0");
}
}
// get the result
return callableStatement.getInt("@suiteId");
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例10: startTestCase
import java.sql.CallableStatement; //导入方法依赖的package包/类
public int startTestCase(
String suiteName,
String scenarioName,
String scenarioDescription,
String testcaseName,
long timestamp,
int suiteId,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to start testcase with name " + testcaseName;
timestamp = inUTC(timestamp);
// start a new test case
final int indexRowsInserted = 7;
final int indexTestcaseId = 8;
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_start_testcase(?, ?, ?, ?, ?, ?, ?, ?) }");
callableStatement.setInt(1, suiteId);
callableStatement.setString(2, suiteName);
callableStatement.setString(3, scenarioName);
callableStatement.setString(4, scenarioDescription);
callableStatement.setString(5, testcaseName);
callableStatement.setTimestamp(6, new Timestamp(timestamp));
callableStatement.registerOutParameter(indexRowsInserted, Types.INTEGER);
callableStatement.registerOutParameter(indexTestcaseId, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsInserted) != 1) {
throw new DatabaseAccessException(errMsg);
} else {
if (callableStatement.getInt(indexTestcaseId) == 0) {
throw new DatabaseAccessException(errMsg + " - testcase id returned was 0");
}
}
// get the result
return callableStatement.getInt(indexTestcaseId);
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例11: updateTestcase
import java.sql.CallableStatement; //导入方法依赖的package包/类
public void updateTestcase(
String suiteFullName,
String scenarioName,
String scenarioDescription,
String testcaseName,
String userNote,
int testcaseResult,
int testcaseId,
long timestamp,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to update testcase with name '" + testcaseName + "' and id " + testcaseId;
timestamp = inUTC(timestamp);
final int indexRowsUpdate = 9;
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_update_testcase(?, ?, ?, ?, ?, ?, ?, ?, ?) }");
callableStatement.setInt(1, testcaseId);
callableStatement.setString(2, suiteFullName);
callableStatement.setString(3, scenarioName);
callableStatement.setString(4, scenarioDescription);
callableStatement.setString(5, testcaseName);
callableStatement.setString(6, userNote);
callableStatement.setInt(7, testcaseResult);
callableStatement.setTimestamp(8, new Timestamp(timestamp));
callableStatement.registerOutParameter(indexRowsUpdate, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsUpdate) != 1) {
throw new DatabaseAccessException(errMsg);
}
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例12: startLoadQueue
import java.sql.CallableStatement; //导入方法依赖的package包/类
public int startLoadQueue(
String name,
int sequence,
String hostsList,
String threadingPattern,
int numberThreads,
String machine,
long timestamp,
int testcaseId,
boolean closeConnection ) throws DatabaseAccessException {
if (testcaseId < 1) {
log.getLog4jLogger().warn("Load queue '" + name
+ "' will not be registered because there is no database connection!");
return -1;
}
timestamp = inUTC(timestamp);
final String errMsg = "Unable to start load queue with name " + name;
// create a new load queue
final int indexRowsInserted = 9;
final int indexLoadQueueId = 10;
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_start_loadqueue(?, ?, ?, ?, ?, ?, ?, ?, ?, ?) }");
callableStatement.setInt(1, testcaseId);
callableStatement.setString(2, name);
callableStatement.setInt(3, sequence);
callableStatement.setString(4, hostsList);
callableStatement.setString(5, threadingPattern);
callableStatement.setInt(6, numberThreads);
callableStatement.setString(7, machine);
callableStatement.setTimestamp(8, new Timestamp(timestamp));
callableStatement.registerOutParameter(indexRowsInserted, Types.INTEGER);
callableStatement.registerOutParameter(indexLoadQueueId, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsInserted) != 1) {
throw new DatabaseAccessException(errMsg);
} else {
if (callableStatement.getInt(indexLoadQueueId) == 0) {
throw new DatabaseAccessException(errMsg + " - load queue id returned was 0");
}
}
// get the result
return callableStatement.getInt(indexLoadQueueId);
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例13: endCheckpoint
import java.sql.CallableStatement; //导入方法依赖的package包/类
public void endCheckpoint(
CheckpointInfo runningCheckpointInfo,
long endTimestamp,
long transferSize,
int result,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to end checkpoint with name '" + runningCheckpointInfo.getName()
+ "', checkpoint summary id " + runningCheckpointInfo.getCheckpointSummaryId()
+ ", id " + runningCheckpointInfo.getCheckpointId();
endTimestamp = inUTC(endTimestamp);
final int indexRowsInserted = 8;
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_end_checkpoint(?, ?, ?, ?, ?, ?, ?, ?) }");
callableStatement.setInt(1, runningCheckpointInfo.getCheckpointSummaryId());
callableStatement.setInt(2, runningCheckpointInfo.getCheckpointId());
callableStatement.setInt(3,
(int) (endTimestamp - runningCheckpointInfo.getStartTimestamp()));
callableStatement.setLong(4, transferSize);
callableStatement.setInt(5, result);
callableStatement.setInt(6, checkpointLogLevel.toInt());
callableStatement.setTimestamp(7, new Timestamp(endTimestamp));
callableStatement.registerOutParameter(indexRowsInserted, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsInserted) != 1) {
throw new DatabaseAccessException(errMsg);
}
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}
示例14: startSuite
import java.sql.CallableStatement; //导入方法依赖的package包/类
@Override
public int startSuite( String packageName, String suiteName, long timestamp, int runId,
boolean closeConnection ) throws DatabaseAccessException {
final String errMsg = "Unable to start suite with name " + suiteName;
// create a new suite
timestamp = inUTC(timestamp);
final int indexRowsInserted = 5;
final int indexSuiteId = 6;
CallableStatement callableStatement = null;
try {
refreshInternalConnection();
callableStatement = connection.prepareCall("{ call sp_start_suite(?, ?, ?, ?, ?, ?) }");
if (packageName == null) {
packageName = "";
}
callableStatement.setString(3, packageName);
callableStatement.setString(1, suiteName);
callableStatement.setInt(2, runId);
callableStatement.setTimestamp(4, new Timestamp(timestamp));
callableStatement.registerOutParameter(5, Types.INTEGER);
callableStatement.registerOutParameter(6, Types.INTEGER);
callableStatement.execute();
if (callableStatement.getInt(indexRowsInserted) != 1) {
throw new DatabaseAccessException(errMsg);
} else {
if (callableStatement.getInt(indexSuiteId) == 0) {
throw new DatabaseAccessException(errMsg + " - suite ID returned was 0");
}
}
// get the result
return callableStatement.getInt(indexSuiteId);
} catch (Exception e) {
throw new DatabaseAccessException(errMsg, e);
} finally {
if (closeConnection) {
DbUtils.close(connection, callableStatement);
} else {
DbUtils.closeStatement(callableStatement);
}
}
}