public class DatabaseContextTracker extends Object
USE mydb; SELECT * FROM t; -- 't' should resolve to 'mydb.dbo.t' (or 'mydb.t')
| Constructor and Description |
|---|
DatabaseContextTracker() |
| Modifier and Type | Method and Description |
|---|---|
void |
applyDefaults(TSQLEnv env)
Apply the tracked defaults to a TSQLEnv.
|
String |
getCurrentDatabase()
Get the current database name.
|
String |
getCurrentSchema()
Get the current schema name.
|
boolean |
hasContext()
Check if any context has been tracked.
|
void |
processStatement(TCustomSqlStatement stmt)
Process a single statement and update context if it's a USE/SET statement.
|
void |
processStatements(TStatementList statements)
Process all statements in the list to extract database/schema context.
|
void |
reset()
Reset the context tracker.
|
String |
toString() |
public DatabaseContextTracker()
public void processStatements(TStatementList statements)
statements - The list of SQL statements to processpublic void processStatement(TCustomSqlStatement stmt)
stmt - The statement to processpublic void applyDefaults(TSQLEnv env)
env - The SQL environment to updatepublic boolean hasContext()
public String getCurrentDatabase()
public String getCurrentSchema()
public void reset()