2008-05-19 15:47:48 +02:00
|
|
|
/*
|
|
|
|
* The contents of this file are subject to the Initial
|
|
|
|
* Developer's Public License Version 1.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
|
|
|
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed AS IS,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing rights
|
|
|
|
* and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code was created by Adriano dos Santos Fernandes
|
|
|
|
* for the Firebird Open Source RDBMS project.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2008 Adriano dos Santos Fernandes <adrianosf@uol.com.br>
|
|
|
|
* and all contributors signed below.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
* Contributor(s): ______________________________________.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DSQL_STMT_NODES_H
|
|
|
|
#define DSQL_STMT_NODES_H
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
#include "../common/classes/MetaName.h"
|
2009-10-24 19:45:33 +02:00
|
|
|
#include "../jrd/blr.h"
|
2011-10-16 22:36:07 +02:00
|
|
|
#include "../jrd/Function.h"
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
#include "../jrd/extds/ExtDS.h"
|
2008-05-19 15:47:48 +02:00
|
|
|
#include "../dsql/Nodes.h"
|
2009-11-21 21:42:27 +01:00
|
|
|
#include "../dsql/DdlNodes.h"
|
2008-05-19 15:47:48 +02:00
|
|
|
|
|
|
|
namespace Jrd {
|
|
|
|
|
2010-12-04 23:15:03 +01:00
|
|
|
class CompoundStmtNode;
|
2011-10-03 00:11:41 +02:00
|
|
|
class ExecBlockNode;
|
2012-04-25 03:42:47 +02:00
|
|
|
class PlanNode;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class RelationSourceNode;
|
2012-02-10 04:06:57 +01:00
|
|
|
class SelectNode;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
2012-05-03 18:43:29 +02:00
|
|
|
typedef Firebird::Pair<
|
|
|
|
Firebird::NonPooled<NestConst<ValueListNode>, NestConst<ValueListNode> > > ReturningClause;
|
2011-03-07 04:15:07 +01:00
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
2011-02-25 03:52:51 +01:00
|
|
|
class ExceptionItem : public Firebird::PermanentStorage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
SQL_CODE = 1,
|
|
|
|
GDS_CODE = 2,
|
|
|
|
XCP_CODE = 3,
|
|
|
|
XCP_DEFAULT = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
ExceptionItem(MemoryPool& pool, const ExceptionItem& o)
|
|
|
|
: PermanentStorage(pool),
|
|
|
|
type(o.type),
|
|
|
|
code(o.code),
|
|
|
|
name(pool, o.name)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-04-02 06:24:20 +02:00
|
|
|
explicit ExceptionItem(MemoryPool& pool)
|
2011-02-25 03:52:51 +01:00
|
|
|
: PermanentStorage(pool),
|
|
|
|
type(Type(0)),
|
|
|
|
code(0),
|
|
|
|
name(pool)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ExceptionItem& operator =(const ExceptionItem& o)
|
|
|
|
{
|
|
|
|
type = o.type;
|
|
|
|
code = o.code;
|
|
|
|
name = o.name;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Type type;
|
|
|
|
SLONG code;
|
2011-04-02 06:24:20 +02:00
|
|
|
// ASF: There are some inconsistencies in the type of 'name'. Metanames have maximum of 31 chars,
|
2011-02-25 03:52:51 +01:00
|
|
|
// while there are system exceptions with 32 chars. The parser always expects metanames, but
|
|
|
|
// I'm following the legacy code and making this a string.
|
|
|
|
Firebird::string name;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef Firebird::ObjectsArray<ExceptionItem> ExceptionArray;
|
|
|
|
|
|
|
|
|
2010-12-04 23:15:03 +01:00
|
|
|
struct ValidateInfo
|
|
|
|
{
|
|
|
|
NestConst<StmtNode> stmt;
|
|
|
|
NestConst<BoolExprNode> boolean;
|
|
|
|
NestConst<ValueExprNode> value;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class AssignmentNode : public TypedNode<StmtNode, StmtNode::TYPE_ASSIGNMENT>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit AssignmentNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_ASSIGNMENT>(pool),
|
|
|
|
asgnFrom(NULL),
|
|
|
|
asgnTo(NULL),
|
|
|
|
missing(NULL),
|
|
|
|
missing2(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual AssignmentNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2011-02-06 22:59:20 +01:00
|
|
|
virtual AssignmentNode* copy(thread_db* tdbb, NodeCopier& copier) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual AssignmentNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual AssignmentNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
NestConst<ValueExprNode> asgnFrom;
|
|
|
|
NestConst<ValueExprNode> asgnTo;
|
|
|
|
NestConst<ValueExprNode> missing;
|
|
|
|
NestConst<ValueExprNode> missing2;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class BlockNode : public TypedNode<StmtNode, StmtNode::TYPE_BLOCK>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit BlockNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_BLOCK>(pool),
|
|
|
|
action(NULL),
|
|
|
|
handlers(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-02-26 02:10:26 +01:00
|
|
|
virtual StmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual BlockNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual BlockNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
private:
|
2011-02-25 03:52:51 +01:00
|
|
|
static bool testAndFixupError(thread_db* tdbb, jrd_req* request, const ExceptionArray& conditions);
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> action;
|
|
|
|
NestConst<CompoundStmtNode> handlers;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-02-25 20:56:37 +01:00
|
|
|
class CommitRollbackNode : public TransactionNode
|
2012-02-06 21:10:07 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Command
|
|
|
|
{
|
|
|
|
CMD_COMMIT,
|
|
|
|
CMD_ROLLBACK
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit CommitRollbackNode(MemoryPool& pool, Command aCommand, bool aRetain)
|
2012-02-25 20:56:37 +01:00
|
|
|
: TransactionNode(pool),
|
2012-02-06 21:10:07 +01:00
|
|
|
command(aCommand),
|
|
|
|
retain(aRetain)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const
|
2012-02-06 21:10:07 +01:00
|
|
|
{
|
|
|
|
text = "CommitRollbackNode";
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual CommitRollbackNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
|
|
|
{
|
|
|
|
switch (command)
|
|
|
|
{
|
|
|
|
case CMD_COMMIT:
|
|
|
|
dsqlScratch->getStatement()->setType(retain ?
|
|
|
|
DsqlCompiledStatement::TYPE_COMMIT_RETAIN : DsqlCompiledStatement::TYPE_COMMIT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CMD_ROLLBACK:
|
|
|
|
dsqlScratch->getStatement()->setType(retain ?
|
|
|
|
DsqlCompiledStatement::TYPE_ROLLBACK_RETAIN : DsqlCompiledStatement::TYPE_ROLLBACK);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2012-02-25 20:56:37 +01:00
|
|
|
virtual void execute(thread_db* tdbb, dsql_req* request, jrd_tra** transaction) const
|
2012-02-06 21:10:07 +01:00
|
|
|
{
|
2012-02-25 20:56:37 +01:00
|
|
|
if (retain)
|
|
|
|
{
|
|
|
|
switch (command)
|
|
|
|
{
|
|
|
|
case CMD_COMMIT:
|
|
|
|
JRD_commit_retaining(tdbb, request->req_transaction);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CMD_ROLLBACK:
|
|
|
|
JRD_rollback_retaining(tdbb, request->req_transaction);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (command)
|
|
|
|
{
|
|
|
|
case CMD_COMMIT:
|
|
|
|
JRD_commit_transaction(tdbb, request->req_transaction);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CMD_ROLLBACK:
|
|
|
|
JRD_rollback_transaction(tdbb, request->req_transaction);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
*transaction = NULL;
|
|
|
|
}
|
2012-02-06 21:10:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Command command;
|
|
|
|
bool retain;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-12-04 23:15:03 +01:00
|
|
|
class CompoundStmtNode : public TypedNode<StmtNode, StmtNode::TYPE_COMPOUND_STMT> // blr_begin
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit CompoundStmtNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_COMPOUND_STMT>(pool),
|
|
|
|
statements(pool),
|
|
|
|
onlyAssignments(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual CompoundStmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2011-02-06 22:59:20 +01:00
|
|
|
virtual CompoundStmtNode* copy(thread_db* tdbb, NodeCopier& copier) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual CompoundStmtNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual CompoundStmtNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Firebird::Array<NestConst<StmtNode> > statements;
|
|
|
|
bool onlyAssignments;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ContinueLeaveNode : public TypedNode<StmtNode, StmtNode::TYPE_CONTINUE_LEAVE>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ContinueLeaveNode(MemoryPool& pool, UCHAR aBlrOp)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_CONTINUE_LEAVE>(pool),
|
|
|
|
blrOp(aBlrOp),
|
2011-01-22 22:32:29 +01:00
|
|
|
labelNumber(0),
|
2012-04-25 03:42:47 +02:00
|
|
|
dsqlLabelName(NULL)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
{
|
|
|
|
fb_assert(blrOp == blr_continue_loop || blrOp == blr_leave);
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual ContinueLeaveNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
|
2012-01-24 04:37:43 +01:00
|
|
|
virtual ContinueLeaveNode* pass1(thread_db* /*tdbb*/, CompilerScratch* /*csb*/)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2012-01-24 04:37:43 +01:00
|
|
|
virtual ContinueLeaveNode* pass2(thread_db* /*tdbb*/, CompilerScratch* /*csb*/)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
UCHAR blrOp;
|
|
|
|
USHORT labelNumber;
|
2012-04-25 03:42:47 +02:00
|
|
|
Firebird::MetaName* dsqlLabelName;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class CursorStmtNode : public TypedNode<StmtNode, StmtNode::TYPE_CURSOR_STMT>
|
|
|
|
{
|
|
|
|
public:
|
2010-12-23 19:42:06 +01:00
|
|
|
explicit CursorStmtNode(MemoryPool& pool, UCHAR aCursorOp, const Firebird::MetaName& aDsqlName = "",
|
2012-05-03 18:43:29 +02:00
|
|
|
ValueListNode* aDsqlIntoStmt = NULL)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_CURSOR_STMT>(pool),
|
2010-12-23 19:42:06 +01:00
|
|
|
dsqlName(pool, aDsqlName),
|
|
|
|
dsqlIntoStmt(aDsqlIntoStmt),
|
|
|
|
cursorOp(aCursorOp),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
cursorNumber(0),
|
|
|
|
scrollOp(0),
|
|
|
|
scrollExpr(NULL),
|
|
|
|
intoStmt(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual CursorStmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual CursorStmtNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual CursorStmtNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2010-12-23 19:42:06 +01:00
|
|
|
Firebird::MetaName dsqlName;
|
2012-05-03 18:43:29 +02:00
|
|
|
ValueListNode* dsqlIntoStmt;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
UCHAR cursorOp;
|
|
|
|
USHORT cursorNumber;
|
|
|
|
UCHAR scrollOp;
|
|
|
|
NestConst<ValueExprNode> scrollExpr;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> intoStmt;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class DeclareCursorNode : public TypedNode<StmtNode, StmtNode::TYPE_DECLARE_CURSOR>
|
|
|
|
{
|
|
|
|
public:
|
2011-02-26 22:51:45 +01:00
|
|
|
static const USHORT CUR_TYPE_NONE = 0;
|
|
|
|
static const USHORT CUR_TYPE_EXPLICIT = 1;
|
|
|
|
static const USHORT CUR_TYPE_FOR = 2;
|
|
|
|
static const USHORT CUR_TYPE_ALL = (CUR_TYPE_EXPLICIT | CUR_TYPE_FOR);
|
|
|
|
|
|
|
|
explicit DeclareCursorNode(MemoryPool& pool, const Firebird::MetaName& aDsqlName = NULL,
|
|
|
|
USHORT aDsqlCursorType = CUR_TYPE_NONE)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_DECLARE_CURSOR>(pool),
|
2011-02-26 22:51:45 +01:00
|
|
|
dsqlCursorType(aDsqlCursorType),
|
|
|
|
dsqlScroll(false),
|
|
|
|
dsqlName(aDsqlName),
|
2012-02-10 04:06:57 +01:00
|
|
|
dsqlSelect(NULL),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
rse(NULL),
|
|
|
|
refs(NULL),
|
|
|
|
cursorNumber(0),
|
|
|
|
cursor(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual DeclareCursorNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual DeclareCursorNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual DeclareCursorNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2011-02-26 22:51:45 +01:00
|
|
|
USHORT dsqlCursorType;
|
|
|
|
bool dsqlScroll;
|
|
|
|
Firebird::MetaName dsqlName;
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<SelectNode> dsqlSelect;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
NestConst<RseNode> rse;
|
|
|
|
NestConst<ValueListNode> refs;
|
|
|
|
USHORT cursorNumber;
|
|
|
|
NestConst<Cursor> cursor;
|
|
|
|
};
|
|
|
|
|
2010-01-05 18:32:42 +01:00
|
|
|
|
2011-10-16 22:36:07 +02:00
|
|
|
class DeclareSubFuncNode : public TypedNode<StmtNode, StmtNode::TYPE_DECLARE_SUBFUNC>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit DeclareSubFuncNode(MemoryPool& pool, const Firebird::MetaName& aName)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_DECLARE_SUBFUNC>(pool),
|
|
|
|
name(pool, aName),
|
|
|
|
dsqlDeterministic(false),
|
|
|
|
dsqlBlock(NULL),
|
|
|
|
blockScratch(NULL),
|
|
|
|
dsqlFunction(NULL),
|
|
|
|
blrStart(NULL),
|
|
|
|
blrLength(0),
|
|
|
|
subCsb(NULL),
|
|
|
|
routine(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-10-16 22:36:07 +02:00
|
|
|
virtual DeclareSubFuncNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
|
|
|
|
virtual DeclareSubFuncNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual DeclareSubFuncNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void parseParameters(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb,
|
|
|
|
Firebird::Array<NestConst<Parameter> >& paramArray, USHORT* defaultCount = NULL);
|
|
|
|
|
|
|
|
void genParameters(DsqlCompilerScratch* dsqlScratch,
|
2012-05-03 18:43:29 +02:00
|
|
|
Firebird::Array<ParameterClause>& paramArray);
|
2011-10-16 22:36:07 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Firebird::MetaName name;
|
|
|
|
bool dsqlDeterministic;
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<ExecBlockNode> dsqlBlock;
|
2011-10-16 22:36:07 +02:00
|
|
|
DsqlCompilerScratch* blockScratch;
|
|
|
|
dsql_udf* dsqlFunction;
|
|
|
|
const UCHAR* blrStart;
|
|
|
|
ULONG blrLength;
|
|
|
|
CompilerScratch* subCsb;
|
|
|
|
Function* routine;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-10-03 00:11:41 +02:00
|
|
|
class DeclareSubProcNode : public TypedNode<StmtNode, StmtNode::TYPE_DECLARE_SUBPROC>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit DeclareSubProcNode(MemoryPool& pool, const Firebird::MetaName& aName)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_DECLARE_SUBPROC>(pool),
|
|
|
|
name(pool, aName),
|
|
|
|
dsqlBlock(NULL),
|
|
|
|
blockScratch(NULL),
|
|
|
|
dsqlProcedure(NULL),
|
|
|
|
blrStart(NULL),
|
|
|
|
blrLength(0),
|
|
|
|
subCsb(NULL),
|
2011-10-16 22:36:07 +02:00
|
|
|
routine(NULL)
|
2011-10-03 00:11:41 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-10-03 00:11:41 +02:00
|
|
|
virtual DeclareSubProcNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
|
|
|
|
virtual DeclareSubProcNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual DeclareSubProcNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void parseParameters(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb,
|
|
|
|
Firebird::Array<NestConst<Parameter> >& paramArray, USHORT* defaultCount = NULL);
|
|
|
|
|
|
|
|
void genParameters(DsqlCompilerScratch* dsqlScratch,
|
2012-05-03 18:43:29 +02:00
|
|
|
Firebird::Array<ParameterClause>& paramArray);
|
2011-10-03 00:11:41 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Firebird::MetaName name;
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<ExecBlockNode> dsqlBlock;
|
2011-10-03 00:11:41 +02:00
|
|
|
DsqlCompilerScratch* blockScratch;
|
|
|
|
dsql_prc* dsqlProcedure;
|
|
|
|
const UCHAR* blrStart;
|
|
|
|
ULONG blrLength;
|
|
|
|
CompilerScratch* subCsb;
|
2011-10-16 22:36:07 +02:00
|
|
|
jrd_prc* routine;
|
2011-10-03 00:11:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-12-04 23:15:03 +01:00
|
|
|
class DeclareVariableNode : public TypedNode<StmtNode, StmtNode::TYPE_DECLARE_VARIABLE>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit DeclareVariableNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_DECLARE_VARIABLE>(pool),
|
2011-03-06 03:48:34 +01:00
|
|
|
dsqlDef(NULL),
|
2010-12-04 23:15:03 +01:00
|
|
|
varId(0)
|
|
|
|
{
|
|
|
|
varDesc.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual DeclareVariableNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2011-02-06 22:59:20 +01:00
|
|
|
virtual DeclareVariableNode* copy(thread_db* tdbb, NodeCopier& copier) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual DeclareVariableNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual DeclareVariableNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
|
|
|
|
|
|
|
public:
|
2011-03-06 03:48:34 +01:00
|
|
|
NestConst<ParameterClause> dsqlDef;
|
2010-12-04 23:15:03 +01:00
|
|
|
USHORT varId;
|
|
|
|
dsc varDesc;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class EraseNode : public TypedNode<StmtNode, StmtNode::TYPE_ERASE>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit EraseNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_ERASE>(pool),
|
2011-03-04 02:47:49 +01:00
|
|
|
dsqlRelation(NULL),
|
|
|
|
dsqlBoolean(NULL),
|
|
|
|
dsqlPlan(NULL),
|
2012-04-25 03:42:47 +02:00
|
|
|
dsqlOrder(NULL),
|
2011-03-04 02:47:49 +01:00
|
|
|
dsqlRows(NULL),
|
2012-02-20 03:02:04 +01:00
|
|
|
dsqlCursorName(pool),
|
2011-03-04 02:47:49 +01:00
|
|
|
dsqlReturning(NULL),
|
|
|
|
dsqlRse(NULL),
|
|
|
|
dsqlContext(NULL),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
statement(NULL),
|
|
|
|
subStatement(NULL),
|
|
|
|
stream(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-03-04 02:47:49 +01:00
|
|
|
virtual StmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual EraseNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual EraseNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
2008-05-19 15:47:48 +02:00
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
private:
|
|
|
|
static void pass1Erase(thread_db* tdbb, CompilerScratch* csb, EraseNode* node);
|
2010-12-04 23:15:03 +01:00
|
|
|
const StmtNode* erase(thread_db* tdbb, jrd_req* request, WhichTrigger whichTrig) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<RelationSourceNode> dsqlRelation;
|
|
|
|
NestConst<BoolExprNode> dsqlBoolean;
|
|
|
|
NestConst<PlanNode> dsqlPlan;
|
|
|
|
NestConst<ValueListNode> dsqlOrder;
|
|
|
|
NestConst<RowsClause> dsqlRows;
|
2012-02-20 03:02:04 +01:00
|
|
|
Firebird::MetaName dsqlCursorName;
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<ReturningClause> dsqlReturning;
|
|
|
|
NestConst<RseNode> dsqlRse;
|
2011-03-04 02:47:49 +01:00
|
|
|
dsql_ctx* dsqlContext;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> statement;
|
|
|
|
NestConst<StmtNode> subStatement;
|
2012-04-12 11:02:13 +02:00
|
|
|
StreamType stream;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ErrorHandlerNode : public TypedNode<StmtNode, StmtNode::TYPE_ERROR_HANDLER>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ErrorHandlerNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_ERROR_HANDLER>(pool),
|
|
|
|
action(NULL),
|
2011-02-25 03:52:51 +01:00
|
|
|
conditions(pool)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual ErrorHandlerNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual ErrorHandlerNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual ErrorHandlerNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> action;
|
2011-02-25 03:52:51 +01:00
|
|
|
ExceptionArray conditions;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ExecProcedureNode : public TypedNode<StmtNode, StmtNode::TYPE_EXEC_PROCEDURE>
|
|
|
|
{
|
|
|
|
public:
|
2010-12-23 19:42:06 +01:00
|
|
|
explicit ExecProcedureNode(MemoryPool& pool,
|
|
|
|
const Firebird::QualifiedName& aDsqlName = Firebird::QualifiedName(),
|
2012-05-03 18:43:29 +02:00
|
|
|
ValueListNode* aInputs = NULL, ValueListNode* aOutputs = NULL)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_EXEC_PROCEDURE>(pool),
|
2010-12-23 19:42:06 +01:00
|
|
|
dsqlName(pool, aDsqlName),
|
2011-10-03 00:11:41 +02:00
|
|
|
dsqlProcedure(NULL),
|
2012-05-03 18:43:29 +02:00
|
|
|
inputSources(aInputs),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
inputTargets(NULL),
|
|
|
|
inputMessage(NULL),
|
2012-05-03 18:43:29 +02:00
|
|
|
outputSources(aOutputs),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
outputTargets(NULL),
|
|
|
|
outputMessage(NULL),
|
|
|
|
procedure(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual ExecProcedureNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual ExecProcedureNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual ExecProcedureNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
private:
|
2012-05-03 18:43:29 +02:00
|
|
|
ValueListNode* explodeOutputs(DsqlCompilerScratch* dsqlScratch, const dsql_prc* procedure);
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
void executeProcedure(thread_db* tdbb, jrd_req* request) const;
|
|
|
|
|
|
|
|
public:
|
2010-12-23 19:42:06 +01:00
|
|
|
Firebird::QualifiedName dsqlName;
|
2011-10-03 00:11:41 +02:00
|
|
|
dsql_prc* dsqlProcedure;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
NestConst<ValueListNode> inputSources;
|
|
|
|
NestConst<ValueListNode> inputTargets;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<MessageNode> inputMessage;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
NestConst<ValueListNode> outputSources;
|
|
|
|
NestConst<ValueListNode> outputTargets;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<MessageNode> outputMessage;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
NestConst<jrd_prc> procedure;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ExecStatementNode : public TypedNode<StmtNode, StmtNode::TYPE_EXEC_STATEMENT>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ExecStatementNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_EXEC_STATEMENT>(pool),
|
2012-04-25 03:42:47 +02:00
|
|
|
dsqlLabelName(NULL),
|
|
|
|
dsqlLabelNumber(0),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
sql(NULL),
|
|
|
|
dataSource(NULL),
|
|
|
|
userName(NULL),
|
|
|
|
password(NULL),
|
|
|
|
role(NULL),
|
|
|
|
innerStmt(NULL),
|
|
|
|
inputs(NULL),
|
|
|
|
outputs(NULL),
|
|
|
|
useCallerPrivs(false),
|
2010-12-23 19:42:06 +01:00
|
|
|
traScope(EDS::TraScope(0)), // not defined
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
inputNames(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-12-23 19:42:06 +01:00
|
|
|
virtual StmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual ExecStatementNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual ExecStatementNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
private:
|
2012-04-25 03:42:47 +02:00
|
|
|
static void genOptionalExpr(DsqlCompilerScratch* dsqlScratch, const UCHAR code, ValueExprNode* node);
|
2010-12-23 19:42:06 +01:00
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
void getString(thread_db* tdbb, jrd_req* request, const ValueExprNode* node,
|
2011-01-21 11:03:17 +01:00
|
|
|
Firebird::string& str, bool useAttCS = false) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2012-04-25 03:42:47 +02:00
|
|
|
Firebird::MetaName* dsqlLabelName;
|
|
|
|
USHORT dsqlLabelNumber;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
NestConst<ValueExprNode> sql;
|
|
|
|
NestConst<ValueExprNode> dataSource;
|
|
|
|
NestConst<ValueExprNode> userName;
|
|
|
|
NestConst<ValueExprNode> password;
|
|
|
|
NestConst<ValueExprNode> role;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> innerStmt;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
NestConst<ValueListNode> inputs;
|
|
|
|
NestConst<ValueListNode> outputs;
|
|
|
|
bool useCallerPrivs;
|
|
|
|
EDS::TraScope traScope;
|
|
|
|
EDS::ParamNames* inputNames;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class IfNode : public TypedNode<StmtNode, StmtNode::TYPE_IF>
|
2009-10-24 19:45:33 +02:00
|
|
|
{
|
|
|
|
public:
|
2010-09-17 05:15:32 +02:00
|
|
|
explicit IfNode(MemoryPool& pool)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_IF>(pool),
|
2009-10-24 19:45:33 +02:00
|
|
|
condition(NULL),
|
|
|
|
trueAction(NULL),
|
|
|
|
falseAction(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual IfNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2009-10-24 19:45:33 +02:00
|
|
|
virtual IfNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual IfNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
2009-10-24 19:45:33 +02:00
|
|
|
|
|
|
|
public:
|
2010-09-20 18:07:50 +02:00
|
|
|
NestConst<BoolExprNode> condition;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> trueAction;
|
|
|
|
NestConst<StmtNode> falseAction;
|
2009-10-24 19:45:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class InAutonomousTransactionNode : public TypedNode<StmtNode, StmtNode::TYPE_IN_AUTO_TRANS>
|
2008-05-19 15:47:48 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit InAutonomousTransactionNode(MemoryPool& pool)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_IN_AUTO_TRANS>(pool),
|
2009-08-05 23:36:49 +02:00
|
|
|
action(NULL),
|
2009-08-06 08:30:35 +02:00
|
|
|
savNumberOffset(0)
|
2008-05-19 15:47:48 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2009-10-24 19:45:33 +02:00
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
2008-05-19 15:47:48 +02:00
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual InAutonomousTransactionNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2008-05-19 15:47:48 +02:00
|
|
|
virtual InAutonomousTransactionNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual InAutonomousTransactionNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
2008-05-19 15:47:48 +02:00
|
|
|
|
|
|
|
public:
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> action;
|
2009-08-06 08:30:35 +02:00
|
|
|
SLONG savNumberOffset;
|
2008-05-19 15:47:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-12-04 23:15:03 +01:00
|
|
|
class InitVariableNode : public TypedNode<StmtNode, StmtNode::TYPE_INIT_VARIABLE>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit InitVariableNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_INIT_VARIABLE>(pool),
|
|
|
|
varId(0),
|
|
|
|
varDecl(NULL),
|
|
|
|
varInfo(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual InitVariableNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2011-02-06 22:59:20 +01:00
|
|
|
virtual InitVariableNode* copy(thread_db* tdbb, NodeCopier& copier) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual InitVariableNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual InitVariableNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
USHORT varId;
|
|
|
|
NestConst<DeclareVariableNode> varDecl;
|
|
|
|
NestConst<ItemInfo> varInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class ExecBlockNode : public TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_EXEC_BLOCK>
|
2009-10-21 02:42:38 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ExecBlockNode(MemoryPool& pool)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_EXEC_BLOCK>(pool),
|
2010-06-15 18:07:58 +02:00
|
|
|
parameters(pool),
|
2009-11-21 21:42:27 +01:00
|
|
|
returns(pool),
|
2009-10-21 02:42:38 +02:00
|
|
|
localDeclList(NULL),
|
|
|
|
body(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual ExecBlockNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2009-10-21 02:42:38 +02:00
|
|
|
|
|
|
|
private:
|
2009-12-19 19:50:38 +01:00
|
|
|
static void revertParametersOrder(Firebird::Array<dsql_par*>& parameters);
|
2009-10-21 02:42:38 +02:00
|
|
|
|
|
|
|
public:
|
2010-06-15 18:07:58 +02:00
|
|
|
Firebird::Array<ParameterClause> parameters;
|
2009-11-21 21:42:27 +01:00
|
|
|
Firebird::Array<ParameterClause> returns;
|
2011-02-22 01:51:56 +01:00
|
|
|
NestConst<CompoundStmtNode> localDeclList;
|
2011-03-06 03:48:34 +01:00
|
|
|
NestConst<StmtNode> body;
|
2009-10-21 02:42:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class ExceptionNode : public TypedNode<StmtNode, StmtNode::TYPE_EXCEPTION>
|
2010-01-05 18:32:42 +01:00
|
|
|
{
|
|
|
|
public:
|
2011-02-25 03:52:51 +01:00
|
|
|
ExceptionNode(MemoryPool& pool, const Firebird::MetaName& name,
|
2012-05-03 18:43:29 +02:00
|
|
|
ValueExprNode* aMessageExpr = NULL, ValueListNode* aParameters = NULL)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_EXCEPTION>(pool),
|
2012-05-03 18:43:29 +02:00
|
|
|
messageExpr(aMessageExpr),
|
|
|
|
parameters(aParameters)
|
2011-02-25 03:52:51 +01:00
|
|
|
{
|
|
|
|
exception = FB_NEW(pool) ExceptionItem(pool);
|
|
|
|
exception->type = ExceptionItem::XCP_CODE;
|
|
|
|
exception->name = name.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
explicit ExceptionNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_EXCEPTION>(pool),
|
|
|
|
messageExpr(NULL),
|
2010-01-07 01:16:50 +01:00
|
|
|
parameters(NULL),
|
2010-01-05 18:32:42 +01:00
|
|
|
exception(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual StmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2010-01-05 18:32:42 +01:00
|
|
|
virtual ExceptionNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual ExceptionNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
2010-01-05 18:32:42 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void setError(thread_db* tdbb) const;
|
|
|
|
|
|
|
|
public:
|
2010-11-21 04:47:29 +01:00
|
|
|
NestConst<ValueExprNode> messageExpr;
|
|
|
|
NestConst<ValueListNode> parameters;
|
2011-02-25 03:52:51 +01:00
|
|
|
NestConst<ExceptionItem> exception;
|
2010-01-05 18:32:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class ExitNode : public TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_EXIT>
|
2009-10-24 19:45:33 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ExitNode(MemoryPool& pool)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_EXIT>(pool)
|
2009-10-24 19:45:33 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2009-10-24 19:45:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class ForNode : public TypedNode<StmtNode, StmtNode::TYPE_FOR>
|
2010-02-22 17:00:49 +01:00
|
|
|
{
|
|
|
|
public:
|
2010-09-17 05:15:32 +02:00
|
|
|
explicit ForNode(MemoryPool& pool)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_FOR>(pool),
|
2010-02-22 17:00:49 +01:00
|
|
|
dsqlSelect(NULL),
|
|
|
|
dsqlInto(NULL),
|
|
|
|
dsqlCursor(NULL),
|
2012-04-25 03:42:47 +02:00
|
|
|
dsqlLabelName(NULL),
|
|
|
|
dsqlLabelNumber(0),
|
2010-06-10 04:03:03 +02:00
|
|
|
dsqlForceSingular(false),
|
2010-02-22 17:00:49 +01:00
|
|
|
stall(NULL),
|
|
|
|
rse(NULL),
|
|
|
|
statement(NULL),
|
2012-09-24 16:26:33 +02:00
|
|
|
cursor(NULL),
|
|
|
|
parBlrBeginCnt(0)
|
2010-02-22 17:00:49 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-03-06 03:48:34 +01:00
|
|
|
virtual ForNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2010-02-22 17:00:49 +01:00
|
|
|
virtual StmtNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual StmtNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
2010-02-22 17:00:49 +01:00
|
|
|
|
|
|
|
public:
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<SelectNode> dsqlSelect;
|
|
|
|
NestConst<ValueListNode> dsqlInto;
|
2012-02-20 03:02:04 +01:00
|
|
|
DeclareCursorNode* dsqlCursor;
|
2012-04-25 03:42:47 +02:00
|
|
|
Firebird::MetaName* dsqlLabelName;
|
|
|
|
USHORT dsqlLabelNumber;
|
2010-06-10 04:03:03 +02:00
|
|
|
bool dsqlForceSingular;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> stall;
|
2010-08-24 05:25:01 +02:00
|
|
|
NestConst<RseNode> rse;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> statement;
|
2010-08-11 17:33:06 +02:00
|
|
|
NestConst<Cursor> cursor;
|
2012-09-24 16:26:33 +02:00
|
|
|
int parBlrBeginCnt;
|
2010-02-22 17:00:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class HandlerNode : public TypedNode<StmtNode, StmtNode::TYPE_HANDLER>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit HandlerNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_HANDLER>(pool),
|
|
|
|
statement(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual HandlerNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual HandlerNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual HandlerNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> statement;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LabelNode : public TypedNode<StmtNode, StmtNode::TYPE_LABEL>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit LabelNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_LABEL>(pool),
|
|
|
|
statement(NULL),
|
|
|
|
labelNumber(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual LabelNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual LabelNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual LabelNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> statement;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
USHORT labelNumber;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-03-05 03:47:22 +01:00
|
|
|
class LineColumnNode : public TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_LINE_COLUMN>
|
|
|
|
{
|
|
|
|
public:
|
2011-03-06 03:48:34 +01:00
|
|
|
explicit LineColumnNode(MemoryPool& pool, USHORT aLine, USHORT aColumn, StmtNode* aStatement)
|
2011-03-05 03:47:22 +01:00
|
|
|
: TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_LINE_COLUMN>(pool),
|
|
|
|
statement(aStatement)
|
|
|
|
{
|
|
|
|
line = aLine;
|
|
|
|
column = aColumn;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-03-05 03:47:22 +01:00
|
|
|
virtual LineColumnNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
|
|
|
|
private:
|
2011-03-06 03:48:34 +01:00
|
|
|
NestConst<StmtNode> statement;
|
2011-03-05 03:47:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class LoopNode : public TypedNode<StmtNode, StmtNode::TYPE_LOOP>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit LoopNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_LOOP>(pool),
|
2012-04-25 03:42:47 +02:00
|
|
|
dsqlLabelName(NULL),
|
|
|
|
dsqlLabelNumber(0),
|
2011-02-22 16:30:06 +01:00
|
|
|
dsqlExpr(NULL),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
statement(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual LoopNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual LoopNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual LoopNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
|
|
|
|
|
|
|
public:
|
2012-04-25 03:42:47 +02:00
|
|
|
Firebird::MetaName* dsqlLabelName;
|
|
|
|
USHORT dsqlLabelNumber;
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<BoolExprNode> dsqlExpr;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> statement;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-03-04 02:47:49 +01:00
|
|
|
class MergeNode : public TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_MERGE>
|
|
|
|
{
|
|
|
|
public:
|
2011-10-23 03:31:11 +02:00
|
|
|
struct Matched
|
|
|
|
{
|
2012-04-12 11:02:13 +02:00
|
|
|
explicit Matched(MemoryPool& pool)
|
2011-10-23 03:31:11 +02:00
|
|
|
: assignments(NULL),
|
|
|
|
condition(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<CompoundStmtNode> assignments;
|
|
|
|
NestConst<BoolExprNode> condition;
|
2011-10-23 03:31:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct NotMatched
|
|
|
|
{
|
2012-04-12 11:02:13 +02:00
|
|
|
explicit NotMatched(MemoryPool& pool)
|
2012-03-25 03:08:55 +02:00
|
|
|
: fields(pool),
|
2011-10-23 03:31:11 +02:00
|
|
|
values(NULL),
|
|
|
|
condition(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-05-03 18:43:29 +02:00
|
|
|
Firebird::Array<NestConst<FieldNode> > fields;
|
|
|
|
NestConst<ValueListNode> values;
|
|
|
|
NestConst<BoolExprNode> condition;
|
2011-10-23 03:31:11 +02:00
|
|
|
};
|
|
|
|
|
2012-01-24 04:37:43 +01:00
|
|
|
explicit MergeNode(MemoryPool& pool)
|
2011-03-04 02:47:49 +01:00
|
|
|
: TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_MERGE>(pool),
|
2012-05-03 18:43:29 +02:00
|
|
|
relation(NULL),
|
|
|
|
usingClause(NULL),
|
|
|
|
condition(NULL),
|
|
|
|
whenMatched(pool),
|
|
|
|
whenNotMatched(pool),
|
|
|
|
returning(NULL)
|
2011-03-04 02:47:49 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-03-04 02:47:49 +01:00
|
|
|
virtual StmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
|
|
|
|
public:
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<RelationSourceNode> relation;
|
|
|
|
NestConst<RecordSourceNode> usingClause;
|
|
|
|
NestConst<BoolExprNode> condition;
|
|
|
|
Firebird::ObjectsArray<Matched> whenMatched;
|
|
|
|
Firebird::ObjectsArray<NotMatched> whenNotMatched;
|
|
|
|
NestConst<ReturningClause> returning;
|
2011-03-04 02:47:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-12-04 23:15:03 +01:00
|
|
|
class MessageNode : public TypedNode<StmtNode, StmtNode::TYPE_MESSAGE>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit MessageNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_MESSAGE>(pool),
|
|
|
|
messageNumber(0),
|
|
|
|
format(NULL),
|
|
|
|
impureFlags(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual MessageNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2011-02-06 22:59:20 +01:00
|
|
|
virtual MessageNode* copy(thread_db* tdbb, NodeCopier& copier) const;
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual MessageNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual MessageNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2010-12-04 23:15:03 +01:00
|
|
|
USHORT messageNumber;
|
|
|
|
NestConst<Format> format;
|
|
|
|
ULONG impureFlags;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ModifyNode : public TypedNode<StmtNode, StmtNode::TYPE_MODIFY>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ModifyNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_MODIFY>(pool),
|
2011-03-04 02:47:49 +01:00
|
|
|
dsqlRelation(NULL),
|
|
|
|
dsqlBoolean(NULL),
|
|
|
|
dsqlPlan(NULL),
|
2012-04-25 03:42:47 +02:00
|
|
|
dsqlOrder(NULL),
|
2011-03-04 02:47:49 +01:00
|
|
|
dsqlRows(NULL),
|
2012-02-20 03:02:04 +01:00
|
|
|
dsqlCursorName(pool),
|
2011-03-04 02:47:49 +01:00
|
|
|
dsqlReturning(NULL),
|
|
|
|
dsqlRseFlags(0),
|
|
|
|
dsqlRse(NULL),
|
|
|
|
dsqlContext(NULL),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
statement(NULL),
|
|
|
|
statement2(NULL),
|
|
|
|
subMod(NULL),
|
2010-12-04 23:15:03 +01:00
|
|
|
validations(pool),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
mapView(NULL),
|
|
|
|
orgStream(0),
|
|
|
|
newStream(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-03-04 02:47:49 +01:00
|
|
|
StmtNode* internalDsqlPass(DsqlCompilerScratch* dsqlScratch, bool updateOrInsert);
|
|
|
|
virtual StmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual ModifyNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual ModifyNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
static void pass1Modify(thread_db* tdbb, CompilerScratch* csb, ModifyNode* node);
|
2010-12-04 23:15:03 +01:00
|
|
|
const StmtNode* modify(thread_db* tdbb, jrd_req* request, WhichTrigger whichTrig) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<RecordSourceNode> dsqlRelation;
|
|
|
|
NestConst<BoolExprNode> dsqlBoolean;
|
|
|
|
NestConst<PlanNode> dsqlPlan;
|
|
|
|
NestConst<ValueListNode> dsqlOrder;
|
|
|
|
NestConst<RowsClause> dsqlRows;
|
2012-02-20 03:02:04 +01:00
|
|
|
Firebird::MetaName dsqlCursorName;
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<ReturningClause> dsqlReturning;
|
2011-03-04 02:47:49 +01:00
|
|
|
USHORT dsqlRseFlags;
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<RecordSourceNode> dsqlRse;
|
2011-03-04 02:47:49 +01:00
|
|
|
dsql_ctx* dsqlContext;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> statement;
|
|
|
|
NestConst<StmtNode> statement2;
|
|
|
|
NestConst<StmtNode> subMod;
|
|
|
|
Firebird::Array<ValidateInfo> validations;
|
|
|
|
NestConst<StmtNode> mapView;
|
2012-04-12 11:02:13 +02:00
|
|
|
StreamType orgStream;
|
|
|
|
StreamType newStream;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class PostEventNode : public TypedNode<StmtNode, StmtNode::TYPE_POST_EVENT>
|
2009-10-24 19:45:33 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit PostEventNode(MemoryPool& pool)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_POST_EVENT>(pool),
|
2009-10-24 19:45:33 +02:00
|
|
|
event(NULL),
|
|
|
|
argument(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual PostEventNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2009-10-24 19:45:33 +02:00
|
|
|
virtual PostEventNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual PostEventNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
2009-10-24 19:45:33 +02:00
|
|
|
|
|
|
|
public:
|
2010-11-21 04:47:29 +01:00
|
|
|
NestConst<ValueExprNode> event;
|
|
|
|
NestConst<ValueExprNode> argument;
|
2009-10-24 19:45:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class ReceiveNode : public TypedNode<StmtNode, StmtNode::TYPE_RECEIVE>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ReceiveNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_RECEIVE>(pool),
|
|
|
|
statement(NULL),
|
|
|
|
message(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual ReceiveNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual ReceiveNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual ReceiveNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> statement;
|
|
|
|
NestConst<MessageNode> message;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class StoreNode : public TypedNode<StmtNode, StmtNode::TYPE_STORE>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit StoreNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_STORE>(pool),
|
2011-03-04 02:47:49 +01:00
|
|
|
dsqlRelation(NULL),
|
2012-03-25 03:08:55 +02:00
|
|
|
dsqlFields(pool),
|
2011-03-04 02:47:49 +01:00
|
|
|
dsqlValues(NULL),
|
|
|
|
dsqlReturning(NULL),
|
|
|
|
dsqlRse(NULL),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
statement(NULL),
|
|
|
|
statement2(NULL),
|
|
|
|
subStore(NULL),
|
2010-12-04 23:15:03 +01:00
|
|
|
validations(pool),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
relationSource(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-03-04 02:47:49 +01:00
|
|
|
StmtNode* internalDsqlPass(DsqlCompilerScratch* dsqlScratch, bool updateOrInsert);
|
|
|
|
virtual StmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual StoreNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual StoreNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
static bool pass1Store(thread_db* tdbb, CompilerScratch* csb, StoreNode* node);
|
|
|
|
void makeDefaults(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
const StmtNode* store(thread_db* tdbb, jrd_req* request, WhichTrigger whichTrig) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<RecordSourceNode> dsqlRelation;
|
|
|
|
Firebird::Array<NestConst<FieldNode> > dsqlFields;
|
|
|
|
NestConst<ValueListNode> dsqlValues;
|
|
|
|
NestConst<ReturningClause> dsqlReturning;
|
|
|
|
NestConst<RecordSourceNode> dsqlRse;
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<StmtNode> statement;
|
|
|
|
NestConst<StmtNode> statement2;
|
|
|
|
NestConst<StmtNode> subStore;
|
|
|
|
Firebird::Array<ValidateInfo> validations;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
NestConst<RelationSourceNode> relationSource;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class UserSavepointNode : public TypedNode<StmtNode, StmtNode::TYPE_USER_SAVEPOINT>
|
2009-10-24 19:45:33 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Command
|
|
|
|
{
|
2009-10-31 02:46:06 +01:00
|
|
|
CMD_NOTHING = -1,
|
2009-10-24 19:45:33 +02:00
|
|
|
CMD_SET = blr_savepoint_set,
|
|
|
|
CMD_RELEASE = blr_savepoint_release,
|
|
|
|
CMD_RELEASE_ONLY = blr_savepoint_release_single,
|
|
|
|
CMD_ROLLBACK = blr_savepoint_undo
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
explicit UserSavepointNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_USER_SAVEPOINT>(pool),
|
2009-10-30 11:43:42 +01:00
|
|
|
command(CMD_NOTHING),
|
2009-10-24 19:45:33 +02:00
|
|
|
name(pool)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual UserSavepointNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual UserSavepointNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual UserSavepointNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
2009-10-24 19:45:33 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Command command;
|
|
|
|
Firebird::MetaName name;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class SelectNode : public TypedNode<StmtNode, StmtNode::TYPE_SELECT>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit SelectNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_SELECT>(pool),
|
2012-02-10 04:06:57 +01:00
|
|
|
dsqlExpr(NULL),
|
|
|
|
dsqlForUpdate(false),
|
|
|
|
dsqlWithLock(false),
|
|
|
|
dsqlRse(NULL),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
statements(pool)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual SelectNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual SelectNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual SelectNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<SelectExprNode> dsqlExpr;
|
2012-02-10 04:06:57 +01:00
|
|
|
bool dsqlForUpdate;
|
|
|
|
bool dsqlWithLock;
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<RseNode> dsqlRse;
|
2010-12-04 23:15:03 +01:00
|
|
|
Firebird::Array<NestConst<StmtNode> > statements;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SetGeneratorNode : public TypedNode<StmtNode, StmtNode::TYPE_SET_GENERATOR>
|
|
|
|
{
|
|
|
|
public:
|
2012-05-03 18:43:29 +02:00
|
|
|
SetGeneratorNode(MemoryPool& pool, const Firebird::MetaName& aName, ValueExprNode* aValue = NULL)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_SET_GENERATOR>(pool),
|
2011-02-22 02:57:51 +01:00
|
|
|
name(aName),
|
2012-05-03 18:43:29 +02:00
|
|
|
value(aValue),
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
genId(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual SetGeneratorNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual SetGeneratorNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual SetGeneratorNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
2011-02-22 02:57:51 +01:00
|
|
|
Firebird::MetaName name;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
NestConst<ValueExprNode> value;
|
|
|
|
USHORT genId;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class StallNode : public TypedNode<StmtNode, StmtNode::TYPE_STALL>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit StallNode(MemoryPool& pool)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_STALL>(pool)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual StallNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual StallNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual StallNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SuspendNode : public TypedNode<StmtNode, StmtNode::TYPE_SUSPEND>
|
2009-10-24 19:45:33 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit SuspendNode(MemoryPool& pool)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_SUSPEND>(pool),
|
2009-10-24 19:45:33 +02:00
|
|
|
message(NULL),
|
|
|
|
statement(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual SuspendNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2009-10-24 19:45:33 +02:00
|
|
|
virtual SuspendNode* pass1(thread_db* tdbb, CompilerScratch* csb);
|
|
|
|
virtual SuspendNode* pass2(thread_db* tdbb, CompilerScratch* csb);
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
2009-10-24 19:45:33 +02:00
|
|
|
|
|
|
|
public:
|
2010-12-04 23:15:03 +01:00
|
|
|
NestConst<MessageNode> message;
|
|
|
|
NestConst<StmtNode> statement;
|
2009-10-24 19:45:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class ReturnNode : public TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_RETURN>
|
2009-12-21 18:23:07 +01:00
|
|
|
{
|
|
|
|
public:
|
2012-04-25 03:42:47 +02:00
|
|
|
explicit ReturnNode(MemoryPool& pool, ValueExprNode* val = NULL)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
: TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_RETURN>(pool),
|
|
|
|
value(val)
|
2009-12-21 18:23:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2010-09-17 05:15:32 +02:00
|
|
|
virtual ReturnNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
2009-12-21 18:23:07 +01:00
|
|
|
|
|
|
|
public:
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<ValueExprNode> value;
|
2009-12-21 18:23:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
class SavePointNode : public TypedNode<StmtNode, StmtNode::TYPE_SAVEPOINT>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit SavePointNode(MemoryPool& pool, UCHAR aBlrOp)
|
|
|
|
: TypedNode<StmtNode, StmtNode::TYPE_SAVEPOINT>(pool),
|
|
|
|
blrOp(aBlrOp)
|
|
|
|
{
|
|
|
|
fb_assert(blrOp == blr_start_savepoint || blrOp == blr_end_savepoint);
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp);
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
virtual SavePointNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
|
2012-01-24 04:37:43 +01:00
|
|
|
virtual SavePointNode* pass1(thread_db* /*tdbb*/, CompilerScratch* /*csb*/)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2012-01-24 04:37:43 +01:00
|
|
|
virtual SavePointNode* pass2(thread_db* /*tdbb*/, CompilerScratch* /*csb*/)
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2010-12-04 23:15:03 +01:00
|
|
|
virtual const StmtNode* execute(thread_db* tdbb, jrd_req* request, ExeState* exeState) const;
|
Refactored the support for blr_handler, blr_loop, blr_exec_sql, blr_exec_into, blr_exec_stmt,
blr_start_savepoint, blr_end_savepoint, blr_store, blr_store2, blr_erase, blr_modify,
blr_modify2, blr_exec_proc, blr_exec_proc2, blr_exec_pid, blr_dcl_cursor, blr_cursor_stmt,
blr_set_generator, blr_receive, blr_stall, blr_select, blr_block, blr_error_handler,
blr_label, blr_leave, blr_continue and the source info node.
2010-11-29 03:17:04 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
UCHAR blrOp;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-02-25 20:56:37 +01:00
|
|
|
class SetTransactionNode : public TransactionNode
|
2012-02-06 21:10:50 +01:00
|
|
|
{
|
|
|
|
public:
|
2012-04-25 03:42:47 +02:00
|
|
|
struct RestrictionOption : Firebird::PermanentStorage
|
|
|
|
{
|
|
|
|
RestrictionOption(MemoryPool& p, Firebird::ObjectsArray<Firebird::MetaName>* aTables,
|
|
|
|
unsigned aLockMode)
|
|
|
|
: PermanentStorage(p),
|
|
|
|
tables(aTables),
|
|
|
|
lockMode(aLockMode)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Firebird::ObjectsArray<Firebird::MetaName>* tables;
|
|
|
|
unsigned lockMode;
|
|
|
|
};
|
|
|
|
|
2012-02-06 21:10:50 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ISO_LEVEL_CONCURRENCY,
|
|
|
|
ISO_LEVEL_CONSISTENCY,
|
|
|
|
ISO_LEVEL_READ_COMMITTED_REC_VERSION,
|
|
|
|
ISO_LEVEL_READ_COMMITTED_NO_REC_VERSION
|
|
|
|
};
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
static const unsigned LOCK_MODE_SHARED = 0x1;
|
|
|
|
static const unsigned LOCK_MODE_PROTECTED = 0x2;
|
|
|
|
static const unsigned LOCK_MODE_READ = 0x4;
|
|
|
|
static const unsigned LOCK_MODE_WRITE = 0x8;
|
|
|
|
|
2012-02-06 21:10:50 +01:00
|
|
|
public:
|
|
|
|
explicit SetTransactionNode(MemoryPool& pool)
|
2012-02-25 20:56:37 +01:00
|
|
|
: TransactionNode(pool),
|
2012-04-25 03:42:47 +02:00
|
|
|
reserveList(pool),
|
2012-02-25 20:56:37 +01:00
|
|
|
tpb(pool)
|
2012-02-06 21:10:50 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const
|
2012-02-06 21:10:50 +01:00
|
|
|
{
|
|
|
|
text = "SetTransactionNode";
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual SetTransactionNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
2012-02-25 20:56:37 +01:00
|
|
|
virtual void execute(thread_db* tdbb, dsql_req* request, jrd_tra** transaction) const;
|
2012-02-06 21:10:50 +01:00
|
|
|
|
|
|
|
private:
|
2012-04-25 03:42:47 +02:00
|
|
|
void genTableLock(DsqlCompilerScratch* dsqlScratch, const RestrictionOption& tblLock,
|
|
|
|
USHORT lockLevel);
|
2012-02-06 21:10:50 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
Nullable<bool> readOnly;
|
|
|
|
Nullable<bool> wait;
|
|
|
|
Nullable<unsigned> isoLevel;
|
|
|
|
Nullable<bool> noAutoUndo;
|
|
|
|
Nullable<bool> ignoreLimbo;
|
|
|
|
Nullable<bool> restartRequests;
|
|
|
|
Nullable<USHORT> lockTimeout;
|
2012-04-25 03:42:47 +02:00
|
|
|
Firebird::Array<RestrictionOption*> reserveList;
|
2012-02-25 20:56:37 +01:00
|
|
|
Firebird::UCharBuffer tpb;
|
2012-02-06 21:10:50 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-03-04 02:47:49 +01:00
|
|
|
class UpdateOrInsertNode : public TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_UPDATE_OR_INSERT>
|
|
|
|
{
|
|
|
|
public:
|
2012-01-24 04:37:43 +01:00
|
|
|
explicit UpdateOrInsertNode(MemoryPool& pool)
|
2011-03-04 02:47:49 +01:00
|
|
|
: TypedNode<DsqlOnlyStmtNode, StmtNode::TYPE_UPDATE_OR_INSERT>(pool),
|
2012-05-03 18:43:29 +02:00
|
|
|
relation(NULL),
|
|
|
|
fields(pool),
|
|
|
|
values(NULL),
|
|
|
|
matching(pool),
|
|
|
|
returning(NULL)
|
2011-03-04 02:47:49 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-04-25 03:42:47 +02:00
|
|
|
virtual void print(Firebird::string& text) const;
|
2011-03-04 02:47:49 +01:00
|
|
|
virtual StmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
virtual void genBlr(DsqlCompilerScratch* dsqlScratch);
|
|
|
|
|
|
|
|
public:
|
2012-05-03 18:43:29 +02:00
|
|
|
NestConst<RelationSourceNode> relation;
|
|
|
|
Firebird::Array<NestConst<FieldNode> > fields;
|
|
|
|
NestConst<ValueListNode> values;
|
|
|
|
Firebird::Array<NestConst<FieldNode> > matching;
|
|
|
|
NestConst<ReturningClause> returning;
|
2011-03-04 02:47:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-05-19 15:47:48 +02:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif // DSQL_STMT_NODES_H
|