public ServerSession(Database database, User user, int id) { this.database = database; this.queryTimeout = database.getSettings().maxQueryTimeout; this.queryCacheSize = database.getSettings().queryCacheSize; this.user = user; this.id = id; Setting setting = database.findSetting(SetTypes.getTypeName(SetTypes.DEFAULT_LOCK_TIMEOUT)); this.lockTimeout = setting == null ? Constants.INITIAL_LOCK_TIMEOUT : setting.getIntValue(); this.currentSchemaName = Constants.SCHEMA_MAIN; }
@Override public void setAutoCommit(boolean autoCommit) { for (int i = 0; i < n; i++) sessions[i].setAutoCommit(autoCommit); super.setAutoCommit(autoCommit); }
@Override public void close() { if (!closed) { try { database.checkPowerOff(); cleanTempTables(true); database.removeSession(this); } finally { closed = true; } } }
/** * Get the value of the given property. * * @param setting the setting id * @param defaultValue the default value * @return the value as a String */ public String getProperty(int setting, String defaultValue) { String key = SetTypes.getTypeName(setting); String s = getProperty(key); return s == null ? defaultValue : s; }
@Override public void setForUpdate(boolean b) { this.isForUpdate = b; if (session.getDatabase().getSettings().selectForUpdateMvcc && session.getDatabase().isMultiVersion()) { isForUpdateMvcc = b; } }
public DropView(ServerSession session, Schema schema) { super(session, schema); dropAction = session.getDatabase().getSettings().dropRestrict ? ConstraintReferential.RESTRICT : ConstraintReferential.CASCADE; }
/** * Construct a new row list for this session. * * @param session the session */ public RowList(ServerSession session) { this.session = session; if (session.getDatabase().isPersistent()) { maxMemory = session.getDatabase().getMaxOperationMemory(); } else { maxMemory = 0; } }
/** * Create a new object. * * @param session the session */ public StatementBase(ServerSession session) { this.session = session; modificationMetaId = session.getDatabase().getModificationMetaId(); }
/** * Notifies query progress via the DatabaseEventListener */ private void setProgress() { if ((currentRowNumber & 127) == 0) { session.getDatabase().setProgress(DatabaseEventListener.STATE_STATEMENT_PROGRESS, sql, currentRowNumber, 0); } }
public StatementWrapper(ServerSession session, StatementBase statement) { super(session); this.statement = statement; trace = session.getDatabase().getTrace(Trace.COMMAND); }
public boolean isMemoryTable() { return !session.getDatabase().isPersistent() || globalTemporary || temporary || !persistData || id < 0; } }
@Override public void removeChildrenAndResources(ServerSession session) { database.removeMeta(session, getId()); invalidate(); }
/** * Get the comment key name for the given database object. This key name is * used internally to associate the comment to the object. * * @param obj the object * @return the key name */ public static String getKey(DbObject obj) { return getTypeName(obj.getType()) + " " + obj.getSQL(); }
/** * Update an object in the system table. * * @param session the session * @param obj the database object */ public void updateMeta(ServerSession session, DbObject obj) { // lockMeta(session); int id = obj.getId(); removeMeta(session, id); addMeta(session, obj); }
@Override public int getMaxLengthInplaceLob() { return session.getDatabase().getMaxLengthInplaceLob(); }
@Override public void removeChildrenAndResources(ServerSession session) { database.removeMeta(session, getId()); }
public DropTable(ServerSession session, Schema schema) { super(session, schema); dropAction = session.getDatabase().getSettings().dropRestrict ? ConstraintReferential.RESTRICT : ConstraintReferential.CASCADE; }
public Parser(ServerSession session) { this.database = session.getDatabase(); this.session = session; this.identifiersToUpper = database.getSettings().databaseToUpper; }
public Analyze(ServerSession session) { super(session); sampleRows = session.getDatabase().getSettings().analyzeSample; }