Package dev.frostlake.http
Class SessionContext
java.lang.Object
dev.frostlake.http.SessionContext
Per-session context tracking user state
Each HTTP session has its own database/schema context
-
Constructor Summary
ConstructorsConstructorDescriptionSessionContext(String sessionId) SessionContext(String sessionId, String defaultDatabase, String defaultSchema) A session starting where the server's configured defaults point. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidfollowClientAutoCommit(Boolean declared) Follow the autocommit mode a request declares.voidFollow an exactALTER SESSION SET/UNSET MULTI_STATEMENT_COUNTthis session just ran, so the next request that declares no count of its own is gated by what the client asked for.longlongintHow many statements a request may hold when it declares no count of its own; 0 means any.getVariable(String name) booleanbooleanisExpired(long timeoutMs) booleanvoidsetAutoCommit(boolean autoCommit) voidsetCurrentDatabase(String currentDatabase) voidsetCurrentSchema(String currentSchema) voidsetInTransaction(boolean inTransaction) voidsetTransactionId(Long transactionId) voidsetVariable(String name, Object value) voidtouch()
-
Constructor Details
-
SessionContext
public SessionContext() -
SessionContext
-
SessionContext
A session starting where the server's configured defaults point.
-
-
Method Details
-
touch
public void touch() -
isExpired
public boolean isExpired(long timeoutMs) -
getSessionId
-
getCreatedAt
public long getCreatedAt() -
getLastAccessTime
public long getLastAccessTime() -
getCurrentDatabase
-
setCurrentDatabase
-
getCurrentSchema
-
setCurrentSchema
-
getMultiStatementCount
public int getMultiStatementCount()How many statements a request may hold when it declares no count of its own; 0 means any. -
followStatementCount
Follow an exactALTER SESSION SET/UNSET MULTI_STATEMENT_COUNTthis session just ran, so the next request that declares no count of its own is gated by what the client asked for. Any other statement leaves the value alone. -
isAutoCommit
public boolean isAutoCommit() -
setAutoCommit
public void setAutoCommit(boolean autoCommit) -
followClientAutoCommit
Follow the autocommit mode a request declares. A declared mode that differs from the one the session's previous declaring request carried — or the first one the session sees — becomes the session's AUTOCOMMIT setting, exactly asALTER SESSION SET AUTOCOMMITwould set it. A request that declares nothing, or repeats the mode already declared, leaves the setting where it stands: a client that sends its mode on every request switches the session exactly when that mode switches, and anALTER SESSION SET AUTOCOMMITit runs in between stays in force.- Parameters:
declared- the request's autocommit mode, or null when it declares none
-
isInTransaction
public boolean isInTransaction() -
setInTransaction
public void setInTransaction(boolean inTransaction) -
getTransactionId
-
setTransactionId
-
getVariable
-
setVariable
-
clearVariables
public void clearVariables()
-