📄 pfibscripter.pas
字号:
{***************************************************************}
{ FIBPlus - component library for direct access to Firebird and }
{ InterBase databases }
{ }
{ FIBPlus is based in part on the product }
{ Free IB Components, written by Gregory H. Deatz for }
{ Hoagland, Longo, Moran, Dunst & Doukas Company. }
{ mailto:gdeatz@hlmdd.com }
{ }
{ Copyright (c) 1998-2007 Devrace Ltd. }
{ Written by Serge Buzadzhy (buzz@devrace.com) }
{ }
{ ------------------------------------------------------------- }
{ FIBPlus home page: http://www.fibplus.com/ }
{ FIBPlus support : http://www.devrace.com/support/ }
{ ------------------------------------------------------------- }
{ }
{ Please see the file License.txt for full license information }
{***************************************************************}
unit pFIBScripter;
interface
{$I FIBPlus.inc}
{$IFDEF D6+}
{$A2}
{$ENDIF}
uses SysUtils,Classes{$IFDEF D6+},Types{$ENDIF}
,pFIBDatabase,pFIBQuery,FIBQuery,fib
;
//{$DEFINE BEZBAZY}
type
TStmtType = (sUnknown,sInvalid,sDML,
sConnect, sDisconnect, sReconnect,
sCreateDatabase,sDropDatabase,
sCommit, sRollBack,
sCreate, sAlter,sRecreate, sDrop, sSet, sSetGenerator,sSetStatistics,sDescribe,sDeclare,
sComment,sGrant,sRunFromFile,sBatch {Temp Type},sBatchStart,sBatchExecute
);
TObjectType =
(otNone,otDatabase,otDomain,otTable,otView,otProcedure,otTrigger,
otFunction,otException,otGenerator,otIndex,
otConstraint, otFilter,otField,otParameter,otRole
);
TStmtCoord=record
X: Word;
Y: Integer;
end;
PStmtCoord=^TStmtCoord;
TStatementDesc = record
smdBegin:TStmtCoord;
smdEnd :TStmtCoord;
smtType :TStmtType;
objType :TObjectType;
objName :string;
// NoValid :boolean;
end;
PStatementDesc=^TStatementDesc;
TScriptMap= array of TStatementDesc;
TOnParseStmt = procedure(Sender: TObject;StatementNo: Integer; Coord:TStatementDesc;
SQLText:TStrings) of object;
TpFIBScriptParser = class
private
FScript:TStrings;
FTemp :TStrings;
FCurDBName:string;
FMakeConnectInScript:boolean;
FHaveDMLStatements :boolean;
FHaveUnknownStatements:boolean;
function NextTokenPos(TokenPos:TStmtCoord; EndCoord:TStmtCoord ):TStmtCoord;
function GetToken(TokenPos:TStmtCoord;IgnoreQuote:boolean=True):string;
procedure SearchObjectType(var stmtDesc:TStatementDesc;var BegSearch:TStmtCoord;ForGrant:boolean=False);
function ValidateStatement(var stmtDesc:TStatementDesc;const NeedCheckCanEnd:boolean ):boolean; // 项赅琨忄弪 祛骓
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -