本文整理汇总了Java中org.hsqldb.Statement类的典型用法代码示例。如果您正苦于以下问题:Java Statement类的具体用法?Java Statement怎么用?Java Statement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Statement类属于org.hsqldb包,在下文中一共展示了Statement类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialiseLobSpace
import org.hsqldb.Statement; //导入依赖的package包/类
private void initialiseLobSpace() {
Statement statement = sysLobSession.compileStatement(existsBlocksSQL);
Result result = statement.execute(sysLobSession);
if (result.isError()) {
throw result.getException();
}
RowSetNavigator navigator = result.getNavigator();
int size = navigator.getSize();
if (size > 0) {
return;
}
statement = sysLobSession.compileStatement(initialiseBlocksSQL);
Object[] params = new Object[3];
params[0] = ValuePool.INTEGER_0;
params[1] = ValuePool.getInt(totalBlockLimitCount);
params[2] = ValuePool.getLong(0);
sysLobSession.executeCompiledStatement(statement, params, 0);
}
示例2: newPrepareResponse
import org.hsqldb.Statement; //导入依赖的package包/类
public static Result newPrepareResponse(Statement statement) {
Result r = newResult(ResultConstants.PREPARE_ACK);
r.statement = statement;
r.statementID = statement.getID();
int csType = statement.getType();
r.statementReturnType =
(csType == StatementTypes.SELECT_CURSOR || csType == StatementTypes
.CALL) ? StatementTypes.RETURN_RESULT
: StatementTypes.RETURN_COUNT;
r.metaData = statement.getResultMetaData();
r.parameterMetaData = statement.getParametersMetaData();
return r;
}
示例3: initialiseLobSpace
import org.hsqldb.Statement; //导入依赖的package包/类
public void initialiseLobSpace() {
Statement statement =
sysLobSession.compileStatement(initialiseBlocksSQL);
Object[] args = new Object[3];
args[0] = Integer.valueOf(0);
args[1] = Integer.valueOf(totalBlockLimitCount);
args[2] = Long.valueOf(0);
sysLobSession.executeCompiledStatement(statement, args);
}
示例4: readExecuteProperties
import org.hsqldb.Statement; //导入依赖的package包/类
public static void readExecuteProperties(Session session, Result result,
DataInputStream dataInput, RowInputBinary in) {
try {
int length = dataInput.readInt();
in.resetRow(0, length);
byte[] byteArray = in.getBuffer();
final int offset = 4;
dataInput.readFully(byteArray, offset, length - offset);
result.updateCount = in.readInt();
result.fetchSize = in.readInt();
result.statementID = in.readLong();
result.rsScrollability = in.readShort();
result.rsConcurrency = in.readShort();
result.rsHoldability = in.readShort();
Statement statement =
session.database.compiledStatementManager.getStatement(session,
result.statementID);
result.statement = statement;
result.metaData = result.statement.getParametersMetaData();
result.navigator.readSimple(in, result.metaData);
} catch (IOException e) {
throw Error.error(ErrorCode.X_08000);
}
}
示例5: logStatementEvent
import org.hsqldb.Statement; //导入依赖的package包/类
public void logStatementEvent(Session session, Statement statement,
Object[] paramValues, int level) {
getEventLogger();
if (sqlLogger != null) {
sqlLogger.finest(statement.getSQL());
}
if (sqlLog != null && level <= propSqlLogLevel) {
String sessionId = Long.toString(session.getId());
String sql = statement.getSQL();
String values = "";
if (sql.length() > 100) {
sql.substring(0, 100);
}
if (level == SimpleLog.LOG_DETAIL) {
if (paramValues != null && paramValues.length > 0) {
values = RowType.convertToSQLString(
paramValues,
statement.getParametersMetaData().getParameterTypes(),
32);
}
}
sqlLog.logContext(SimpleLog.LOG_DETAIL, sessionId, sql, values);
}
}
示例6: createSchema
import org.hsqldb.Statement; //导入依赖的package包/类
public void createSchema() {
sysLobSession = database.sessionManager.getSysLobSession();
InputStream fis = (InputStream) AccessController.doPrivileged(
new PrivilegedAction() {
public InputStream run() {
return getClass().getResourceAsStream(resourceFileName);
}
});
InputStreamReader reader = null;
try {
reader = new InputStreamReader(fis, "ISO-8859-1");
} catch (Exception e) {}
LineNumberReader lineReader = new LineNumberReader(reader);
LineGroupReader lg = new LineGroupReader(lineReader, starters);
HashMappedList map = lg.getAsMap();
lg.close();
String sql = (String) map.get("/*lob_schema_definition*/");
Statement statement = sysLobSession.compileStatement(sql);
Result result = statement.execute(sysLobSession);
if (result.isError()) {
throw result.getException();
}
HsqlName name =
database.schemaManager.getSchemaHsqlName("SYSTEM_LOBS");
Table table = database.schemaManager.getTable(sysLobSession, "BLOCKS",
"SYSTEM_LOBS");
compileStatements();
}
示例7: initialiseLobSpace
import org.hsqldb.Statement; //导入依赖的package包/类
public void initialiseLobSpace() {
Statement statement =
sysLobSession.compileStatement(initialiseBlocksSQL);
Object[] params = new Object[3];
params[0] = ValuePool.INTEGER_0;
params[1] = ValuePool.getInt(totalBlockLimitCount);
params[2] = ValuePool.getLong(0);
sysLobSession.executeCompiledStatement(statement, params);
}
示例8: logStatementEvent
import org.hsqldb.Statement; //导入依赖的package包/类
public void logStatementEvent(Session session, Statement statement,
Object[] paramValues, Result result,
int level) {
if (sqlLog != null && level <= propSqlLogLevel) {
String sessionId = Long.toString(session.getId());
String sql = statement.getSQL();
String values = "";
int paramLength = 0;
if (propSqlLogLevel < SimpleLog.LOG_DETAIL) {
if (sql.length() > 256) {
sql = sql.substring(0, 256);
}
paramLength = 32;
}
if (paramValues != null && paramValues.length > 0) {
values = RowType.convertToSQLString(
paramValues,
statement.getParametersMetaData().getParameterTypes(),
paramLength);
}
if (propSqlLogLevel == SimpleLog.LOG_RESULT) {
StringBuffer sb = new StringBuffer(values);
sb.append(' ').append('[');
if (result.isError()) {
sb.append(result.getErrorCode());
} else if (result.isData()) {
sb.append(result.getNavigator().getSize());
} else if (result.isUpdateCount()) {
sb.append(result.getUpdateCount());
}
sb.append(']');
values = sb.toString();
}
sqlLog.logContext(level, sessionId, sql, values);
}
}
示例9: getStatement
import org.hsqldb.Statement; //导入依赖的package包/类
public Statement getStatement() {
return statement;
}
示例10: setStatement
import org.hsqldb.Statement; //导入依赖的package包/类
public void setStatement(Statement statement) {
this.statement = statement;
}
示例11: readDDL
import org.hsqldb.Statement; //导入依赖的package包/类
protected void readDDL(Session session) throws IOException {
for (; readLoggedStatement(session); ) {
Statement cs = null;
Result result = null;
if (rowIn.getStatementType() == INSERT_STATEMENT) {
isInsert = true;
break;
}
try {
cs = session.compileStatement(statement);
result = session.executeCompiledStatement(cs,
ValuePool.emptyObjectArray);
if (cs.getType() == StatementTypes.CREATE_SCHEMA) {
HsqlName name = cs.getSchemalName();
session.setSchema(name.name);
}
} catch (HsqlException e) {
result = Result.newErrorResult(e);
}
if (result.isError()) {
// handle grants on math and library routines in old versions
if (cs == null) {}
else {
if (cs.getType() == StatementTypes.GRANT) {
continue;
}
}
//
}
if (result.isError()) {
db.logger.appLog.logContext(SimpleLog.LOG_ERROR,
result.getMainString());
throw Error.error(ErrorCode.ERROR_IN_SCRIPT_FILE,
ErrorCode.M_DatabaseScriptReader_readDDL,
new Object[] {
new Integer(lineCount), result.getMainString()
});
}
}
}
示例12: readDDL
import org.hsqldb.Statement; //导入依赖的package包/类
protected void readDDL(Session session) {
for (; readLoggedStatement(session); ) {
Statement cs = null;
Result result = null;
if (rowIn.getStatementType() == INSERT_STATEMENT) {
isInsert = true;
break;
}
try {
cs = session.compileStatement(statement);
result = session.executeCompiledStatement(cs,
ValuePool.emptyObjectArray);
} catch (HsqlException e) {
result = Result.newErrorResult(e);
}
if (result.isError()) {
// handle grants on math and library routines in old versions
if (cs == null) {}
else if (cs.getType() == StatementTypes.GRANT) {
continue;
} else if (cs.getType() == StatementTypes.CREATE_ROUTINE) {
// ignore legacy references
if (result.getMainString().contains(
"org.hsqldb.Library")) {
continue;
}
}
}
if (result.isError()) {
database.logger.logWarningEvent(result.getMainString(),
result.getException());
if (cs != null
&& cs.getType() == StatementTypes.CREATE_ROUTINE) {
continue;
}
throw Error.error(result.getException(),
ErrorCode.ERROR_IN_SCRIPT_FILE,
ErrorCode.M_DatabaseScriptReader_read,
new Object[] {
new Integer(lineCount), result.getMainString()
});
}
}
}
示例13: newPrepareResponse
import org.hsqldb.Statement; //导入依赖的package包/类
public static Result newPrepareResponse(Statement statement) {
Result r = newResult(ResultConstants.PREPARE_ACK);
r.statement = statement;
r.statementID = statement.getID();
int csType = statement.getType();
r.statementReturnType = statement.getStatementReturnType();
r.metaData = statement.getResultMetaData();
r.parameterMetaData = statement.getParametersMetaData();
return r;
}