Namespace gudusoft.gsqlparser.stmt
Classes
- TAlterDatabaseStmt
This class represents alter database statement.
ALTER DATABASE CURRENT SET COMPATIBILITY_LEVEL = 110 Database name: DatabaseName
alter database tickit rename to newtickit Redshift new database name: NewDatabaseName
alter database tickit owner to dwuser; Redshift owner name: OwnerName
- TAlterTableStatement
This class represents alter table statement.
table altered: TableName
alter options: AlterTableOptionList
Dependency check, in order to alter table,this table must be created at first and following objects must be created already if necessary:
- table/view in column reference constraint
-
function/procedure used in default check constraint</li> </ul>
- TAssignStmt
The assignment statement sets the current value of a variable, field, parameter, or element that has been declared in the current scope.
- TBlockSqlStatement
Base class for all sql statements that include multiple sql statements
- TCaseStmt
The CASE statement chooses from a sequence of conditions, and execute a corresponding statement.
- TCloseStmt
The CLOSE statement closes a cursor or cursor variable, thereby allowing its resources to be reused.
- TCommonBlock
sql block may have label name.
Groups related declarations and statements, is the basic unit of a PL/SQL source program.
- TCommonStoredProcedureSqlStatement
sql block with exception clause
- TCreateIndexSqlStatement
create an index.
- TCreateTableSqlStatement
This class represents create table statement.
CREATE TABLE dbo.Employee (EmployeeID int PRIMARY KEY CLUSTERED);Table:dbo.Employee can be fetched from TargetTable or tables column definitions: can be fetched from ColumnList
Dependency check, in order to create this table, following objects must be created already if necessary:
- table/view in column reference constraint
- function/procedure used in default check constraint
- table/view in sub-query if this table created from a select statement.
- TCreateViewSqlStatement
Define a view, which is a logical table based on one or more tables or views.
- TCursorDeclStmt
Represents cursor related statement, including:
Cursor declaration
Cursor specification
Cursor body
Ref cursor type definition
- TDeleteSqlStatement
This class represents delete statement.
DELETE FROM Production.ProductCostHistory WHERE StandardCost > 1000.00;
Production.ProductCostHistory can be fetched from TargetTable or tables or joins
DELETE FROM Sales.SalesPersonQuotaHistory FROM Sales.SalesPersonQuotaHistory AS spqh INNER JOIN Sales.SalesPerson AS sp ON spqh.BusinessEntityID = sp.BusinessEntityID WHERE sp.SalesYTD > 2500000.00;
Sales.SalesPersonQuotaHistory AS spqh should be fetched froom ReferenceJoins
- TDropIndexSqlStatement
remove an index or domain index from the database.
- TDropTableSqlStatement
move a table or object table to the recycle bin or to remove the table and all its data from the database entirely.
- TDropViewSqlStatement
remove a view or an object view from the database.
- TElsifStmt
Represents ELSEIF ... THEN ... in if statement.
- TExitStmt
The EXIT statement exits a loop and transfers control to the end of the loop. The EXIT statement has two forms: the unconditional EXIT and the conditional EXIT WHEN.
- TFetchStmt
The FETCH statement retrieves rows of data from the result set of a multiple-row query. fetch cursor into variables In plsq and pgplsql
- TIfStmt
The IF statement executes or skips a sequence of statements, depending on the value of a Boolean expression
- TInsertSqlStatement
This class represents insert statement.
INSERT INTO Production.UnitMeasure (Name, UnitMeasureCode,ModifiedDate) VALUES (N'Square Yards', N'Y2', GETDATE());Table name: Production.UnitMeasure. Fetched from TargetTable or tables or joins
column list: (Name, UnitMeasureCode,ModifiedDate). Fetch from ColumnList
value list: (N'Square Yards', N'Y2', GETDATE()). Fetch from Values<pre><code class="lang-csharp">INSERT INTO dbo.EmployeeSales SELECT 'SELECT', sp.BusinessEntityID, c.LastName, sp.SalesYTD FROM Sales.SalesPerson AS sp INNER JOIN Person.Person AS c ON sp.BusinessEntityID = c.BusinessEntityID WHERE sp.BusinessEntityID LIKE '2%' ORDER BY sp.BusinessEntityID, c.LastName;</code></pre> select query in above insert statement can be fetched from <xref href="gudusoft.gsqlparser.stmt.TInsertSqlStatement.SubQuery" data-throw-if-not-resolved="false"></xref>
- TLoopStmt
A LOOP statement executes a sequence of statements multiple times. PL/SQL provides these loop statements:
- Basic loop
- WHILE loop
- FOR loop
FOR indexName IN lower_bound .. upper_bound LOOP statements END LOOP
- Cursor FOR loop
- TMergeSqlStatement
Merge SQL statement.
merge into target_table [column_list] using source_table|subquery on merge_search_condition [when matched [and search_conditions ] then update set {col_name = expression} | delete] [when not matched [and search_conditions ] then insert [(column_list)] values (value_list)]call TargetTable to return a value for target_table.
column_list can be fetched from ColumnList if any.
source_table in using clause can be fetched via UsingTable, subquery treated as a table as well.
call Condition to return merge_search_condition.
when [not] matched clause is available by calling WhenClauses which is a list of type TMergeWhenClause.
- TOpenStmt
The OPEN statement executes the query associated with a cursor.
- TOpenforStmt
The OPEN-FOR statement executes the SELECT statement associated with a cursor variable.
- TRaiseStmt
The RAISE statement stops normal execution of a PL/SQL block or subprogram and transfers control to an exception handler.
- TReturnStmt
The RETURN statement immediately completes the execution of a subprogram and returns control to the invoker
- TSelectSqlStatement
Class TSelectSqlStatement represents query specification, query expression and select statement. query specification including following clause:
- select list ResultColumnList
- from clause joins
- where clause WhereClause
- group clause GroupByClause
- having clause GroupByClause
query expression including all elements in query specification and following clause:
- order by clause OrderbyClause
- offset clause OffsetClause
- for clause
select statement including all elements in query expression and following clause:
- compute clause ComputeClause
- for update clause ForUpdateClause
- optimizer hint
- ctes CteList
Use CombinedQuery to check whether UNION, EXCEPT and INTERSECT operators is used. If returns true, use LeftStmt and RightStmt to get query expression. You need to check CombinedQuery recursively, all clauses of TSelectSqlStatement only available when this function returns false.
- TStoredProcedureSqlStatement
block with declaration and parameters
Base class for stored procedure such as create function, procedure, trigger and etc.
- TUpdateSqlStatement
This class represents update statement.
UPDATE dbo.Table2 SET dbo.Table2.ColB = dbo.Table2.ColB + dbo.Table1.ColB FROM dbo.Table2 INNER JOIN dbo.Table1 ON (dbo.Table2.ColA = dbo.Table1.ColA);Table: dbo.Table2 can be fetched from TargetTable or tables or joins
set clause: dbo.Table2.ColB = dbo.Table2.ColB + dbo.Table1.ColB, ResultColumnList
from clause: dbo.Table2 inner join , ReferenceJoins