/** * INTERNAL */ ResultSet getGeneratedKeys(JdbcStatement stat, int id) { getGeneratedKeys = prepareCommand( "SELECT SCOPE_IDENTITY() " + "WHERE SCOPE_IDENTITY() IS NOT NULL", getGeneratedKeys); ResultInterface result = getGeneratedKeys.executeQuery(0, false); return new JdbcResultSet(this, stat, getGeneratedKeys, result, id, false, true, false); }
/** * Read the session state if necessary. */ public void readSessionState() { if (!sessionStateChanged || sessionStateUpdating) { return; } sessionStateChanged = false; sessionState = New.arrayList(); CommandInterface ci = prepareCommand( "SELECT * FROM INFORMATION_SCHEMA.SESSION_STATE", Integer.MAX_VALUE); ResultInterface result = ci.executeQuery(0, false); while (result.next()) { Value[] row = result.currentRow(); sessionState.add(row[1].getString()); } }
/** * Read the serializer name from the persistent database settings. * * @return the serializer */ private String readSerializationSettings() { String javaObjectSerializerFQN = null; CommandInterface ci = prepareCommand( "SELECT VALUE FROM INFORMATION_SCHEMA.SETTINGS "+ " WHERE NAME='JAVA_OBJECT_SERIALIZER'", Integer.MAX_VALUE); try { ResultInterface result = ci.executeQuery(0, false); if (result.next()) { Value[] row = result.currentRow(); javaObjectSerializerFQN = row[0].getString(); } } finally { ci.close(); } return javaObjectSerializerFQN; }
/** * Returns true if the database is read-only. * * @return if the database is read-only * @throws SQLException if the connection is closed */ @Override public boolean isReadOnly() throws SQLException { try { debugCodeCall("isReadOnly"); checkClosed(); getReadOnly = prepareCommand("CALL READONLY()", getReadOnly); ResultInterface result = getReadOnly.executeQuery(0, false); result.next(); return result.currentRow()[0].getBoolean(); } catch (Exception e) { throw logAndConvert(e); } }
/** * INTERNAL */ int getQueryTimeout() throws SQLException { try { if (queryTimeoutCache == -1) { checkClosed(); getQueryTimeout = prepareCommand( "SELECT VALUE FROM INFORMATION_SCHEMA.SETTINGS " + "WHERE NAME=?", getQueryTimeout); getQueryTimeout.getParameters().get(0) .setValue(ValueString.get("QUERY_TIMEOUT"), false); ResultInterface result = getQueryTimeout.executeQuery(0, false); result.next(); int queryTimeout = result.currentRow()[0].getInt(); result.close(); if (queryTimeout != 0) { // round to the next second, otherwise 999 millis would // return 0 seconds queryTimeout = (queryTimeout + 999) / 1000; } queryTimeoutCache = queryTimeout; } return queryTimeoutCache; } catch (Exception e) { throw logAndConvert(e); } }
/** * Gets the current catalog name. * * @return the catalog name * @throws SQLException if the connection is closed */ @Override public String getCatalog() throws SQLException { try { debugCodeCall("getCatalog"); checkClosed(); if (catalog == null) { CommandInterface cat = prepareCommand("CALL DATABASE()", Integer.MAX_VALUE); ResultInterface result = cat.executeQuery(0, false); result.next(); catalog = result.currentRow()[0].getString(); cat.close(); } return catalog; } catch (Exception e) { throw logAndConvert(e); } }
checkClosed(); getLockMode = prepareCommand("CALL LOCK_MODE()", getLockMode); ResultInterface result = getLockMode.executeQuery(0, false); result.next(); int lockMode = result.currentRow()[0].getInt();
try { setExecutingStatement(command); result = command.executeQuery(maxRows, scrollable); lazy = result.isLazy(); } finally {
setExecutingStatement(command); try { result = command.executeQuery(maxRows, scrollable); lazy = result.isLazy(); } finally {
boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; ResultInterface result = command.executeQuery(maxRows, scrollable); lazy = result.isLazy(); resultSet = new JdbcResultSet(conn, this, command, result, id,
boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; ResultInterface result = command.executeQuery(maxRows, scrollable); lazy = result.isLazy(); resultSet = new JdbcResultSet(conn, this, command, result,
ResultInterface getGeneratedKeys(JdbcStatement statement, int id) throws SQLException { getGeneratedKeys = prepareCommand("CALL IDENTITY()", getGeneratedKeys); return getGeneratedKeys.executeQuery(0, false); }
/** * INTERNAL */ ResultSet getGeneratedKeys(JdbcStatement stat, int id) { getGeneratedKeys = prepareCommand( "SELECT SCOPE_IDENTITY() " + "WHERE SCOPE_IDENTITY() IS NOT NULL", getGeneratedKeys); ResultInterface result = getGeneratedKeys.executeQuery(0, false); ResultSet rs = new JdbcResultSet(this, stat, result, id, false, true, false); return rs; }
/** * INTERNAL */ ResultSet getGeneratedKeys(JdbcStatement stat, int id) { getGeneratedKeys = prepareCommand( "SELECT SCOPE_IDENTITY() " + "WHERE SCOPE_IDENTITY() IS NOT NULL", getGeneratedKeys); ResultInterface result = getGeneratedKeys.executeQuery(0, false); ResultSet rs = new JdbcResultSet(this, stat, result, id, false, true, false); return rs; }
private boolean getInternalAutoCommit() throws SQLException { getAutoCommit = prepareCommand("CALL AUTOCOMMIT()", getAutoCommit); ResultInterface result = getAutoCommit.executeQuery(0, false); result.next(); boolean autoCommit = result.currentRow()[0].getBoolean().booleanValue(); result.close(); return autoCommit; }
/** * Read the session state if necessary. */ public void readSessionState() { if (!sessionStateChanged || sessionStateUpdating) { return; } sessionStateChanged = false; sessionState = New.arrayList(); CommandInterface ci = prepareCommand( "SELECT * FROM INFORMATION_SCHEMA.SESSION_STATE", Integer.MAX_VALUE); ResultInterface result = ci.executeQuery(0, false); while (result.next()) { Value[] row = result.currentRow(); sessionState.add(row[1].getString()); } }
/** * Read the session state if necessary. */ public void readSessionState() { if (!sessionStateChanged || sessionStateUpdating) { return; } sessionStateChanged = false; sessionState = New.arrayList(); CommandInterface ci = prepareCommand( "SELECT * FROM INFORMATION_SCHEMA.SESSION_STATE", Integer.MAX_VALUE); ResultInterface result = ci.executeQuery(0, false); while (result.next()) { Value[] row = result.currentRow(); sessionState.add(row[1].getString()); } }
/** * Read the serializer name from the persistent database settings. * * @return the serializer */ private String readSerializationSettings() { String javaObjectSerializerFQN = null; CommandInterface ci = prepareCommand( "SELECT VALUE FROM INFORMATION_SCHEMA.SETTINGS "+ " WHERE NAME='JAVA_OBJECT_SERIALIZER'", Integer.MAX_VALUE); try { ResultInterface result = ci.executeQuery(0, false); if (result.next()) { Value[] row = result.currentRow(); javaObjectSerializerFQN = row[0].getString(); } } finally { ci.close(); } return javaObjectSerializerFQN; }
/** * Returns true if the database is read-only. * * @return if the database is read-only * @throws SQLException if the connection is closed */ @Override public boolean isReadOnly() throws SQLException { try { debugCodeCall("isReadOnly"); checkClosed(); getReadOnly = prepareCommand("CALL READONLY()", getReadOnly); ResultInterface result = getReadOnly.executeQuery(0, false); result.next(); boolean readOnly = result.currentRow()[0].getBoolean().booleanValue(); return readOnly; } catch (Exception e) { throw logAndConvert(e); } }
/** * Gets the current catalog name. * * @throws SQLException * if the connection is closed */ public String getCatalog() throws SQLException { try { debugCodeCall("getCatalog"); checkClosed(); if (catalog == null) { CommandInterface cat = prepareCommand("CALL DATABASE()", Integer.MAX_VALUE); ResultInterface result = cat.executeQuery(0, false); result.next(); catalog = result.currentRow()[0].getString(); cat.close(); } return catalog; } catch (Throwable e) { throw logAndConvert(e); } }