1 {-------------------------------------------------------------------------------
2 The contents of this file are subject to the Mozilla Public License
3 Version 1.1 (the "License"); you may not use this file except in compliance
4 with the License. You may obtain a copy of the License at
5 http://www.mozilla.org/MPL/
6 
7 Software distributed under the License is distributed on an "AS IS" basis,
8 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9 the specific language governing rights and limitations under the License.
10 
11 The Original Code is: SynHighlighterSQL.pas, released 2000-04-21.
12 The Original Code is based on the wmSQLSyn.pas and wmSybaseSyn.pas files from
13 the mwEdit component suite by Martin Waldenburg and other developers, the
14 Initial Author of these files is Willo van der Merwe. Initial Author of
15 SynHighlighterSQL.pas is Michael Hieke.
16 Portions created by Willo van der Merwe are Copyright 1999 Willo van der Merwe.
17 Portions created by Michael Hieke are Copyright 2000 Michael Hieke.
18 All Rights Reserved.
19 
20 Contributors to the SynEdit and mwEdit projects are listed in the
21 Contributors.txt file.
22 
23 Alternatively, the contents of this file may be used under the terms of the
24 GNU General Public License Version 2 or later (the "GPL"), in which case
25 the provisions of the GPL are applicable instead of those above.
26 If you wish to allow use of your version of this file only under the terms
27 of the GPL and not to allow others to use your version of this file
28 under the MPL, indicate your decision by deleting the provisions above and
29 replace them with the notice and other provisions required by the GPL.
30 If you do not delete the provisions above, a recipient may use your version
31 of this file under either the MPL or the GPL.
32 
33 $Id$
34 
35 You may retrieve the latest version of this file at the SynEdit home page,
36 located at http://SynEdit.SourceForge.net
37 
38 Known Issues:
39 -------------------------------------------------------------------------------}
40 {
41 @abstract(SQL highlighter for SynEdit with support for different dialects.)
42 @author(Michael Hieke)
43 @created(2000-04-21)
44 @lastmod(2000-11-16)
45 The SynHighlighterSQL implements a highlighter for SQL for the SynEdit projects.
46 Different SQL dialects can be selected via the Dialect property.
47 }
48 unit SynHighlighterSQL;
49 
50 {$I SynEdit.inc}
51 
52 interface
53 
54 uses
55   SysUtils, Classes,
56   LCLIntf, LCLType,
57   Controls, Graphics,
58   SynEditTypes, SynEditHighlighter, SynEditStrConst,
59   SynHighlighterHashEntries;
60 
61 type
62   TtkTokenKind = (tkComment, tkDatatype, tkDefaultPackage, tkException,         // DJLP 2000-08-11
tkIdentifiernull63     tkFunction, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, tkPLSQL,        // DJLP 2000-08-11
64     tkSQLPlus, tkString, tkSymbol, tkTableName, tkUnknown, tkVariable);         // DJLP 2000-08-11
65 
66   TRangeState = (rsUnknown, rsComment, rsString);
67 
68   TProcTableProc = procedure of object;
69 
70   TSQLDialect = (sqlStandard, sqlInterbase6, sqlMSSQL7, sqlMySQL, sqlOracle,
71     sqlSybase, sqlIngres, sqlMSSQL2K, sqlPostgres, sqlSQLite,                                           // JJV 2000-11-16
72     sqlFirebird25, sqlFirebird30, sqlFirebird40);
73 
74 type
75   PIdentifierTable = ^TIdentifierTable;
76   TIdentifierTable = array[Char] of ByteBool;
77 
78   PHashTable = ^THashTable;
79   THashTable = array[Char] of Integer;
80 
81 type
82   TSynSQLSyn = class(TSynCustomHighlighter)
83   private
84     fRange: TRangeState;
85     fLine: PChar;
86     fLineNumber: Integer;
87     fProcTable: array[#0..#255] of TProcTableProc;
88     Run: LongInt;
89     fStringLen: Integer;
90     fToIdent: PChar;
91     fTokenPos: Integer;
92     fTokenID: TtkTokenKind;
93     fKeywords: TSynHashEntryList;
94     fTableNames: TStrings;
95     fDialect: TSQLDialect;
96     fCommentAttri: TSynHighlighterAttributes;
97     fDataTypeAttri: TSynHighlighterAttributes;
98     fDefaultPackageAttri: TSynHighlighterAttributes;                            // DJLP 2000-08-11
99     fExceptionAttri: TSynHighlighterAttributes;
100     fFunctionAttri: TSynHighlighterAttributes;
101     fIdentifierAttri: TSynHighlighterAttributes;
102     fKeyAttri: TSynHighlighterAttributes;
103     fNumberAttri: TSynHighlighterAttributes;
104     fPLSQLAttri: TSynHighlighterAttributes;                                     // DJLP 2000-08-11
105     fSpaceAttri: TSynHighlighterAttributes;
106     fSQLPlusAttri: TSynHighlighterAttributes;                                   // DJLP 2000-09-05
107     fStringAttri: TSynHighlighterAttributes;
108     fSymbolAttri: TSynHighlighterAttributes;
109     fTableNameAttri: TSynHighlighterAttributes;
110     fVariableAttri: TSynHighlighterAttributes;
111     fIdentifiersPtr: PIdentifierTable;
112     fmHashTablePtr: PHashTable;
KeyHashnull113     function KeyHash(ToHash: PChar): Integer;
KeyCompnull114     function KeyComp(const aKey: string): Boolean;
115     procedure AndSymbolProc;
116     procedure AsciiCharProc;
117     procedure CRProc;
118     procedure EqualProc;
119     procedure GreaterProc;
120     procedure IdentProc;
121     procedure LFProc;
122     procedure LowerProc;
123     procedure MinusProc;
124     procedure NullProc;
125     procedure NumberProc;
126     procedure OrSymbolProc;
127     procedure PlusProc;
128     procedure SlashProc;
129     procedure SpaceProc;
130     procedure StringProc;
131     procedure SymbolProc;
132     procedure SymbolAssignProc;
133     procedure VariableProc;
134     procedure UnknownProc;
IdentKindnull135     function IdentKind(MayBe: PChar): TtkTokenKind;
136     procedure MakeMethodTables;
137     procedure AnsiCProc;
138     procedure DoAddKeyword(AKeyword: string; AKind: integer);
139     procedure SetDialect(Value: TSQLDialect);
140     procedure SetTableNames(const Value: TStrings);
141     procedure TableNamesChanged(Sender: TObject);
142     procedure InitializeKeywordLists;
143     procedure PutTableNamesInKeywordList;
144   protected
GetIdentCharsnull145     function GetIdentChars: TSynIdentChars; override;
GetSampleSourcenull146     function GetSampleSource : String; override;
147   public
GetLanguageNamenull148     class function GetLanguageName: string; override;
149   public
150     constructor Create(AOwner: TComponent); override;
151     destructor Destroy; override;
152     procedure Assign(Source: TPersistent); override;
GetDefaultAttributenull153     function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
154       override;
GetEolnull155     function GetEol: Boolean; override;
GetRangenull156     function GetRange: Pointer; override;
GetTokennull157     function GetToken: string; override;
158     procedure GetTokenEx(out TokenStart: PChar; out TokenLength: integer); override;
159 
GetTokenAttributenull160     function GetTokenAttribute: TSynHighlighterAttributes; override;
GetTokenIDnull161     function GetTokenID: TtkTokenKind;
GetTokenKindnull162     function GetTokenKind: integer; override;
GetTokenPosnull163     function GetTokenPos: Integer; override;
IsKeywordnull164     function IsKeyword(const AKeyword: string): boolean; override;              // DJLP 2000-08-09
165     procedure Next; override;
166     procedure ResetRange; override;
167     procedure SetLine(const NewValue: string; LineNumber: Integer); override;
168     procedure SetRange(Value: Pointer); override;
169   published
170     property CommentAttri: TSynHighlighterAttributes read fCommentAttri
171       write fCommentAttri;
172     property DataTypeAttri: TSynHighlighterAttributes read fDataTypeAttri
173       write fDataTypeAttri;
174     property DefaultPackageAttri: TSynHighlighterAttributes                     // DJLP 2000-08-11
175       read fDefaultPackageAttri write fDefaultPackageAttri;
176     property ExceptionAttri: TSynHighlighterAttributes read fExceptionAttri
177       write fExceptionAttri;
178     property FunctionAttri: TSynHighlighterAttributes read fFunctionAttri
179       write fFunctionAttri;
180     property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
181       write fIdentifierAttri;
182     property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
183     property NumberAttri: TSynHighlighterAttributes read fNumberAttri
184       write fNumberAttri;
185     property PLSQLAttri: TSynHighlighterAttributes read fPLSQLAttri             // DJLP 2000-08-11
186       write fPLSQLAttri;
187     property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
188       write fSpaceAttri;
189     property SQLPlusAttri: TSynHighlighterAttributes read fSQLPlusAttri         // DJLP 2000-09-05
190       write fSQLPlusAttri;
191     property StringAttri: TSynHighlighterAttributes read fStringAttri
192       write fStringAttri;
193     property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
194       write fSymbolAttri;
195     property TableNameAttri: TSynHighlighterAttributes read fTableNameAttri
196       write fTableNameAttri;
197     property TableNames: TStrings read fTableNames write SetTableNames;
198     property VariableAttri: TSynHighlighterAttributes read fVariableAttri
199       write fVariableAttri;
200     property SQLDialect: TSQLDialect read fDialect write SetDialect;
201   end;
202 
203 implementation
204 
205 var
206   Identifiers: TIdentifierTable;
207   mHashTable: THashTable;
208 
209   IdentifiersMSSQL7: TIdentifierTable;
210   mHashTableMSSQL7: THashTable;
211 
212 const
213   //---SQLite keywords------------------------------------------------------------
214   SQLiteKW: string =
215     'abort,action,add,after,all,alter,analyze,and,as,asc,attach,autoincrement,' +
216     'before,begin,between,by,cascade,case,cast,check,collate,column,commit,' +
217     'conflict,constraint,create,cross,current_date,current_time,current_timestamp,' +
218     'database,default,deferrable,deferred,delete,desc,detach,distinct,drop,each,else,' +
219     'end,escape,except,exclusive,exists,explain,fail,for,foreign,from,full,glob,group,' +
220     'having,if,ignore,immediate,in,index,indexed,initially,inner,insert,instead,intersect,' +
221     'into,is,isnull,join,key,left,like,limit,match,natural,no,not,notnull,null,of,offset,on,' +
222     'or,order,outer,plan,pragma,primary,query,raise,references,regexp,reindex,release,rename,' +
223     'replace,restrict,right,rollback,row,savepoint,select,set,table,temp,temporary,then,to,' +
224     'transaction,trigger,union,unique,update,using,vacuum,values,view,virtual,when,where';
225 
226   SQLiteTypes: string =
227     'int,integer,tinyint,smallint,mediumint,bigint,int2,int8,character,varchar,' +
228     'nchar,,nvarchar,text,clob,blob,real,double,float,numeric,decimal,boolean,' +
229     'date,datetime';
230 
231   SQLiteFunctions: string =
232     'abs,avg,changes,coalesce,count,group_concat,hex,ifnull,' +
233     'julianday,last_insert_rowid,length,load_extension,lower,ltrim,max,min,' +
234     'nullif,quote,random,randomblob,round,rtrim,soundex,sqlite_compileoption_get,' +
235     'sqlite_compileoption_used,sqlite_source_id,sqlite_version,strftim,substr,sum,time,' +
236     'total,total_changes,trim,typeof,upper,zeroblob';
237 
238 //---"Standard" (ANSI SQL keywords (Version 1, 2 and 3) (www.sql.org)---------
239   StandardKW: string =
240     'absolute,action,active,actor,add,after,alias,all,allocate,alter,' +
241     'and,any,are,as,asc,ascending,assertion,async,at,attributes,auto,' +
242     'base_name,before,begin,between,bit,bit_length,boolean,both,breadth,by,' +
243     'cache,call,cascade,cascaded,case,cast,catalog,char_length,' +
244     'character_length,check,coalesce,collate,collation,column,commit,' +
245     'committed,completion,computed,conditional,connect,connection,constraint,' +
246     'constraints,containing,convert,corresponding,count,create,cross,current,' +
247     'current_date,current_path,current_time,current_timestamp,current_user,' +
248     'cursor,cycle,data,database,date,day,deallocate,debug,declare,default,' +
249     'deferrable,deferred,delete,depth,desc,descending,describe,descriptor,' +
250     'destroy,diagnostics,dictionary,disconnect,distinct,do,domain,' +
251     'drop,each,element,else,elseif,end,end-exec,entry_point,equals,escape,' +
252     'except,exception,execute,exists,exit,external,extract,factor,false,' +
253     'filter,first,for,foreign,from,full,function,general,generator,get,' +
254     'global,grant,group,having,hold,hour,identity,if,ignore,immediate,in,' +
255     'inactive,index,initially,inner,input,insensitive,insert,instead,' +
256     'intersect,interval,into,is,isolation,join,key,last,leading,leave,left,' +
257     'less,level,like,limit,list,local,loop,lower,match,merge,minute,modify,' +
258     'month,names,national,natural,nchar,new,new_table,next,no,none,not,null,' +
259     'nullif,object,octet_length,of,off,old,old_table,on,only,operation,' +
260     'operator,operators,or,order,others,outer,output,overlaps,pad,' +
261     'parameter,parameters,partial,password,path,pendant,plan,position,' +
262     'postfix,prefix,preorder,prepare,preserve,primary,prior,private,' +
263     'privileges,procedure,protected,read,recursive,ref,referencing,relative,' +
264     'replace,resignal,restrict,retain,return,returns,revoke,right,role,' +
265     'rollback,routine,row,rows,savepoint,schema,scroll,search,second,select,' +
266     'sensitive,sequence,session,session_user,set,shadow,shared,signal,' +
267     'similar,size,snapshot,some,space,sqlexception,sqlstate,sqlwarning,start,' +
268     'state,structure,substring,suspend,symbol,system_user,table,temporary,' +
269     'term,test,then,there,time,timestamp,timezone_hour,timezone_minute,to,' +
270     'trailing,transaction,translate,translation,trigger,trim,true,tuple,type,' +
271     'uncommitted,under,union,unique,unknown,update,upper,usage,user,using,' +
272     'value,varchar,variable,varying,view,virtual,visible,wait,when,where,' +
273     'while,with,without,work,write,year,zone';
274 
275 //---Sybase keywords------------------------------------------------------------
276   SybaseKW: string =
277     'absolute,action,add,after,alias,all,allocate,alter,and,any,are,' +
278     'arith_overflow,as,asc,assertion,async,at,authorization,avg,before,begin,' +
279     'between,bit,bit_length,boolean,both,breadth,break,browse,bulk,by,call,' +
280     'cascade,cascaded,case,cast,catalog,char,char_convert,char_length,' +
281     'character,character_length,check,checkpoint,close,clustered,coalesce,' +
282     'collate,collation,column,commit,completion,compute,confirm,' +
283     'connect,connection,constraint,constraints,continue,controlrow,convert,' +
284     'corresponding,count,create,cross,current,current_date,current_time,' +
285     'current_timestamp,current_user,cursor,cycle,data,database,date,day,dbcc,' +
286     'deallocate,dec,decimal,declare,default,deferrable,deferred,delete,depth,' +
287     'desc,describe,descriptor,diagnostics,dictionary,dis,disconnect,distinct,' +
288     'domain,double,drop,dummy,dump,each,else,elseif,en,end,endtran,equals,' +
289     'errlvl,errordata,errorexit,escape,except,exception,exclusive,exec,' +
290     'execute,exists,exit,exp_row_size,external,extract,false,fetch,' +
291     'fillfactor,first,float,for,foreign,found,from,full,general,get,global,' +
292     'go,goto,grant,group,having,holdlock,hour,identity,identity_gap,' +
293     'identity_insert,identity_start,if,ignore,immediate,in,index,indicator,' +
294     'initially,inner,input,insensitive,insert,install,int,integer,intersect,' +
295     'interval,into,is,isolation,jar,join,key,kill,language,last,leading,' +
296     'leave,left,less,level,like,limit,lineno,load,local,lock,loop,lower,' +
297     'match,max,max_rows_per_page,min,minute,mirror,mirrorexit,modify,module,' +
298     'month,names,national,natural,nchar,new,next,no,noholdlock,nonclustered,' +
299     'none,not,null,nullif,numeric,numeric_truncation,object,' +
300     'octet_length,of,off,offsets,oid,old,on,once,online,only,open,operation,' +
301     'operators,option,or,order,others,outer,output,over,overlaps,pad,' +
302     'parameters,partial,partition,pendant,perm,permanent,plan,position,' +
303     'precision,preorder,prepare,preserve,primary,print,prior,private,' +
304     'privileges,proc,procedure,processexit,protected,proxy_table,public,' +
305     'quiesce,raiserror,read,readpast,readtext,real,reconfigure,recursive,' +
306     'ref,reference,referencing,relative,remove,reorg,replace,replication,' +
307     'reservepagegap,resignal,restrict,return,returns,revoke,right,role,' +
308     'rollback,routine,row,rowcount,rows,rule,save,savepoint,schema,scroll,' +
309     'search,second,section,select,sensitive,sequence,session_user,set,' +
310     'setuser,shared,shutdown,signal,similar,size,smallint,some,space,sql,' +
311     'sqlcode,sqlerror,sqlexception,sqlstate,statistics,stripe,structure,' +
312     'substring,sum,syb_identity,syb_restree,system_user,table,temp,temporary,' +
313     'test,textsize,then,there,time,timestamp,timezone_hour,timezone_minute,' +
314     'to,trailing,tran,transaction,translate,translation,trigger,trim,true,' +
315     'truncate,tsequal,type,under,union,unique,unknown,unpartition,update,' +
316     'upper,usage,use,user,user_option,using,value,values,varchar,variable,' +
317     'varying,view,virtual,visible,wait,waitfor,when,whenever,where,while,' +
318     'with,without,work,write,writetext,year,zone';
319 
320 //---Oracle---------------------------------------------------------------------
321   // Oracle SQL keywords
322   OracleKW: string =
323     'ACCESS,ACCESSED,ACCOUNT,ACTIVATE,ACTIVE_INSTANCE_COUNT,ADD,ADMIN,ADVISE,' +
324     'AGENT,ALL,ALLOCATE,ALTER,ANALYZE,ANCILLARY,AND,ANY,AQ_TM_PROCESSES,' +
325     'ARCHIVE_LAG_TARGET,ARCHIVELOG,AS,ASC,ASSOCIATE,ATTRIBUTES,AUDIT,' +
326     'AUDIT_FILE_DEST,AUDIT_SYS_OPERATIONS,AUDIT_TRAIL,AUTHENTICATED,AUTHID,' +
327     'AUTOALLOCATE,AUTOEXTEND,AUTOMATIC,BACKGROUND_CORE_DUMP,' +
328     'BACKGROUND_DUMP_DEST,BACKUP,BACKUP_TAPE_IO_SLAVES,BECOME,BEFORE,' +
329     'BEHALF,BETWEEN,BINDING,BITMAP,BITMAP_MERGE_AREA_SIZE,BLANK_TRIMMING,' +
330     'BLOCK,BLOCKSIZE,BUFFER_POOL,BUFFER_POOL_KEEP,BUFFER_POOL_RECYCLE,BY,' +
331     'CACHE,CANCEL,CASCADE,CAST,CATEGORY,CHAINED,CHANGE,CHARACTER,CHECK,' +
332     'CHECKPOINT,CHILD,CHUNK,CIRCUITS,CLASS,CLONE,CLUSTER,CLUSTER_DATABASE,' +
333     'CLUSTER_DATABASE_INSTANCES,CLUSTER_INTERCONNECTS,COALESCE,COBOL,' +
334     'COLUMN,COLUMNS,COMMENT,COMMIT_POINT_STRENGTH,COMPATIBLE,COMPILE,' +
335     'COMPLETE,COMPOSITE_LIMIT,COMPRESS,COMPUTE,CONNECT,' +
336     'CONNECT_TIME,CONSIDER,CONSTRAINT,CONSTRAINTS,CONTENTS,CONTEXT,CONTINUE,' +
337     'CONTROL,CONTROL_FILE_RECORD_KEEP_TIME,CONTROL_FILES,CONTROLFILE,' +
338     'CORE_DUMP_DEST,COST,CPU_COUNT,CPU_PER_CALL,CPU_PER_SESSION,CREATE,' +
339     'CREATE_BITMAP_AREA_SIZE,CREATE_STORED_OUTLINES,CURRENT,CURRENT_USER,' +
340     'CURSOR_SHARING,CURSOR_SPACE_FOR_TIME,CYCLE,DANGLING,DATAFILE,' +
341     'DB_BLOCK_BUFFERS,DB_BLOCK_CHECKING,DB_BLOCK_CHECKSUM,DB_BLOCK_SIZE,' +
342     'DB_CACHE_ADVICE,DB_CACHE_SIZE,DB_CREATE_FILE_DEST,DB_DOMAIN,' +
343     'DB_FILE_MULTIBLOCK_READ_COUNT,DB_FILE_NAME_CONVERT,DB_FILES,' +
344     'DB_KEEP_CACHE_SIZE,DB_NAME,DB_RECYCLE_CACHE_SIZE,DB_WRITER_PROCESSES,' +
345     'DBLINK_ENCRYPT_LOGIN,DBWR_IO_SLAVES,DEALLOCATE,DEBUG,DEFAULT,DEFERRED,' +
346     'DEFINER,DELETE,DEMAND,DETERMINES,DG_BROKER_START,DICTIONARY,DIMENSION,' +
347     'DIRECTORY,DISABLE,DISASSOCIATE,DISK_ASYNCH_IO,DISMOUNT,DISPATCHERS,' +
348     'DISTINCT,DISTRIBUTED,DISTRIBUTED_LOCK_TIMEOUT,DML,DML_LOCKS,DOCUMENT,' +
349     'DROP,DRS_START,ELSE,ENABLE,ENQUEUE_RESOURCES,ESCAPE,ESTIMATE,EVENT,' +
350     'EVENTS,EXCEPT,EXCEPTIONS,EXCHANGE,EXCLUDING,EXCLUSIVE,EXISTS,EXPIRE,' +
351     'EXPLAIN,EXTENT,EXTERNALLY,FAILED_LOGIN_ATTEMPTS,FAL_CLIENT,FAL_SERVER,' +
352     'FAST,FAST_START_IO_TARGET,FAST_START_MTTR_TARGET,' +
353     'FAST_START_PARALLEL_ROLLBACK,FILE,FILE_MAPPING,FILESYSTEMIO_OPTIONS,' +
354     'FIXED_DATE,FLUSH,FOR,FORCE,FOREIGN,FORTRAN,FREELIST,FREELISTS,FRESH,' +
355     'FROM,FROM_TZ,FUNCTIONS,GC_FILES_TO_LOCKS,GENERATED,GLOBAL,' +
356     'GLOBAL_CONTEXT_POOL_SIZE,GLOBAL_NAME,GLOBAL_NAMES,GLOBALLY,GO,GRANT,' +
357     'GROUP,GROUPS,HASH,HASH_AREA_SIZE,HASH_JOIN_ENABLED,HASHKEYS,HAVING,HEAP,' +
358     'HI_SHARED_MEMORY_ADDRESS,HIERARCHY,HS_AUTOREGISTER,IDENTIFIED,IDLE_TIME,' +
359     'IFILE,IMMEDIATE,IN,INCLUDING,INCREMENT,INDEX,INDEXTYPE,INDEXTYPES,' +
360     'INFILE,INITIAL,INITIALIZED,INITIALLY,INITRANS,INSERT,INSTANCE,' +
361     'INSTANCE_GROUPS,INSTANCE_NAME,INSTANCE_NUMBER,INT,INTERSECT,INTO,' +
362     'INVALIDATE,IS,ISOLATION,JAVA,JAVA_MAX_SESSIONSPACE_SIZE,JAVA_POOL_SIZE,' +
363     'JAVA_SOFT_SESSIONSPACE_LIMIT,JOB_QUEUE_PROCESSES,JOIN,KEEP,KEY,KILL,' +
364     'LARGE_POOL_SIZE,LAYERLISTS,LEVEL,LIBRARY,LICENSE_MAX_SESSIONS,' +
365     'LICENSE_MAX_USERS,LICENSE_SESSIONS_WARNING,LIKE,LIMIT,LINK,LIST,LOB,' +
366     'LOCAL,LOCAL_LISTENER,LOCATOR,LOCK,LOCK_NAME_SPACE,LOCK_SGA,' +
367     'LOG_ARCHIVE_DEST,LOG_ARCHIVE_DUPLEX_DEST,LOG_ARCHIVE_FORMAT,' +
368     'LOG_ARCHIVE_MAX_PROCESSES,LOG_ARCHIVE_MIN_SUCCEED_DEST,' +
369     'LOG_ARCHIVE_START,LOG_ARCHIVE_TRACE,LOG_BUFFER,LOG_CHECKPOINT_INTERVAL,' +
370     'LOG_CHECKPOINT_TIMEOUT,LOG_CHECKPOINTS_TO_ALERT,LOG_FILE_NAME_CONVERT,' +
371     'LOG_PARALLELISM,LOGFILE,LOGGING,LOGICAL_READS_PER_CALL,' +
372     'LOGICAL_READS_PER_SESSION,LOGMNR_MAX_PERSISTENT_SESSIONS,MANAGE,MANAGED,' +
373     'MANUAL,MAP,MASTER,MATCHED,MATERIALIZED,MAX_COMMIT_PROPAGATION_DELAY,' +
374     'MAX_DISPATCHERS,MAX_DUMP_FILE_SIZE,MAX_ENABLED_ROLES,' +
375     'MAX_ROLLBACK_SEGMENTS,MAX_SHARED_SERVERS,MAXDATAFILES,MAXEXTENTS,' +
376     'MAXINSTANCES,MAXLOGFILES,MAXLOGHISTORY,MAXLOGMEMBERS,MAXSIZE,MAXTRANS,' +
377     'MAXVALUE,MEMBER,MINEXTENTS,MINIMIZE,MINIMUM,MINUS,MINVALUE,MODE,MODIFY,' +
378     'MODULE,MONITORING,MOUNT,MOVE,MOVEMENT,MULTISET,NAMED,NATIONAL,NESTED,' +
379     'NEVER,NEXT,NLS_CALENDAR,NLS_COMP,NLS_CURRENCY,NLS_DATE_FORMAT,' +
380     'NLS_DATE_LANGUAGE,NLS_DUAL_CURRENCY,NLS_ISO_CURRENCY,NLS_LANGUAGE,' +
381     'NLS_LENGTH_SEMANTICS,NLS_NCHAR_CONV_EXCP,NLS_NUMERIC_CHARACTERS,' +
382     'NLS_TERRITORY,NLS_TIMESTAMP_FORMAT,NLS_TIMESTAMP_TZ_FORMAT,NO,' +
383     'NOARCHIVELOG,NOAUDIT,NOCACHE,NOCOMPRESS,NOCOPY,NOCYCLE,NOFORCE,' +
384     'NOLOGGING,NOMAXVALUE,NOMINIMIZE,NOMINVALUE,NOMONITORING,NONE,' +
385     'NOORDER,NORELY,NORESETLOGS,NOREVERSE,NORMAL,NOROWDEPENDENCIES,NOSORT,' +
386     'NOT,NOTHING,NOVALIDATE,NOWAIT,NULL,O7_DICTIONARY_ACCESSIBILITY,' +
387     'OBJECT_CACHE_MAX_SIZE_PERCENT,OBJECT_CACHE_OPTIMAL_SIZE,OF,OFFLINE,OID,' +
388     'OLAP_PAGE_POOL_SIZE,ON,ONLINE,ONLY,OPEN_CURSORS,OPEN_LINKS,' +
389     'OPEN_LINKS_PER_INSTANCE,OPERATOR,OPTIMAL,OPTIMIZER_DYNAMIC_SAMPLING,' +
390     'OPTIMIZER_FEATURES_ENABLE,OPTIMIZER_INDEX_CACHING,' +
391     'OPTIMIZER_INDEX_COST_ADJ,OPTIMIZER_MAX_PERMUTATIONS,OPTIMIZER_MODE,' +
392     'OPTION,OR,ORACLE_TRACE_COLLECTION_NAME,ORACLE_TRACE_COLLECTION_PATH,' +
393     'ORACLE_TRACE_COLLECTION_SIZE,ORACLE_TRACE_ENABLE,' +
394     'ORACLE_TRACE_FACILITY_NAME,ORACLE_TRACE_FACILITY_PATH,ORDER,' +
395     'OS_AUTHENT_PREFIX,OS_ROLES,OUTLINE,OVERFLOW,OWN,PACKAGES,PARALLEL,' +
396     'PARALLEL_ADAPTIVE_MULTI_USER,PARALLEL_AUTOMATIC_TUNING,' +
397     'PARALLEL_EXECUTION_MESSAGE_SIZE,PARALLEL_INSTANCE_GROUP,' +
398     'PARALLEL_MAX_SERVERS,PARALLEL_MIN_PERCENT,PARALLEL_MIN_SERVERS,' +
399     'PARALLEL_THREADS_PER_CPU,PARAMETERS,PARTITION_VIEW_ENABLED,PARTITIONS,' +
400     'PASSWORD,PASSWORD_GRACE_TIME,PASSWORD_LIFE_TIME,PASSWORD_LOCK_TIME,' +
401     'PASSWORD_REUSE_MAX,PASSWORD_REUSE_TIME,PASSWORD_VERIFY_FUNCTION,' +
402     'PCTFREE,PCTINCREASE,PCTTHRESHOLD,PCTUSED,PCTVERSION,PERCENT,PERMANENT,' +
403     'PGA_AGGREGATE_TARGET,PIPELINED,PLAN,PLI,PLSQL_COMPILER_FLAGS,' +
404     'PLSQL_NATIVE_C_COMPILER,PLSQL_NATIVE_LIBRARY_DIR,' +
405     'PLSQL_NATIVE_LIBRARY_SUBDIR_COUNT,PLSQL_NATIVE_LINKER,' +
406     'PLSQL_NATIVE_MAKE_FILE_NAME,PLSQL_NATIVE_MAKE_UTILITY,' +
407     'PLSQL_V2_COMPATIBILITY,POST_TRANSACTION,PRE_PAGE_SGA,PREBUILD,PRECISION,' +
408     'PRIMARY,PRIOR,PRIVATE_SGA,PRIVILEGES,PROCESSES,PROFILE,PUBLIC,QUERY,' +
409     'QUERY_REWRITE_ENABLED,QUERY_REWRITE_INTEGRITY,QUIESCE,QUOTA,' +
410     'RDBMS_SERVER_DN,READ,READ_ONLY_OPEN_DELAYED,REBUILD,RECORDS_PER_BLOCK,' +
411     'RECOVER,RECOVERABLE,RECOVERY,RECOVERY_PARALLELISM,RECYCLE,REDUCED,' +
412     'REFERENCES,REFRESH,REGISTER,RELY,REMOTE_ARCHIVE_ENABLE,' +
413     'REMOTE_DEPENDENCIES_MODE,REMOTE_LISTENER,REMOTE_LOGIN_PASSWORDFILE,' +
414     'REMOTE_OS_AUTHENT,REMOTE_OS_ROLES,RENAME,' +
415     'REPLICATION_DEPENDENCY_TRACKING,RESET,RESETLOGS,RESIZE,RESOLVE,RESOLVER,' +
416     'RESOURCE,RESOURCE_LIMIT,RESOURCE_MANAGER_PLAN,RESTRICT,RESTRICTED,' +
417     'RESUMABLE,RESUME,REUSE,REVOKE,REWRITE,RNDS,RNPS,ROLE,ROLES,' +
418     'ROLLBACK_SEGMENTS,ROW,ROW_LOCKING,ROWDEPENDENCIES,ROWLABEL,ROWNUM,' +
419     'ROWS,SAMPLE,SCN,SCOPE,SECTION,SEGMENT,SELECT,SELECTIVITY,SEQUENCE,' +
420     'SERIAL_REUSE,SERVICE_NAMES,SESSION,SESSION_CACHED_CURSORS,' +
421     'SESSION_MAX_OPEN_FILES,SESSIONS,SESSIONS_PER_USER,SGA_MAX_SIZE,' +
422     'SHADOW_CORE_DUMP,SHARE,SHARED,SHARED_MEMORY_ADDRESS,SHARED_POOL,' +
423     'SHARED_POOL_RESERVED_SIZE,SHARED_POOL_SIZE,SHARED_SERVER_SESSIONS,' +
424     'SHARED_SERVERS,SHRINK,SIZE,SNAPSHOT,SOME,SORT,SORT_AREA_RETAINED_SIZE,' +
425     'SORT_AREA_SIZE,SOURCE,SPECIFICATION,SPECIFIED,SPFILE,SPLIT,SQL_TRACE,' +
426     'SQL92_SECURITY,STANDBY,STANDBY_ARCHIVE_DEST,STANDBY_FILE_MANAGEMENT,' +
427     'STAR_TRANSFORMATION_ENABLED,START,START_DATE,STATISTICS,' +
428     'STATISTICS_LEVEL,STOP,STORAGE,STRUCTURE,SUBPARTITION,SUBPARTITIONS,' +
429     'SUCCESSFUL,SUSPEND,SWITCH,SYNONYM,SYSTEM,TABLE,TABLESPACE,' +
430     'TAPE_ASYNCH_IO,TEMPFILE,TEMPORARY,THE,THEN,THREAD,THROUGH,TIME,' +
431     'TIMED_OS_STATISTICS,TIMED_STATISTICS,TIMEOUT,TO,TRACE_ENABLED,' +
432     'TRACEFILE_IDENTIFIER,TRACING,TRANSACTION,TRANSACTION_AUDITING,' +
433     'TRANSACTIONS,TRANSACTIONS_PER_ROLLBACK_SEGMENT,TRIGGER,TRUNCATE,TRUST,' +
434     'TYPES,UNARCHIVED,UNDER,UNDO,UNDO_MANAGEMENT,UNDO_RETENTION,' +
435     'UNDO_SUPPRESS_ERRORS,UNDO_TABLESPACE,UNIFORM,UNION,UNIQUE,UNLIMITED,' +
436     'UNLOCK,UNQUIESCE,UNRECOVERABLE,UNTIL,UNUSABLE,UNUSED,UPDATE,USAGE,' +
437     'USE_INDIRECT_DATA_BUFFERS,USER_DUMP_DEST,VALIDATE,VALIDATION,VALUES,' +
438     'VARGRAPHIC,VARRAY,VIEW,WHERE,WITH,WITHOUT,WNDS,WNPS,' +
439     'WORKAREA_SIZE_POLICY';
440 
441   // PLSQL keywords
442   OraclePLSQLKW: string =
443     'ABORT,ACCEPT,AFTER,ARRAY,ARRAYLEN,ASSERT,ASSIGN,AT,AUTHORIZATION,' +
444     'AUTONOMOUS_TRANSACTION,BASE_TABLE,BEGIN,BODY,BULK,BULK_ROWCOUNT,CALL,' +
445     'CALLING,CASE,CHAR_BASE,CHARSETFORM,CHARSETID,CLOSE,CLUSTERS,COLAUTH,' +
446     'COLLECT,COMMIT,CONNECTION,CONSTANT,COOKIE,COOKIE_TABLE,CRASH,CURRVAL,' +
447     'CURSOR,DATA_BASE,DATABASE,DBA,DEBUGOFF,DEBUGON,DECLARE,DEFINITION,' +
448     'DELAY,DELTA,DEQUEUE_OPTIONS_T,DETERMINISTIC,DIGITS,DISPOSE,DO,EACH,' +
449     'ELSIF,END,ENQUEUE_OPTIONS_T,ENTRY,EXCEPTION,EXCEPTION_INIT,EXIT,' +
450     'EXTERNAL,FALSE,FETCH,FIXED,FORALL,FORM,FOUND,FUNCTION,GENERIC,GOTO,IF,' +
451     'INDEXES,INDICATOR,INSTEAD,INTERFACE,ISOPEN,LANGUAGE,LCR$_DDL_RECORD,' +
452     'LCR$_ROW_LIST,LCR$_ROW_RECORD,LCR$_ROW_UNIT,LIMITED,LOOP,MAXLEN,' +
453     'MESSAGE_PROPERTIES_T,MGW_BASIC_MSG_T,MGW_MQSERIES_PROPERTIES,' +
454     'MGW_NAME_TYPE_ARRAY_T,MGW_NAME_VALUE_T,MGW_PROPERTIES,MGW_PROPERTY,' +
455     'MGW_RAW_VALUE_T,MGW_TEXT_VALUE_T,NAME,NEW,NEXTVAL,NOTFOUND,' +
456     'NUMBER_BASE,OLD,OPEN,OUT,PACKAGE,PARALLEL_ENABLE,PARTITION,PASCAL,' +
457     'PRAGMA,PRIVATE,PROCEDURE,RAISE,RANGE,RE$ATTRIBUTE_VALUE,' +
458     'RE$ATTRIBUTE_VALUE_LIST,RE$COLUMN_VALUE,RE$COLUMN_VALUE_LIST,' +
459     'RE$NAME_ARRAY,RE$NV_ARRAY,RE$NV_LIST,RE$NV_NODE,RE$RULE_HIT,' +
460     'RE$RULE_HIT_LIST,RE$TABLE_ALIAS,RE$TABLE_ALIAS_LIST,' +
461     'RE$TABLE_VALUE,RE$TABLE_VALUE_LIST,RE$VARIABLE_TYPE,' +
462     'RE$VARIABLE_TYPE_LIST,RE$VARIABLE_VALUE,RE$VARIABLE_VALUE_LIST,RECORD,' +
463     'REF,REFERENCING,RELEASE,REMR,REQ,RESP,RESTRICT_REFERENCES,RETURN,' +
464     'REVERSE,ROLLBACK,ROWCOUNT,ROWTYPE,RUNTIME_INFO,SAVEPOINT,SCHEMA,' +
465     'SELF,SEPARATE,SERIALLY_REUSABLE,SPACE,SQL,SQLERROR,STATEMENT,STRUCT,' +
466     'SUBTYPE,TABAUTH,TABLES,TASK,TDO,TERMINATE,TRUE,TYPE,USE,VARYING,VIEWS,' +
467     'WHEN,WHILE,WORK,WRITE,XOR';
468 
469   // Oracle data types
470   OracleTypes: string =
471     'ANYDATA,ANYDATASET,ANYTYPE,BFILE,BINARY_INTEGER,BLOB,BOOLEAN,CHAR,CLOB,' +
472     'DATE,DAY,DBURIType,DEC,DECIMAL,DOUBLE,FLOAT,HTTPURIType,INTEGER,LONG,' +
473     'MLSLABEL,MONTH,NATURAL,NATURALN,NCHAR,NCLOB,NUMBER,NUMERIC,' +
474     'NVARCHAR2,PLS_INTEGER,POSITIVE,POSITIVEN,RAW,REAL,ROWID,SECOND,SMALLINT,' +
475     'TIMESTAMP,URIType,UROWID,VARCHAR,VARCHAR2,XDBURIType,XMLDATA,XMLType,' +
476     'YEAR,ZONE';
477 
478   // Oracle built in exceptions
479   OracleExceptions: string =
480     'ACCESS_INTO_NULL,COLLECTION_IS_NULL,CURSOR_ALREADY_OPEN,' +
481     'DUP_VAL_ON_INDEX,INVALID_CURSOR,INVALID_NUMBER,LOGIN_DENIED,' +
482     'NO_DATA_FOUND,NOT_LOGGED_ON,OTHERS,PROGRAM_ERROR,ROWTYPE_MISMATCH,' +
483     'STORAGE_ERROR,SUBSCRIPT_BEYOND_COUNT,SUBSCRIPT_OUTSIDE_LIMIT,' +
484     'SYS_INVALID_ROWID,TIMEOUT_ON_RESOURCE,TOO_MANY_ROWS,VALUE_ERROR,' +
485     'ZERO_DIVIDE';
486 
487   // Oracle built in functions
488   OracleFunctions: string =
489     'ABS,ACOS,ADD_MONTHS,AGGREGATE,ANALYTIC,ASCII,ASCIISTR,ASIN,ATAN,ATAN2,' +
490     'AVERAGE,AVG,BASE64_DECODE,BASE64_ENCODE,BEGIN_REQUEST,BFILENAME,' +
491     'BIN_TO_NUM,BIT_AND,BIT_COMPLEMENT,BIT_OR,BIT_XOR,BITAND,' +
492     'CAST_FROM_BINARY_INTEGER,CAST_FROM_NUMBER,CAST_TO_BINARY_INTEGER,' +
493     'CAST_TO_NUMBER,CAST_TO_RAW,CAST_TO_VARCHAR2,CEIL,CHARTOROWID,CHR,' +
494     'COLUMN_PRESENT,COMPARE,COMPARE_TEMPLATES,COMPOSE,CONCAT,CONVERSION,' +
495     'CONVERT,CONVERT_ANYDATA_TO_LCR_DDL,CONVERT_ANYDATA_TO_LCR_ROW,' +
496     'COPIES,COPY_TEMPLATE,CORR,COS,COSH,COUNT,COVAR_POP,COVAR_SAMP,' +
497     'CREATE_OBJECT_FROM_EXISTING,CREATE_PIPE,CREATE_REFRESH_TEMPLATE,' +
498     'CREATE_TEMPLATE_OBJECT,CREATE_TEMPLATE_PARM,CREATE_USER_AUTHORIZATION,' +
499     'CREATE_USER_PARM_VALUE,CRLF,CUBE,CUME_DIST,CURRENT_DATE,' +
500     'CURRENT_INSTANCE,CURRENT_TIMESTAMP,DATA_BLOCK_ADDRESS_BLOCK,' +
501     'DATA_BLOCK_ADDRESS_FILE,DBTIMEZONE,DECODE,DECOMPOSE,DELETE_BREAKPOINT,' +
502     'DELETE_OER_BREAKPOINT,DENSE_RANK,DEPTH,DEREF,DISABLE_BREAKPOINT,' +
503     'DISABLED,DISPLAY,DROP_ALL,DROP_ELEMENT,DROP_FILE,DUMP,' +
504     'EMPTY_BLOB,EMPTY_CLOB,ENABLE_BREAKPOINT,EQUALS_PATH,ESTIMATE_CPU_UNITS,' +
505     'EXCLUDE_PUSH,EXECUTE_AND_FETCH,EXECUTE_NON_QUERY,EXISTSNODE,EXP,EXTEND,' +
506     'EXTRACT,EXTRACTVALUE,FCOPY,FETCH_ROW,FETCH_ROWS,FGETPOS,FILEEXISTS,' +
507     'FILEISOPEN,FIRST,FIRST_VALUE,FLOOR,FLUSH_DATA,FOPEN,FOPEN_NCHAR,' +
508     'FORMAT_CALL_STACK,FORMAT_ERROR_STACK,FREMOVE,FRENAME,FROM_REMOTE,FSEEK,' +
509     'GET_ARG_FORM,GET_ARG_TYPE,GET_COOKIE_COUNT,GET_COOKIES,' +
510     'GET_DETAILED_SQLCODE,GET_DETAILED_SQLERRM,GET_ERROR_MESSAGE,' +
511     'GET_HASH_VALUE,GET_HEADER_COUNT,GET_INDEXES,GET_INFORMATION,' +
512     'GET_OBJECT_NULL_VECTOR_ARG,GET_PARAMETER_VALUE,' +
513     'GET_PERSISTENT_CONN_COUNT,GET_RAW,GET_RESPONSE,GET_RUNTIME_INFO,' +
514     'GET_RUNTIME_PARM_ID,GET_SESSION_TIMEOUT,GET_SYSTEM_CHANGE_NUMBER,' +
515     'GET_TAG,GET_TIME,GET_TIMEOUT,GET_TIMEOUT_BEHAVIOR,GET_VALUE,' +
516     'GETCHUNKSIZE,GETLENGTH,GLB,GREATEST,GREATEST_LB,GROUP_ID,GROUPING,' +
517     'GROUPING_ID,HEXTORAW,I_AM_A_REFRESH,INITCAP,INITIALIZE,' +
518     'INSTANTIATE_OFFLINE,INSTANTIATE_ONLINE,INSTR,INSTRB,' +
519     'INTERNAL_VERSION_CHECK,IS_CLUSTER_DATABASE,IS_LOCATOR,IS_OPEN,' +
520     'IS_ROLE_ENABLED,IS_SESSION_ALIVE,IS_TRIGGER_FIRE_ONCE,ISTEMPORARY,LAG,' +
521     'LAST,LAST_DAY,LAST_ERROR_POSITION,LAST_ROW_COUNT,LAST_ROW_ID,' +
522     'LAST_SQL__CODE,LAST_VALUE,LEAD,LEAST,LEAST_LB,LENGTH,LENGTHB,LINEAR,LN,' +
523     'LOCAL_TRANSACTION_ID,LOCALTIMESTAMP,LOG,LOWER,LPAD,LTRIM,LUB,' +
524     'MAKE_DATA_BLOCK_ADDRESS,MAKE_REF,MAP_ALL,MAP_ELEMENT,MAP_FILE,' +
525     'MAP_OBJECT,MAX,MIN,MINE_VALUE,MISCELLANEOUS,MOD,MONTHS_BETWEEN,NCHR,' +
526     'NEW_TIME,NEXT_DAY,NEXT_ITEM_TYPE,NLS_CHARSET_DECL_LEN,NLS_CHARSET_ID,' +
527     'NLS_CHARSET_NAME,NLS_INITCAP,NLS_LOWER,NLS_SORT,NLS_UPPER,NLSSORT,NTILE,' +
528     'NULLIF,NUMTODSINTERVAL,NUMTOYMINTERVAL,NVARRAY_FIND_NAME,' +
529     'NVARRAY_FIND_NAME_TYPE,NVARRAY_GET,NVARRAY_GET_BOOLEAN,NVARRAY_GET_BYTE,' +
530     'NVARRAY_GET_DATE,NVARRAY_GET_DOUBLE,NVARRAY_GET_FLOAT,' +
531     'NVARRAY_GET_INTEGER,NVARRAY_GET_LONG,NVARRAY_GET_RAW,NVARRAY_GET_SHORT,' +
532     'NVARRAY_GET_TEXT,NVL,NVL2,OBJECT,OPEN_CURSOR,OVER,OVERLAY,PATH,' +
533     'PAUSE_PROFILER,PERCENT_RANK,PERCENTILE_CONT,PERCENTILE_DISC,PMARKER,' +
534     'PORT_STRING,POWER,PURGE,PUSH,PUT_RAW,QUOTED_PRINTABLE_DECODE,' +
535     'QUOTED_PRINTABLE_ENCODE,RANDOM,RANK,RATIO_TO_REPORT,RATION_TO_REPORT,' +
536     'RAWTOHEX,RAWTONHEX,RECEIVE_MESSAGE,REFERENCE,REFTOHEX,REGR_AVGX,' +
537     'REGR_AVGY,REGR_COUNT,REGR_INTERCEPT,REGR_R2,REGR_SLOPE,REGR_SXX,' +
538     'REGR_SXY,REGR_SYY,REGRESSION,REMOVE_PIPE,REPLACE,REPLICATION_IS_ON,' +
539     'REQUEST,REQUEST_PIECES,RESTORE,RESUME_PROFILER,RETURNING,ROLLUP,ROUND,' +
540     'ROW_NUMBER,ROWID_BLOCK_NUMBER,ROWID_CREATE,ROWID_OBJECT,' +
541     'ROWID_RELATIVE_FNO,ROWID_ROW_NUMBER,ROWID_TO_ABSOLUTE_FNO,' +
542     'ROWID_TO_EXTENDED,ROWID_TO_RESTRICTED,ROWID_TYPE,ROWID_VERIFY,' +
543     'ROWIDTOCHAR,ROWIDTONCHAR,RPAD,RTRIM,SEND_MESSAGE,SESSIONTIMEZONE,' +
544     'SET_BREAKPOINT,SET_OER_BREAKPOINT,SET_TIMEOUT,SET_VALUE,SIGN,SIN,SINH,' +
545     'SOUNDEX,SPACE_ERROR_INFO,SQLCODE,SQLERRM,SQRT,START_PROFILER,STDDEV,' +
546     'STDDEV_POP,STDDEV_SAMP,STDDEVP,STDDEVS,STEP_ID,STOP_PROFILER,SUBSTR,' +
547     'SUBSTRB,SUM,SYNCHRONIZE,SYS_CONNECT_BY_PATH,SYS_CONTEXT,SYS_DBURIGEN,' +
548     'SYS_EXTRACT_UTC,SYS_GUID,SYS_TYPEID,SYS_XMLAGG,SYS_XMLGEN,SYSDATE,' +
549     'SYSTIMESTAMP,TAN,TANH,TO_CHAR,TO_CLOB,TO_DATE,TO_DSINTERVAL,TO_LABEL,' +
550     'TO_LOB,TO_MULTI_BYTE,TO_NCHAR,TO_NCLOB,TO_NUMBER,TO_SINGLE_BYTE,' +
551     'TO_TIMESTAMP,TO_TIMESTAMP_TZ,TO_YMINTERVAL,TRANSLATE,TRANSLITERATE,' +
552     'TREAT,TRIM,TRUNC,TZ_OFFSET,UID,UNDER_PATH,UNESCAPE,UNIQUE_SESSION_ID,' +
553     'UNIQUE_SESSION_NAME,UNISTR,UPDATEXML,UPPER,USER,USERENV,USING,UUDECODE,' +
554     'UUENCODE,VALUE,VAR_POP,VAR_SAMP,VARIANCE,VARP,VARS,VSIZE,WIDTH_BUCKET,' +
555     'XMLAGG,XMLCOLATTVAL,XMLCONCAT,XMLELEMENT,XMLFOREST,XMLSEQUENCE,' +
556     'XMLTRANSFORM,XRANGE';
557 
558   OracleDefaultPackages: string =
559     'DBMS_ALERT,DBMS_APPLICATION_INFO,DBMS_APPLY_ADM,DBMS_AQ,' +
560     'DBMS_AQ_EXP_HISTORY_TABLES,DBMS_AQ_EXP_INDEX_TABLES,' +
561     'DBMS_AQ_EXP_QUEUE_TABLES,DBMS_AQ_EXP_QUEUES,' +
562     'DBMS_AQ_EXP_SUBSCRIBER_TABLES,DBMS_AQ_EXP_TIMEMGR_TABLES,' +
563     'DBMS_AQ_EXP_ZECURITY,DBMS_AQ_IMP_INTERNAL,DBMS_AQ_IMP_ZECURITY,' +
564     'DBMS_AQ_IMPORT_INTERNAL,DBMS_AQ_SYS_EXP_ACTIONS,' +
565     'DBMS_AQ_SYS_EXP_INTERNAL,DBMS_AQ_SYS_IMP_INTERNAL,DBMS_AQADM,' +
566     'DBMS_AQADM_SYS,DBMS_AQADM_SYSCALLS,DBMS_AQELM,DBMS_AQIN,' +
567     'DBMS_AQJMS,DBMS_BACKUP_RESTORE,DBMS_CAPTURE_ADM,DBMS_DDL,' +
568     'DBMS_DEBUG,DBMS_DEFER,DBMS_DEFER_IMPORT_INTERNAL,DBMS_DEFER_QUERY,' +
569     'DBMS_DEFER_SYS,DBMS_DESCRIBE,DBMS_DISTRIBUTED_TRUST_ADMIN,' +
570     'DBMS_EXPORT_EXTENSION,DBMS_FGA,DBMS_FLASHBACK,DBMS_HS_PASSTHROUGH,' +
571     'DBMS_IJOB,DBMS_INTERNAL_TRIGGER,DBMS_IOT,DBMS_IREFRESH,DBMS_ISNAPSHOT,' +
572     'DBMS_JAVA_TEST,DBMS_JOB,DBMS_LDAP,DBMS_LIBCACHE,DBMS_LOB,DBMS_LOCK,' +
573     'DBMS_LOGMNR,DBMS_LOGMNR_CDC_PUBLISH,DBMS_LOGMNR_CDC_SUBSCRIBE,' +
574     'DBMS_LOGMNR_D,DBMS_LOGSTDBY,DBMS_METADATA,DBMS_MGWADM,' +
575     'DBMS_MGWMSG,DBMS_MVIEW,DBMS_OBFUSCATION_TOOLKIT,DBMS_ODCI,' +
576     'DBMS_OFFLINE_OG,DBMS_OFFLINE_SNAPSHOT,DBMS_OLAP,' +
577     'DBMS_ORACLE_TRACE_AGENT,DBMS_ORACLE_TRACE_USER,DBMS_OUTLN,' +
578     'DBMS_OUTLN_EDIT,DBMS_OUTPUT,DBMS_PCLXUTIL,DBMS_PICKLER,DBMS_PIPE,' +
579     'DBMS_PITR,DBMS_PLUGTS,DBMS_PROFILER,DBMS_PROPAGATION_ADM,' +
580     'DBMS_PRVTAQIM,DBMS_PRVTAQIP,DBMS_PRVTAQIS,DBMS_PRVTRMIE,DBMS_PSP,' +
581     'DBMS_PSWMG_IMPORT,DBMS_RANDOM,DBMS_RCVMAN,DBMS_RECTIFIER_DIFF,' +
582     'DBMS_REDEFINITION,DBMS_REFRESH,DBMS_REFRESH_EXP_LWM,' +
583     'DBMS_REFRESH_EXP_SITES,DBMS_REPAIR,DBMS_REPCAT,DBMS_REPCAT_ADMIN,' +
584     'DBMS_REPCAT_AUTH,DBMS_REPCAT_INSTANTIATE,DBMS_REPCAT_RGT,DBMS_REPUTIL,' +
585     'DBMS_RESOURCE_MANAGER,DBMS_RESOURCE_MANAGER_PRIVS,DBMS_RESUMABLE,' +
586     'DBMS_RLS,DBMS_RMGR_GROUP_EXPORT,DBMS_RMGR_PACT_EXPORT,' +
587     'DBMS_RMGR_PLAN_EXPORT,DBMS_RMIN,DBMS_ROWID,DBMS_RULE,DBMS_RULE_ADM,' +
588     'DBMS_RULE_EXIMP,DBMS_SESSION,DBMS_SHARED_POOL,DBMS_SNAP_INTERNAL,' +
589     'DBMS_SNAP_REPAPI,DBMS_SNAPSHOT,DBMS_SNAPSHOT_UTL,DBMS_SPACE,' +
590     'DBMS_SPACE_ADMIN,DBMS_SQL,DBMS_STANDARD,DBMS_STATS,DBMS_STORAGE_MAP,' +
591     'DBMS_STREAMS,DBMS_STREAMS_ADM,DBMS_SUMADV,DBMS_SUMMARY,' +
592     'DBMS_SUMREF_CHILD,DBMS_SUMREF_PARENT,DBMS_SUMREF_UTIL,' +
593     'DBMS_SUMREF_UTIL2,DBMS_SUMVDM,DBMS_SYS_ERROR,DBMS_SYS_SQL,' +
594     'DBMS_SYSTEM,DBMS_TRACE,DBMS_TRANSACTION,DBMS_TRANSFORM,DBMS_TTS,' +
595     'DBMS_TYPES,DBMS_UTILITY,DBMS_WM,DBMS_XDB,DBMS_XDB_VERSION,DBMS_XDBT,' +
596     'DBMS_XMLDOM,DBMS_XMLGEN,DBMS_XMLPARSER,DBMS_XMLQUERY,' +
597     'DBMS_XMLSAVE,DBMS_XPLAN,DBMS_XSLPROCESSOR,DBMS_ZHELP,DBMS_ZHELP_IR,' +
598     'DBMSZEXP_SYSPKGGRNT,DEBUG_EXTPROC,DIANA,DIUTIL,ODCICONST,OUTLN_PKG,' +
599     'PBREAK,PBRPH,PBSDE,PBUTL,PIDL,PLITBLM,SDO_CS,SDO_GEOM,SDO_LRS,' +
600     'SDO_MIGRATE,SDO_TUNE,SDO_UTIL,STANDARD,SYS_STUB_FOR_PURITY_ANALYSIS,' +
601     'UTL_COLL,UTL_ENCODE,UTL_FILE,UTL_FILE_DIR,UTL_HTTP,UTL_INADDR,UTL_PG,' +
602     'UTL_RAW,UTL_REF,UTL_SMTP,UTL_TCP,UTL_URL';
603 
604   OracleSQLPlusCommands: string =
605     'APP,APPINFO,AQ$_AGENT,AQ$_AGENT_LIST_T,AQ$_DESCRIPTOR,AQ$_POST_INFO,' +
606     'AQ$_POST_INFO_LIST,AQ$_RECIPIENT_LIST_T,AQ$_REG_INFO,AQ$_REG_INFO_LIST,' +
607     'AQ$_SUBSCRIBER_LIST_T,ARCHIVE,ARRAYSIZE,ATTRIBUTE,AUTOCOMMIT,AUTOP,' +
608     'AUTOPRINT,AUTORECOVERY,AUTOT,AUTOTRACE,BLO,BLOCKTERMINATOR,BRE,BREAK,' +
609     'BTI,BTITLE,BUFFER,CL,CLEAR,CLOSECURSOR,CMDS,CMDSEP,COL,COLSEP,COM,COMP,' +
610     'COMPAT,COMPATIBILITY,CON,CONN,COPY,COPYC,COPYCOMMIT,COPYTYPECHECK,DEF,' +
611     'DEFINE,DESC,DESCR,DESCRI,DESCRIB,DESCRIBE,DISC,DISCO,DISCON,DISCONN,' +
612     'DISCONNE,DISCONNEC,DISCONNECT,EA,ECHO,EDITF,EDITFILE,EMB,' +
613     'EMBEDDED,ESC,EXEC,EXECUTE,FAILURE,FEED,FEEDBACK,FLAGGER,FLU,FULL,GET,' +
614     'HEA,HEADING,HEADS,HEADSEP,HELP,HO,HOST,INPUT,INTERMED,INTERMEDIATE,INV,' +
615     'INVISIBLE,LIN,LINESIZE,LO,LOBOF,LOBOFFSET,LOGON,LOGSOURCE,LONGC,' +
616     'LONGCHUNKSIZE,MARKUP,MAXDATA,MIX,MIXED,NATIVE,NEWP,NEWPAGE,NUM,' +
617     'NUMF,NUMFORMAT,NUMWIDTH,OFF,OSERROR,PAGES,PAGESIZE,PASSW,PAU,PAUSE,' +
618     'PPRINT,PRI,PRINT,PROMPT,RECSEP,RECSEPCHAR,REPF,REPFOOTER,REPH,REPHEADER,' +
619     'RUN,SAVE,SCAN,SERVEROUTPUT,SET,SHIFT,SHIFTINOUT,SHO,SHOW,SHUTDOWN,' +
620     'SILENT,SPOOL,SQLBL,SQLBLANKLINES,SQLC,SQLCASE,SQLCO,SQLCONTINUE,SQLN,' +
621     'SQLNUMBER,SQLP,SQLPRE,SQLPREFIX,SQLPROMPT,SQLT,SQLTERMINATOR,STA,' +
622     'STARTUP,STATEMENT_ID,STORE,SUCCESS,SUF,SUFFIX,TAB,TERM,TERMOUT,TI,TIMI,' +
623     'TIMING,TRIMOUT,TRIMS,TRIMSPOOL,TTI,TTITLE,UND,UNDEF,UNDEFINE,' +
624     'UNDERLINE,UP,VAR,VARIABLE,VER,VERIFY,VERSION,VIS,VISIBLE,WHENEVER,WR,' +
625     'WRA,WRAP,WRAPPED';
626 
627   OracleCommentKW: string =
628     'REM,REMA,REMAR,REMARK';
629 
630   //---Postgresql-----------------------------------------------------------------
631   //Postgresql Keywords
632   PostgresKW: String =
633     'IF,LOOP,ABORT,ABSOLUTE,ACCESS,ACTION,ADA,ADD,ADMIN,AFTER,AGGREGATE,ALIAS' +
634     ',ALLOCATE,ALTER,ANALYSE,ANALYZE,AND,ARE,AS,ASC,ASENSITIVE' +
635     ',ASSERTION,ASSIGNMENT,ASYMMETRIC,AT,ATOMIC,AUTHORIZATION,BACKWARD' +
636     ',BEFORE,BEGIN,BETWEEN' +
637     ',BOTH,BREADTH,BY,C,CACHE,CALL,CALLED,CARDINALITY,CASCADE,CASCADED,CASE' +
638     ',CAST,CATALOG,CATALOG_NAME,CHAIN,CHARACTERISTICS' +
639     ',CHARACTER_SET_CATALOG,CHARACTER_SET_NAME,CHARACTER_SET_SCHEMA' +
640     ',CHECK,CHECKED,CHECKPOINT,CLASS,CLASS_ORIGIN,CLOB,CLOSE,CLUSTER,COBOL,COLLATE' +
641     ',COLLATION,COLLATION_CATALOG,COLLATION_NAME,COLLATION_SCHEMA,COLUMN,COLUMN_NAME' +
642     ',COMMAND_Function,COMMAND_Function_CODE,COMMENT,COMMIT,COMMITTED,COMPLETION' +
643     ',CONDITION_NUMBER,CONNECT,CONNECTION,CONNECTION_NAME,CONSTRAINT,CONSTRAINTS' +
644     ',CONSTRAINT_CATALOG,CONSTRAINT_NAME,CONSTRAINT_SCHEMA,CONSTRUCTOR,CONTAINS' +
645     ',CONTINUE,CONVERSION,COPY,CORRESPONDING,CREATE,CREATEDB,CREATEUSER' +
646     ',CROSS,CUBE,CURRENT,CURRENT_PATH,CURRENT_ROLE' +
647     ',CURSOR,CURSOR_NAME,CYCLE,DATA,DATABASE,DATETIME_INTERVAL_CODE' +
648     ',DATETIME_INTERVAL_PRECISION,DAY,DEALLOCATE,DEC,DECLARE,DEFAULT,DEFERRABLE' +
649     ',DEFERRED,DEFINED,DEFINER,DELETE,DELIMITER,DELIMITERS,DEPTH,DEREF,DESC,DESCRIBE' +
650     ',DESCRIPTOR,DESTROY,DESTRUCTOR,DETERMINISTIC,DIAGNOSTICS,DICTIONARY,DISCONNECT' +
651     ',DISPATCH,DISTINCT,DO,DOMAIN,DROP,DYNAMIC,DYNAMIC_Function,DYNAMIC_Function_CODE' +
652     ',EACH,ELSE,ELSIF,ELSEIF,ENCODING,ENCRYPTED,END,EQUALS,ESCAPE,EXCEPT,EXCEPTION' +
653     ',EXCLUSIVE,EXEC,EXECUTE,EXISTING,EXPLAIN,EXTERNAL,FALSE,FETCH' +
654     ',FINAL,FIRST,FOR,FORCE,FOREIGN,FORTRAN,FORWARD,FOUND,FREE,FREEZE,FROM' +
655     ',FULL,Function,G,GENERAL,GENERATED,GET,GLOBAL,GO,GOTO,GRANT,GRANTED,GROUP' +
656     ',GROUPING,HANDLER,HAVING,HIERARCHY,HOLD,HOUR,IDENTITY,IGNORE,ILIKE' +
657     ',IMMEDIATE,IMMUTABLE,IMPLEMENTATION,IMPLICIT,INCREMENT,INDEX,INDICATOR' +
658     ',INFIX,INHERITS,INITIALIZE,INITIALLY,INNER,INOUT,INPUT,INSENSITIVE,INSERT' +
659     ',INSTANCE,INSTANTIABLE,INSTEAD,INT,INTERSECT,INTO,INVOKER' +
660     ',IS,ISNULL,ISOLATION,ITERATE,JOIN,K,KEY,KEY_MEMBER,KEY_TYPE,LANCOMPILER,LANGUAGE' +
661     ',LARGE,LAST,LATERAL,LEADING,LEFT,LESS,LEVEL,LIKE,LIMIT,LISTEN,LOAD,LOCAL' +
662     ' LOCATION,LOCATOR,LOCK,M,MAP,MATCH,MAXVALUE,MESSAGE_LENGTH' +
663     ',MESSAGE_OCTET_LENGTH,MESSAGE_TEXT,METHOD,MINUTE,MINVALUE,MODE,MODIFIES' +
664     ',MODIFY,MODULE,MONTH,MORE,MOVE,MUMPS,NAME,NAMES,NATIONAL,NATURAL,NCHAR,NCLOB' +
665     ',NEW,NEXT,NO,NOCREATEDB,NOCREATEUSER,NONE,NOT,NOTHING,NOTIFY,NOTNULL,NULL,NULLABLE' +
666     ',NUMBER,OBJECT,OF,OFF,OFFSET,OIDS,OLD,ON,ONLY,OPEN' +
667     ',OPERATION,Operator,OPTION,OPTIONS,OR,ORDER,ORDINALITY,OUT,OUTER,OUTPUT,OVERLAPS' +
668     ',OVERRIDING,OWNER,PAD,PARAMETER,PARAMETERS,PARAMETER_MODE,PARAMETER_NAME,PARAMETER_ORDINAL_POSITION' +
669     ',PARAMETER_SPECIFIC_CATALOG,PARAMETER_SPECIFIC_NAME,PARAMETER_SPECIFIC_SCHEMA,PARTIAL,PASCAL,PASSWORD' +
670     ',PENDANT,PLACING,PLI,POSTFIX,PRECISION,PREFIX,PREORDER,PREPARE,PRESERVE,PRIMARY' +
671     ',PRIOR,PRIVILEGES,PROCEDURAL,PROCEDURE,PUBLIC,READ,READS,RECHECK,RECURSIVE,REF,REFERENCES' +
672     ',REFERENCING,REINDEX,RELATIVE,RENAME ,REPEATABLE,RESET,RESTRICT,RESULT,RETURN,RETURNED_LENGTH' +
673     ',RETURNED_OCTET_LENGTH,RETURNED_SQLSTATE,RETURNS,REVOKE,RIGHT,ROLE,ROLLBACK,ROLLUP,ROUTINE,ROUTINE_CATALOG' +
674     ',ROUTINE_NAME,ROUTINE_SCHEMA,ROW,ROWS,ROW_COUNT,RULE,SAVEPOINT,SCALE,SCHEMA,SCHEMA_NAME' +
675     ',SCOPE,SCROLL,SEARCH,SECOND,SECTION,SECURITY,SELECT,SELF,SENSITIVE,SEQUENCE,SERIALIZABLE,SERVER_NAME' +
676     ',SESSION,SET,SETOF,SETS,SHARE,SHOW,SIMILAR,SIMPLE,SIZE,SOURCE,SPACE' +
677     ',SPECIFIC,SPECIFICTYPE,SPECIFIC_NAME,SQLCODE,SQLERROR,SQLEXCEPTION,SQLSTATE,SQLWARNING' +
678     ',STABLE,START,STATE,STATEMENT,STATIC,STATISTICS,STDIN,STDOUT,STORAGE,STRICT,STRUCTURE' +
679     ',STYLE,SUBCLASS_ORIGIN,SUBLIST,SYMMETRIC,SYSID,SYSTEM,SYSTEM_USER,TABLE' +
680     ',TABLE_NAME,TEMP,TEMPLATE,TEMPORARY,TERMINATE,THAN,THEN,TIMEZONE_HOUR' +
681     ',TIMEZONE_MINUTE,TO,TOAST,TRAILING,TRANSACTION,TRANSACTIONS_COMMITTED,TRANSACTIONS_ROLLED_BACK' +
682     ',TRANSACTION_ACTIVE,TRANSFORM,TRANSFORMS,TRANSLATION,TREAT,TRIGGER_CATALOG' +
683     ',TRIGGER_NAME,TRIGGER_SCHEMA,TRUE,TRUNCATE,TRUSTED,TYPE,UNCOMMITTED,UNDER,UNENCRYPTED,UNION'+
684     ',UNIQUE,UNKNOWN,UNLISTEN,UNNAMED,UNNEST,UNTIL,UPDATE,USAGE,USER_DEFINED_TYPE_CATALOG' +
685     ',USER_DEFINED_TYPE_NAME,USER_DEFINED_TYPE_SCHEMA,USING,VACUUM,VALID,VALIDATOR,VALUE,VALUES' +
686     ',VARIABLE,VARYING,VERBOSE,VIEW,VOLATILE,WHEN,WHENEVER,WHERE,WITH,WITHOUT,WORK,WRITE,YEAR,ZONE';
687 
688   //Postgresql Functions
689   PostgresFunctions:String =
690     'abs,cbrt,ceil,ceiling,degrees,exp,floor,ln,log,mod,pi,power,radians,random,'+
691     'round,setseed,sign,sqrt,trunc,width_bucket,acos,asin,atan,atan2,cos,cot,'+
692     'sin,tan,bit_length,char_length,character_length,convert,lower,octet_length,'+
693     'overlay,position,substring,trim,upper,ascii,btrim,chr,decode,'+
694     'encode,initcap,length,lpad,ltrim,md5,pg_client_encoding,quote_ident,quote_literal,'+
695     'replace,rpad,rtrim,split_part,strpos,substr,to_ascii,to_hex,translate,get_byte,'+
696     'set_byte,get_bit,set_bit,to_char,to_date,'+
697     'to_timestamp,to_number,age,date_part,date_trunc,extract,now,'+
698     'timeofday,isfinite,area,box_intersect,center,diameter,height,isclosed,isopen,'+
699     'npoints,pclose,popen,radius,width,'+
700     'broadcast,'+
701     'host,masklen,set_masklen,netmask,hostmask,network,abbrev,family,nextval,'+
702     'currval,setval,coalesce,nullif,array_cat ,array_append ,array_prepend ,array_dims,'+
703     'array_lower ,array_upper ,array_to_string ,string_to_array ,avg,bit_and,bit_or,bool_and,'+
704     'bool_or,count,every,max,min,stddev,sum,variance,exists ,in ,some,'+
705     'all ,generate_series,current_database,current_schema,'+
706     'current_schemas,,inet_client_addr,inet_client_port,inet_server_addr,inet_server_port,'+
707     'version,has_table_privilege,has_database_privilege,'+
708     'has_function_privilege,has_language_privilege,'+
709     'has_schema_privilege,has_tablespace_privilege,'+
710     'pg_table_is_visible,pg_type_is_visible,pg_function_is_visible,pg_operator_is_visible,'+
711     'pg_opclass_is_visible,pg_conversion_is_visible,format_type,pg_get_viewdef,'+
712     'pg_get_ruledef,pg_get_indexdef,'+
713     'pg_get_triggerdef,pg_get_constraintdef,pg_get_expr,'+
714     'pg_get_userbyid,pg_get_serial_sequence,pg_tablespace_databases,obj_description,'+
715     'col_description,current_setting,set_config,pg_cancel_backend,pg_start_backup,pg_stop_backup,'+
716     'current_user,current_date,current_time,current_timestamp,localtime,localtimestamp,session_user,user';
717 
718   //Postgresql Types
719   PostgresTypes: String =
720     'smallint,integer,bigint,decimal,numeric,real,double,serial,bigserial,'+
721     'character,varchar,char,text,bytea,timestamp, interval,date,'+
722     'time,boolean,point,line,lseg,box,path,polygon,circle,cidr,inet,'+
723     'macaddr,BIT,bitvar,ARRAY,oid,regproc,regprocedure,regoper,regoperator,regclass,'+
724     'regtype,any,anyarray,anyelement,cstring,internal,language_handler,record,'+
725     'trigger,void,opaque,refcursor,binary,blob,int4,int2,int8,float,float4,float8';
726 
727   //Postgresql Exceptions
728   PostgresExceptions: String =
729     '$BODY$,SUCCESSFUL_COMPLETION,WARNING,DYNAMIC_RESULT_SETS_RETURNED,IMPLICIT_ZERO_BIT_PADDING,NULL_VALUE_ELIMINATED_IN_SET_FUNCTION,'+
730     'PRIVILEGE_NOT_GRANTED,PRIVILEGE_NOT_REVOKED,STRING_DATA_RIGHT_TRUNCATION,DEPRECATED_FEATURE,NO_DATA,NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED,'+
731     'SQL_STATEMENT_NOT_YET_COMPLETE,CONNECTION_EXCEPTION,CONNECTION_DOES_NOT_EXIST,CONNECTION_FAILURE,SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION,'+
732     'SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION,TRANSACTION_RESOLUTION_UNKNOWN,PROTOCOL_VIOLATION,TRIGGERED_ACTION_EXCEPTION,'+
733     'FEATURE_NOT_SUPPORTED,INVALID_TRANSACTION_INITIATION,LOCATOR_EXCEPTION,INVALID_LOCATOR_SPECIFICATION,INVALID_GRANTOR,INVALID_GRANT_OPERATION,'+
734     'INVALID_ROLE_SPECIFICATION,CARDINALITY_VIOLATION,DATA_EXCEPTION,ARRAY_SUBSCRIPT_ERROR,CHARACTER_NOT_IN_REPERTOIRE,DATETIME_FIELD_OVERFLOW,'+
735     'DIVISION_BY_ZERO,ERROR_IN_ASSIGNMENT,ESCAPE_CHARACTER_CONFLICT,INDICATOR_OVERFLOW,INTERVAL_FIELD_OVERFLOW,INVALID_ARGUMENT_FOR_LOGARITHM,'+
736     'INVALID_ARGUMENT_FOR_POWER_FUNCTION,INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION,INVALID_CHARACTER_VALUE_FOR_CAST,INVALID_DATETIME_FORMAT,'+
737     'INVALID_ESCAPE_CHARACTER,INVALID_ESCAPE_OCTET,INVALID_ESCAPE_SEQUENCE,INVALID_INDICATOR_PARAMETER_VALUE,INVALID_LIMIT_VALUE,'+
738     'INVALID_PARAMETER_VALUE,INVALID_REGULAR_EXPRESSION,INVALID_TIME_ZONE_DISPLACEMENT_VALUE,INVALID_USE_OF_ESCAPE_CHARACTER,'+
739     'MOST_SPECIFIC_TYPE_MISMATCH,NULL_VALUE_NOT_ALLOWED,NULL_VALUE_NO_INDICATOR_PARAMETER,NUMERIC_VALUE_OUT_OF_RANGE,STRING_DATA_LENGTH_MISMATCH,'+
740     'SUBSTRING_ERROR,TRIM_ERROR,UNTERMINATED_C_STRING,ZERO_LENGTH_CHARACTER_STRING,FLOATING_POINT_EXCEPTION,'+
741     'INVALID_TEXT_REPRESENTATION,INVALID_BINARY_REPRESENTATION,BAD_COPY_FILE_FORMAT,UNTRANSLATABLE_CHARACTER,INTEGRITY_CONSTRAINT_VIOLATION,'+
742     'RESTRICT_VIOLATION,NOT_NULL_VIOLATION,FOREIGN_KEY_VIOLATION,UNIQUE_VIOLATION,CHECK_VIOLATION,INVALID_CURSOR_STATE,INVALID_TRANSACTION_STATE,'+
743     'ACTIVE_SQL_TRANSACTION,BRANCH_TRANSACTION_ALREADY_ACTIVE,HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL,INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION,'+
744     'INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION,NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION,READ_ONLY_SQL_TRANSACTION,'+
745     'SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED,NO_ACTIVE_SQL_TRANSACTION,IN_FAILED_SQL_TRANSACTION,INVALID_SQL_STATEMENT_NAME,TRIGGERED_DATA_CHANGE_VIOLATION,'+
746     'INVALID_AUTHORIZATION_SPECIFICATION,DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST,DEPENDENT_OBJECTS_STILL_EXIST,INVALID_TRANSACTION_TERMINATION,'+
747     'SQL_ROUTINE_EXCEPTION,FUNCTION_EXECUTED_NO_RETURN_STATEMENT,MODIFYING_SQL_DATA_NOT_PERMITTED,PROHIBITED_SQL_STATEMENT_ATTEMPTED,READING_SQL_DATA_NOT_PERMITTED,'+
748     'INVALID_CURSOR_NAME,EXTERNAL_ROUTINE_EXCEPTION,CONTAINING_SQL_NOT_PERMITTED,'+
749     'EXTERNAL_ROUTINE_INVOCATION_EXCEPTION,INVALID_SQLSTATE_RETURNED,TRIGGER_PROTOCOL_VIOLATED,'+
750     'SRF_PROTOCOL_VIOLATED,SAVEPOINT_EXCEPTION,INVALID_SAVEPOINT_SPECIFICATION,INVALID_CATALOG_NAME,INVALID_SCHEMA_NAME,TRANSACTION_ROLLBACK,'+
751     'TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION,SERIALIZATION_FAILURE,STATEMENT_COMPLETION_UNKNOWN,DEADLOCK_DETECTED,SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION,'+
752     'SYNTAX_ERROR,INSUFFICIENT_PRIVILEGE,CANNOT_COERCE,GROUPING_ERROR,INVALID_FOREIGN_KEY,INVALID_NAME,NAME_TOO_LONG,RESERVED_NAME,DATATYPE_MISMATCH,'+
753     'INDETERMINATE_DATATYPE,WRONG_OBJECT_TYPE,UNDEFINED_COLUMN,UNDEFINED_FUNCTION,UNDEFINED_TABLE,UNDEFINED_PARAMETER,UNDEFINED_OBJECT,'+
754     'DUPLICATE_COLUMN,DUPLICATE_CURSOR,DUPLICATE_DATABASE,DUPLICATE_FUNCTION,DUPLICATE_PREPARED_STATEMENT,DUPLICATE_SCHEMA,DUPLICATE_TABLE,'+
755     'DUPLICATE_ALIAS,DUPLICATE_OBJECT,AMBIGUOUS_COLUMN,AMBIGUOUS_FUNCTION,AMBIGUOUS_PARAMETER,AMBIGUOUS_ALIAS,INVALID_COLUMN_REFERENCE,'+
756     'INVALID_COLUMN_DEFINITION,INVALID_CURSOR_DEFINITION,INVALID_DATABASE_DEFINITION,INVALID_FUNCTION_DEFINITION,INVALID_PREPARED_STATEMENT_DEFINITION,'+
757     'INVALID_SCHEMA_DEFINITION,INVALID_TABLE_DEFINITION,INVALID_OBJECT_DEFINITION,WITH_CHECK_OPTION_VIOLATION,INSUFFICIENT_RESOURCES,'+
758     'DISK_FULL,OUT_OF_MEMORY,TOO_MANY_CONNECTIONS,PROGRAM_LIMIT_EXCEEDED,STATEMENT_TOO_COMPLEX,TOO_MANY_COLUMNS,TOO_MANY_ARGUMENTS,'+
759     'OBJECT_NOT_IN_PREREQUISITE_STATE,OBJECT_IN_USE,CANT_CHANGE_RUNTIME_PARAM,LOCK_NOT_AVAILABLE,OPERATOR_INTERVENTION,QUERY_CANCELED,'+
760     'ADMIN_SHUTDOWN,CRASH_SHUTDOWN,CANNOT_CONNECT_NOW,IO_ERROR,UNDEFINED_FILE,DUPLICATE_FILE,CONFIG_FILE_ERROR,LOCK_FILE_EXISTS,'+
761     'PLPGSQL_ERROR,RAISE_EXCEPTION,INTERNAL_ERROR,DATA_CORRUPTED,INDEX_CORRUPTED';
762 
763 //---MS-SQL 7-------------------------------------------------------------------
764   // keywords
765   MSSQL7KW: string =
766     'ABSOLUTE,ADD,ALL,ALTER,ANY,AS,ASC,AUTHORIZATION,AVG,BACKUP,BEGIN,' +
767     'BETWEEN,BREAK,BROWSE,BULK,BY,CASCADE,CHECK,CHECKPOINT,CLOSE,CLUSTERED,' +
768     'COLUMN,COMMIT,COMMITTED,COMPUTE,CONFIRM,CONSTRAINT,CONTAINS,' +
769     'CONTAINSTABLE,CONTINUE,CONTROLROW,COUNT,CREATE,CROSS,CURRENT,' +
770     'CURRENT_DATE,CURRENT_TIME,CURSOR,DATABASE,DBCC,DEALLOCATE,DECLARE,' +
771     'DEFAULT,DELETE,DENY,DESC,DISK,DISTINCT,DISTRIBUTED,DOUBLE,DROP,DUMMY,' +
772     'DUMP,ELSE,END,ERRLVL,ERROREXIT,ESCAPE,EXCEPT,EXEC,EXECUTE,EXISTS,EXIT,' +
773     'FETCH,FILE,FILLFACTOR,FIRST,FLOPPY,FOR,FOREIGN,FREETEXT,FREETEXTTABLE,' +
774     'FROM,FULL,GLOBAL,GOTO,GRANT,GROUP,HAVING,HOLDLOCK,IDENTITY,IDENTITYCOL,' +
775     'IDENTITY_INSERT,IF,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISOLATION,' +
776     'JOIN,KEY,KILL,LAST,LEFT,LEVEL,LIKE,LINENO,LOAD,MAX,MIN,MIRROREXIT,' +
777     'NATIONAL,NEXT,NOCHECK,NONCLUSTERED,NOT,NULL,OF,OFF,OFFSETS,ON,ONCE,' +
778     'ONLY,OPEN,OPENDATASOURCE,OPENQUERY,OPENROWSET,OPTION,OR,ORDER,OUTER,' +
779     'OVER,PERCENT,PERM,PERMANENT,PIPE,PLAN,PRECISION,PREPARE,PRIMARY,PRINT,' +
780     'PRIOR,PRIVILEGES,PROC,PROCEDURE,PROCESSEXIT,PUBLIC,RAISERROR,READ,' +
781     'READTEXT,RECONFIGURE,REFERENCES,RELATIVE,REPEATABLE,REPLICATION,RESTORE,' +
782     'RESTRICT,RETURN,REVOKE,RIGHT,ROLLBACK,ROWCOUNT,ROWGUIDCOL,RULE,SAVE,' +
783     'SCHEMA,SELECT,SERIALIZABLE,SET,SETUSER,SHUTDOWN,SOME,STATISTICS,SUM,' +
784     'TABLE,TAPE,TEMP,TEMPORARY,TEXTSIZE,THEN,TO,TOP,TRAN,TRANSACTION,TRIGGER,' +
785     'TRUNCATE,TSEQUAL,UNCOMMITTED,UNION,UNIQUE,UPDATE,UPDATETEXT,USE,USER,' +
786     'VALUES,VARYING,VIEW,WAITFOR,WHEN,WHERE,WHILE,WITH,WORK,WRITETEXT';
787 
788   // functions
789   MSSQL7Functions: string =
790     '@@CONNECTIONS,@@CPU_BUSY,@@CURSOR_ROWS,@@DATEFIRST,@@DBTS,@@ERROR,' +
791     '@@FETCH_STATUS,@@IDENTITY,@@IDLE,@@IO_BUSY,@@LANGID,@@LANGUAGE,' +
792     '@@LOCK_TIMEOUT,@@MAX_CONNECTIONS,@@MAX_PRECISION,@@NESTLEVEL,@@OPTIONS,' +
793     '@@PACKET_ERRORS,@@PACK_RECEIVED,@@PACK_SENT,@@PROCID,@@REMSERVER,' +
794     '@@ROWCOUNT,@@SERVERNAME,@@SERVICENAME,@@SPID,@@TEXTSIZE,@@TIMETICKS,' +
795     '@@TOTAL_ERRORS,@@TOTAL_READ,@@TOTAL_WRITE,@@TRANCOUNT,@@VERSION,ABS,' +
796     'ACOS,AND,APP_NAME,ASCII,ASIN,ATAN,ATN2,CASE,CAST,CEILING,CHARINDEX,' +
797     'COALESCE,COLUMNPROPERTY,COL_LENGTH,COL_NAME,CONVERT,COS,COT,' +
798     'CURRENT_TIMESTAMP,CURRENT_USER,CURSOR_STATUS,DATABASEPROPERTY,' +
799     'DATALENGTH,DATEADD,DATEDIFF,DATENAME,DATEPART,DAY,DB_ID,DB_NAME,' +
800     'DEGREES,DIFFERENCE,EXP,FILEGROUPPROPERTY,FILEGROUP_ID,FILEGROUP_NAME,' +
801     'FILEPROPERTY,FILE_ID,FILE_NAME,FLOOR,FORMATMESSAGE,' +
802     'FULLTEXTCATALOGPROPERTY,FULLTEXTSERVICEPROPERTY,GETANSINULL,GETDATE,' +
803     'HOST_ID,HOST_NAME,IDENT_INCR,IDENT_SEED,INDEXPROPERTY,INDEX_COL,' +
804     'ISDATE,ISNULL,ISNUMERIC,IS_MEMBER,IS_SRVROLEMEMBER,LEN,LOG,LOG10,LOWER,' +
805     'LTRIM,MONTH,NEWID,NULLIF,OBJECTPROPERTY,OBJECT_ID,OBJECT_NAME,PARSENAME,' +
806     'PATINDEX,PERMISSIONS,PI,POWER,QUOTENAME,RADIANS,RAND,REPLACE,REPLICATE,' +
807     'REVERSE,ROUND,RTRIM,SESSION_USER,SIGN,SIN,SOUNDEX,SPACE,SQRT,SQUARE,' +
808     'STATS_DATE,STR,STUFF,SUBSTRING,SUSER_ID,SUSER_NAME,SUSER_SID,' +
809     'SUSER_SNAME,SYSTEM_USER,TAN,TEXTPTR,TEXTVALID,TYPEPROPERTY,UNICODE,' +
810     'UPPER,USER_ID,USER_NAME,YEAR';
811 
812   // types
813   MSSQL7Types: string =
814     'BINARY,BIT,CHAR,DATETIME,DECIMAL,FLOAT,IMAGE,INT,MONEY,NCHAR,NTEXT,' +
815     'NUMERIC,NVARCHAR,REAL,SMALLDATETIME,SMALLINT,SMALLMONEY,SYSNAME,TEXT,' +
816     'TIMESTAMP,TINYINT,UNIQUEIDENTIFIER,VARBINARY,VARCHAR';
817 
818 //---MS-SQL2K-------------------------------------------------------------------
819   // keywords
820   MSSQL2000KW =
821     'ADD,ALL,ALTER,AND,ANY,AS,ASC,AUTHORIZATION,BACKUP,' +
822     'BEGIN,BETWEEN,BREAK,BROWSE,BULK,BY,CASCADE,CASE,' +
823     'CHECK,CHECKPOINT,CLOSE,CLUSTERED,COLLATE,' +
824     'COLUMN,COMMIT,COMPUTE,CONSTRAINT,CONTAINS,CONTAINSTABLE,' +
825     'CONTINUE,CREATE,CROSS,CURRENT,CURSOR,DATABASE,' +
826     'DBCC,DEALLOCATE,DECLARE,DEFAULT,DELETE,DENY,DESC,DISK,' +
827     'DISTINCT,DISTRIBUTED,DOUBLE,DROP,DUMMY,DUMP,ELSE,END,' +
828     'ERRLVL,ESCAPE,EXCEPT,EXEC,EXECUTE,EXISTS,EXIT,FETCH,FILE,' +
829     'FILLFACTOR,FOR,FOREIGN,FORMSOF,FREETEXT,FREETEXTTABLE,FROM,FULL,' +
830     'FUNCTION,GOTO,GRANT,GROUP,HAVING,HOLDLOCK,IDENTITY,' +
831     'IDENTITYCOL,IDENTITY_INSERT,IF,IN,INFLECTIONAL,INDEX,INNER,INSERT,' +
832     'INTERSECT,INTO,IS,ISABOUT,JOIN,KEY,KILL,LEFT,LIKE,LINENO,LOAD,' +
833     'NATIONAL,NOCHECK,NONCLUSTERED,NOT,NULL,NULLIF,OF,OFF,' +
834     'OFFSETS,ON,OPEN,OPENDATASOURCE,OPENQUERY,OPENROWSET,OPENXML,' +
835     'OPTION,OR,ORDER,OUTER,OVER,PERCENT,PLAN,PRECISION,' +
836     'PRIMARY,PRINT,PROC,PROCEDURE,PUBLIC,RAISERROR,READ,' +
837     'READTEXT,RECONFIGURE,REFERENCES,REPLICATION,RESTORE,' +
838     'RESTRICT,RETURN,REVOKE,RIGHT,ROLLBACK,ROWCOUNT,ROWGUIDCOL,' +
839     'RULE,SAVE,SCHEMA,SELECT,SESSION_USER,SET,SETUSER,SHUTDOWN,' +
840     'SOME,STATISTICS,TABLE,TEXTSIZE,THEN,TO,TOP,TRAN,TRANSACTION,' +
841     'TRIGGER,TRUNCATE,TSEQUAL,UNION,UNIQUE,UPDATE,UPDATETEXT,' +
842     'USE,USER,VALUES,VARYING,VIEW,WAITFOR,WEIGHT,WHEN,WHERE,WHILE,' +
843     'WITH,WRITETEXT';
844 
845   // functions
846   MSSQL2000Functions =
847     '@@CONNECTIONS,@@CPU_BUSY,@@CURSOR_ROWS,@@DATEFIRST,@@DBTS,@@ERROR,' +
848     '@@FETCH_STATUS,@@IDENTITY,@@IDLE,@@IO_BUSY,@@LANGID,@@LANGUAGE,' +
849     '@@LOCK_TIMEOUT,@@MAX_CONNECTIONS,@@MAX_PRECISION,@@NESTLEVEL,@@OPTIONS,' +
850     '@@PACKET_ERRORS,@@PACK_RECEIVED,@@PACK_SENT,@@PROCID,@@REMSERVER,' +
851     '@@ROWCOUNT,@@SERVERNAME,@@SERVICENAME,@@SPID,@@TEXTSIZE,@@TIMETICKS,' +
852     '@@TOTAL_ERRORS,@@TOTAL_READ,@@TOTAL_WRITE,@@TRANCOUNT,@@VERSION,' +
853     'ABS,ACOS,APP_NAME,ASCII,ASIN,ATAN,ATN2,AVG,BINARY_CHECKSUM,CAST,' +
854     'CEILING,CHARINDEX,CHECKSUM,CHECKSUM_AGG,COALESCE,COLLATIONPROPERTY,' +
855     'COLUMNPROPERTY,COL_LENGTH,COL_NAME,CONVERT,COS,COT,COUNT,' +
856     'COUNT_BIG,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,' +
857     'CURRENT_USER,CURSOR_STATUS,DATABASEPROPERTY,DATABASEPROPERTYEX,' +
858     'DATALENGTH,DATEADD,DATEDIFF,DATENAME,DATEPART,DAY,DB_ID,DB_NAME,DEGREES,' +
859     'DIFFERENCE,EXP,FILEGROUPPROPERTY,FILEGROUP_ID,FILEGROUP_NAME,' +
860     'FILEPROPERTY,FILE_ID,FILE_NAME,FLOOR,fn_helpcollations,' +
861     'fn_listextendedproperty,fn_servershareddrives,fn_trace_geteventinfo,' +
862     'fn_trace_getfilterinfo,fn_trace_getinfo,fn_trace_gettable,' +
863     'fn_virtualfilestats,FORMATMESSAGE,FULLTEXTCATALOGPROPERTY,' +
864     'FULLTEXTSERVICEPROPERTY,GETANSINULL,GETDATE,GETUTCDATE,GROUPING,' +
865     'HAS_DBACCESS,HOST_ID,HOST_NAME,IDENT_CURRENT,IDENT_INCR,IDENT_SEED,' +
866     'INDEXKEY_PROPERTY,INDEXPROPERTY,INDEX_COL,ISDATE,ISNULL,ISNUMERIC,' +
867     'IS_MEMBER,IS_SRVROLEMEMBER,LEN,LOG,LOG10,LOWER,LTRIM,MAX,MIN,MONTH,' +
868     'NEWID,OBJECTPROPERTY,OBJECT_ID,OBJECT_NAME,PARSENAME,PATINDEX,' +
869     'PERMISSIONS,PI,POWER,QUOTENAME,RADIANS,RAND,REPLACE,REPLICATE,REVERSE,' +
870     'ROUND,ROWCOUNT_BIG,RTRIM,SCOPE_IDENTITY,SERVERPROPERTY,SESSIONPROPERTY,' +
871     'SIGN,SIN,SOUNDEX,SPACE,SQL_VARIANT_PROPERTY,SQRT,SQUARE,' +
872     'STATS_DATE,STDEV,STDEVP,STR,STUFF,SUBSTRING,SUM,SUSER_SID,SUSER_SNAME,' +
873     'SYSTEM_USER,TAN,TEXTPTR,TEXTVALID,TYPEPROPERTY,UNICODE,UPPER,' +
874     'USER_ID,USER_NAME,VAR,VARP,YEAR';
875 
876   // types
877   MSSQL2000Types =
878     'bigint,binary,bit,char,character,datetime,' +
879     'dec,decimal,float,image,int,' +
880     'integer,money,nchar,ntext,nvarchar,real,' +
881     'rowversion,smalldatetime,smallint,smallmoney,' +
882     'sql_variant,sysname,text,timestamp,tinyint,uniqueidentifier,' +
883     'varbinary,varchar';
884 
885 //---Interbase 6----------------------------------------------------------------
886   // functions
887   Interbase6Functions = 'AVG,CAST,COUNT,GEN_ID,MAX,MIN,SUM,UPPER';
888 
889   // keywords
890   Interbase6KW: string = 'ACTIVE,ADD,AFTER,ALL,ALTER,AND,ANY,AS,ASC,' +
891     'ASCENDING,AT,AUTO,AUTODDL,BASED,BASENAME,BASE_NAME,BEFORE,BEGIN,BETWEEN,' +
892     'BLOBEDIT,BUFFER,BY,CACHE,CHARACTER_LENGTH,CHAR_LENGTH,CHECK,' +
893     'CHECK_POINT_LEN,CHECK_POINT_LENGTH,COLLATE,COLLATION,COLUMN,COMMIT,' +
894     'COMMITED,COMPILETIME,COMPUTED,CLOSE,CONDITIONAL,CONNECT,CONSTRAINT,' +
895     'CONTAINING,CONTINUE,CREATE,CURRENT,CURRENT_DATE,CURRENT_TIME,' +
896     'CURRENT_TIMESTAMP,CURSOR,DATABASE,DAY,DB_KEY,DEBUG,DEC,DECLARE,DEFAULT,' +
897     'DELETE,DESC,DESCENDING,DESCRIBE,DESCRIPTOR,DISCONNECT,DISTINCT,DO,' +
898     'DOMAIN,DROP,ECHO,EDIT,ELSE,END,ENTRY_POINT,ESCAPE,EVENT,EXCEPTION,' +
899     'EXECUTE,EXISTS,EXIT,EXTERN,EXTERNAL,EXTRACT,FETCH,FILE,FILTER,FOR,' +
900     'FOREIGN,FOUND,FROM,FULL,FUNCTION,GDSCODE,GENERATOR,GLOBAL,GOTO,GRANT,' +
901     'GROUP,GROUP_COMMIT_WAIT,GROUP_COMMIT_WAIT_TIME,HAVING,HELP,HOUR,IF,' +
902     'IMMEDIATE,IN,INACTIVE,INDEX,INDICATOR,INIT,INNER,INPUT,INPUT_TYPE,' +
903     'INSERT,INT,INTO,IS,ISOLATION,ISQL,JOIN,KEY,LC_MESSAGES,LC_TYPE,LEFT,' +
904     'LENGTH,LEV,LEVEL,LIKE,LOGFILE,LOG_BUFFER_SIZE,LOG_BUF_SIZE,LONG,MANUAL,' +
905     'MAXIMUM,MAXIMUM_SEGMENT,MAX_SEGMENT,MERGE,MESSAGE,MINIMUM,MINUTE,' +
906     'MODULE_NAME,MONTH,NAMES,NATIONAL,NATURAL,NCHAR,NO,NOAUTO,NOT,NULL,' +
907     'NUM_LOG_BUFFS,NUM_LOG_BUFFERS,OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,' +
908     'ORDER,OUTER,OUTPUT,OUTPUT_TYPE,OVERFLOW,PAGE,PAGELENGTH,PAGES,PAGE_SIZE,' +
909     'PARAMETER,PASSWORD,PLAN,POSITION,POST_EVENT,PRECISION,PREPARE,PROCEDURE,' +
910     'PROTECTED,PRIMARY,PRIVILEGES,PUBLIC,QUIT,RAW_PARTITIONS,READ,REAL,' +
911     'RECORD_VERSION,REFERENCES,RELEASE,RESERV,RESERVING,RETAIN,RETURN,' +
912     'RETURNING_VALUES,RETURNS,REVOKE,RIGHT,ROLLBACK,RUNTIME,SCHEMA,SECOND,' +
913     'SEGMENT,SELECT,SET,SHADOW,SHARED,SHELL,SHOW,SINGULAR,SIZE,SNAPSHOT,SOME,' +
914     'SORT,SQL,SQLCODE,SQLERROR,SQLWARNING,STABILITY,STARTING,STARTS,' +
915     'STATEMENT,STATIC,STATISTICS,SUB_TYPE,SUSPEND,TABLE,TERMINATOR,THEN,TO,' +
916     'TRANSACTION,TRANSLATE,TRANSLATION,TRIGGER,TRIM,TYPE,UNCOMMITTED,UNION,' +
917     'UNIQUE,UPDATE,USER,USING,VALUE,VALUES,VARIABLE,VARYING,VERSION,VIEW,' +
918     'WAIT,WEEKDAY,WHEN,WHENEVER,WHERE,WHILE,WITH,WORK,WRITE,YEAR,YEARDAY';
919 
920   // types
921   Interbase6Types = 'BLOB,CHAR,CHARACTER,DATE,DECIMAL,DOUBLE,FLOAT,INTEGER,' +
922     'NUMERIC,SMALLINT,TIME,TIMESTAMP,VARCHAR';
923 
924 //---MySQL----------------------------------------------------------------------
925   // keywords
926   MySqlKW: string = 'ACTION,AFTER,AGAINST,AGGREGATE,ALL,ALTER,ANALYZE,AND,AS,' +
927     'ASC,AUTO_INCREMENT,AVG_ROW_LENGTH,BACKUP,BEGIN,BENCHMARK,BETWEEN,BINARY,' +
928     'BIT,BOOL,BOTH,BY,CASCADE,CHANGE,CHARACTER,CHECK,CHECKSUM,COLUMN,COLUMNS,' +
929     'COMMENT,COMMIT,CONSTRAINT,CREATE,CROSS,DATA,DATABASES,DEC,DEFAULT,' +
930     'DELAYED,DELAY_KEY_WRITE,DELETE,DESC,DESCRIBE,DISTINCT,DISTINCTROW,DROP,' +
931     'ELSE,ENCLOSED,END,ESCAPE,ESCAPED,EXISTS,EXPLAIN,FIELDS,FILE,FIRST,' +
932     'FLOAT4,FLOAT8,FLUSH,FOR,FOREIGN,FROM,FULL,FULLTEXT,FUNCTION,GLOBAL,GRANT,' +
933     'GRANTS,GROUP,HAVING,HEAP,HIGH_PRIORITY,HOSTS,IDENTIFIED,IGNORE,' +
934     'INDEX,INFILE,INNER,INT1,INT2,INT3,INT4,INT8,INTO,IS,ISAM,JOIN,KEY,' +
935     'KEYS,KILL,LEADING,LIKE,LIMIT,LINES,LOAD,LOCAL,LOCK,LOGS,LONG,' +
936     'LOW_PRIORITY,MATCH,MAX_ROWS,MIDDLEINT,MIN_ROWS,MODIFY,MYISAM,' +
937     'NATURAL,NO,NOT,NULL,OPTIMIZE,OPTION,OPTIONALLY,ON,OPEN,OR,ORDER,OUTER,' +
938     'OUTFILE,PACK_KEYS,PARTIAL,PRECISION,PRIMARY,PRIVILEGES,PROCEDURE,' +
939     'PROCESS,PROCESSLIST,READ,REFERENCES,REGEXP,RELOAD,RENAME,REPAIR,' +
940     'RESTRICT,RESTORE,RETURNS,REVOKE,RLIKE,ROLLBACK,ROW,ROWS,SELECT,SHOW,' +
941     'SHUTDOWN,SONAME,SQL_BIG_RESULT,SQL_BIG_SELECTS,SQL_BIG_TABLES,' +
942     'SQL_LOG_OFF,SQL_LOG_UPDATE,SQL_LOW_PRIORITY_UPDATES,SQL_SELECT_LIMIT,' +
943     'SQL_SMALL_RESULT,SQL_WARNINGS,STARTING,STATUS,STRAIGHT_JOIN,TABLE,' +
944     'TABLES,TEMPORARY,TERMINATED,THEN,TO,TRAILING,TRANSACTION,TYPE,UNIQUE,' +
945     'UNLOCK,UNSIGNED,UPDATE,USAGE,USE,USING,VALUES,VARBINARY,VARCHAR,' +
946     'VARIABLES,VARYING,WHERE,WITH,WRITE,ZEROFILL';
947 
948   // types
949   MySqlTypes: string = 'TINYINT,SMALLINT,MEDIUMINT,INT,INTEGER,BIGINT,FLOAT,' +
950     'DOUBLE,REAL,DECIMAL,NUMERIC,DATE,DATETIME,TIMESTAMP,TIME,YEAR,CHAR,' +
951     'NATIONAL,TINYBLOB,TINYTEXT,TEXT,BLOB,MEDIUMBLOB,MEDIUMTEXT,LONGBLOB,' +
952     'LONGTEXT,ENUM,SET,STRING';
953 
954   // functions
955   MySqlFunctions: string = 'ABS,ACOS,ASCII,ADD,ADDDATE,ASIN,ATAN,ATAN2,AVG,' +
956     'BIN,BIT_AND,BIT_COUNT,BIT_OR,CASE,CHARACTER_LENGTH,CEILING,' +
957     'CONNECTION_ID,CHAR_LENGTH,COALESCE,CONCAT,CONV,COS,COT,COUNT,' +
958     'CURDATE,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURTIME,DATABASE,' +
959     'DATE_ADD,DATE_FORMAT,DATE_SUB,DAY,DAYNAME,DAYOFMONTH,DAYOFWEEK,' +
960     'DAYOFYEAR,DAY_HOUR,DAY_MINUTE,DAY_SECOND,DECODE,DEGREES,ELT,ENCODE,' +
961     'ENCRYPT,EXP,EXPORT_SET,FIELD,FIND_IN_SET,FLOOR,FORMAT,FROM_DAYS,' +
962     'FROM_UNIXTIME,GET_LOCK,GREATEST,HEX,HOUR,HOUR_MINUTE,HOUR_SECOND,IF,' +
963     'IFNULL,IN,INET_NTOA,INET_ATON,INSERT,INSERT_ID,INSTR,INTERVAL,ISNULL,' +
964     'LAST_INSERT_ID,LCASE,LEAST,LEFT,LENGTH,LOAD_FILE,LOCATE,LOG,LOG10,LOWER,' +
965     'LPAD,LTRIM,MAKE_SET,MASTER_POS_WAIT,MAX,MD5,MID,MIN,MINUTE,' +
966     'MINUTE_SECOND,MOD,MONTH,MONTHNAME,NOW,NULLIF,OCT,OCTET_LENGTH,ORD,' +
967     'PASSWORD,PERIOD_ADD,PERIOD_DIFF,PI,POSITION,POW,POWER,QUARTER,RADIANS,' +
968     'RAND,RELEASE_LOCK,REPEAT,REPLACE,REVERSE,RIGHT,ROUND,RPAD,RTRIM,SECOND,' +
969     'SEC_TO_TIME,SESSION_USER,SIGN,SIN,SOUNDEX,SPACE,SQRT,STD,STDDEV,STRCMP,' +
970     'SUBDATE,SUBSTRING,SUBSTRING_INDEX,SUM,SYSDATE,SYSTEM_USER,TAN,' +
971     'TIME_FORMAT,TIME_TO_SEC,TO_DAYS,TRIM,TRUNCATE,UCASE,UNIX_TIMESTAMP,' +
972     'UPPER,USER,VERSION,WEEK,WEEKDAY,WHEN,YEARWEEK,YEAR_MONTH';
973 
974 {begin}                                                                         // JJV 2000-11-16
975 //---Ingres---------------------------------------------------------------------
976   // keywords
977   IngresKW: string =
978     'ABORT,ACTIVATE,ADD,ADDFORM,AFTER,AGGREGATE,ALL,ALTER,AND,APPEND,ARRAY,' +
979     'AS,ASC,AT,AUDIT_LOG,AUTHORIZATION,AUTOCOMMIT,AVGU,BEFORE,BEGIN,BETWEEN,' +
980     'BREAKDISPLAY,BY,BYREF,CACHE,CALL,CALLFRAME,CALLPROC,CASCADE,CHECK,CLEAR,' +
981     'CLEARROW,CLOSE,COLUMN,COMMAND,COMMENT,COMMIT,CONNECT,CONSTRAINT,' +
982     'CONTINUE,COPY,COUNTU,CPUFACTOR,CREATE,CURRENT,CURRENT_USER,CURSOR,DATA,' +
983     'DATAHANDLER,DATE_FORMAT,DBEVENT,DDL_CONCURRENCY,DEADLOCK,DECLARE,' +
984     'DEFAULT,DEFERRED,DEFINE,DELETE,DELETEROW,DESC,DESCRIBE,DESCRIPTOR,' +
985     'DESTROY,DIRECT,DISABLE,DISCONNECT,DISPLAY,DISTINCT,DISTRIBUTE,DO,DOWN,' +
986     'DROP,ELSE,ELSEIF,ENABLE,END,ENDDATA,ENDDISPLAY,ENDFORMS,ENDIF,ENDLOOP,' +
987     'ENDRETRIEVE,ENDSELECT,ENDWHILE,ERROR,ESCAPE,EXCLUDE,EXCLUDING,EXEC,' +
988     'EXECUTE,EXISTS,EXIT,FETCH,FIELD,FINALIZE,FOR,FOREIGN,FORMDATA,FORMINIT,' +
989     'FORMS,FROM,FULL,GET,GETFORM,GETOPER,GETROW,GLOBAL,GOTO,GRANT,GRANTED,' +
990     'HAVING,HELP,HELP_FORMS,HELP_FRS,HELPFILE,IDENTIFIED,IF,IIMESSAGE,' +
991     'IIPRINTF,IIPROMPT,IISTATEMENT,IMMEDIATE,IMPORT,IN,INCLUDE,INDEX,' +
992     'INDICATOR,INGRES,INITIALIZE,INITTABLE,INNER,INQUIRE_EQUEL,INQUIRE_FORMS,' +
993     'INQUIRE_FRS,INQUIRE_INGRES,INSERT,INSERTROW,INSTALLATION,INTEGRITY,INTO,' +
994     'IO_TRACE,IS,J_FREESZ1,J_FREESZ2,J_FREESZ3,J_FREESZ4,J_SORTBUFSZ,' +
995     'JCPUFACTOR,JOIN,JOINOP,JOURNALING,KEY,LEVEL,LIKE,LINK,LOADTABLE,LOCAL,' +
996     'LOCATION,LOCK_TRACE,LOG_TRACE,LOGDBEVENTS,LOGGING,MAXCOST,MAXCPU,' +
997     'MAXPAGE,MENUITEM,MESSAGE,MODE,MODIFY,MODULE,MONEY_FORMAT,MONEY_PREC,' +
998     'MOVE,NATURAL,NEXT,NODEADLOCK,NOECHO,NOIO_TRACE,NOJIONOP,NOJOURNALING,' +
999     'NOLOCK_TRACE,NOLOG_TRACE,NOLOGDBEVENTS,NOLOGGING,NOMAXCOST,NOMAXCPU,' +
1000     'NOMAXIO,NOMAXPAGE,NOMAXQUERY,NOMAXROW,NOOPTIMIZEONLY,NOPRINTDBEVENTS,' +
1001     'NOPRINTQRY,NOPRINTRULES,NOQEP,NORULES,NOSQL,NOSTATISTICS,NOT,NOTRACE,' +
1002     'NULL,OF,ON,ONLY,OPEN,OPTIMIZEONLY,OPTION,OR,ORDER,OUT,PARAM,PERMIT,' +
1003     'PREPARE,PRESERVE,PRIMARY,PRINT,PRINTDBEVENTS,PRINTQRY,PRINTSCREEN,' +
1004     'PRIVILEGES,PROCEDURE,PROMPT,PUBLIC,PUT,PUTFORM,PUTOPER,PUTROW,QBUFSIZE,' +
1005     'QEP,QRY,QUALIFICATION,QUERY_SIZE,RAISE,RANGE,READONLY,REDISPLAY,' +
1006     'REFERENCES,REFERENCING,REGISTER,RELOCATE,REMOVE,RENAME,REPEAT,REPEATED,' +
1007     'REPLACE,REPLICATE,RESTRICT,RESULT_STRUCTURE,RESUME,RET_INTO,RETRIEVE,' +
1008     'RETURN,RETURNING,REVOKE,ROLLBACK,ROWS,RULE,RUN,SAVE,SAVEPOINT,SCHEMA,' +
1009     'SCREEN,SCROLL,SCROLLDOWN,SCROLLUP,SECTION,SECURITY_ALARM,SECURITY_AUDIT,' +
1010     'SELECT,SESSION,SET,SET_4GL,SET_EQUAL,SET_FORMS,SET_FRS,SET_INGRES,' +
1011     'SET_SQL,SHORT_REMARK,SLEEP,SOME,SORT,SORTBUFSIZE,SQL,STATISTICS,STOP,' +
1012     'SUBMENU,SUMU,SYNONYM,SYSTEM,TABLE,TABLEDATA,TEWMPORARY,THEN,TO,TRACE,' +
1013     'TRANSACTION,TYPE,UNION,UNIQUE,UNLOADTABLE,UNTIL,UP,UPDATE,USER,USING,' +
1014     'VALIDATE,VALIDROW,VALUES,VIEW,WHEN,WHENEVER,WHERE,WHILE,WITH,WORK';
1015 
1016   // types
1017   IngresTypes: string =
1018     'BYTE,C,CHAR,CHARACTER,DATE,DECIMAL,FLOAT,FLOAT4,FLOAT8,INTEGER,INTEGER1,' +
1019     'INTEGER2,INTEGER4,LONG,MONEY,OBJECT_KEY,SECURITY_LABEL,SHORT,SMALLINT,' +
1020     'TABLE_KEY,TEXT,VARCHAR,VARYING';
1021 
1022   // functions
1023   IngresFunctions: string =
1024     '_BINTIM,_CPU_MS,_DATE,_DIO_CNT,_ET_SEC,_PFAULT_CNT,_TIME,_VERSION,ABS,' +
1025     'ANY,ATAN,AUTOCOMMIT_STATE,AVG,BIOCNT,CHAREXTRACT,COLLATION,CONCAT,' +
1026     'CONNECT_TIME_LIMIT,COS,COUNT,CREATE_PROCEDURE,CREATE_TABLE,DATABASE,' +
1027     'DATE_GMT,DATE_PART,DATE_TRUNC,DB_ADMIN,DB_DELIMITED_CASE,DB_NAME_CASE,' +
1028     'DBA,DBMS_BIO,DBMS_CPU,DBMS_DIO,DBMSINFO,DOW,EXP,FLATTEN_AGGREGATE,' +
1029     'FLATTEN_NONE,FLATTEN_OPTIMIZE,FLATTEN_SINGLETON,GROUP,HEX,' +
1030     'IDLE_TIME_LIMIT,IFNULL,INITIAL_USER,INQUIRE_SQL,INT1,INT2,INT4,INTERVAL,' +
1031     'LANGUAGE,LEFT,LENGTH,LOCATE,LOCKMODE,LOG,LONG_BYTE,LONG_VARCHAR,' +
1032     'LOWERCASE,MAX,MAXCONNECT,MAXIDLE,MAXIO,MAXQUERY,MAXROW,MIN,MOD,NOTRIM,' +
1033     'ON_ERROR_STATE,PAD,QUERY_IO_LIMIT,QUERY_LANGUAGE,QUERY_ROW_LIMIT,RIGHT,' +
1034     'ROLE,SECURITY_AUDIT_LOG,SECURITY_AUDIT_STATE,SECURITY_PRIV,' +
1035     'SELECT_SYSCAT,SERVER_CLASS,SESSION_ID,SESSION_PRIORITY,' +
1036     'SESSION_PRIORITY_LIMIT,SESSION_PRIV,SESSION_SECLABEL,SESSION_USER,SHIFT,' +
1037     'SIN,SIZE,SQRT,SQUEEZE,SUM,SYSTEM_USER,TABLE_STATISTICS,TERMINAL,' +
1038     'TRANSACTION_STATE,TRIM,UPDATE_ROWCNT,UPDATE_SYSCAT,UPPERCASE,USERNAME,' +
1039     'VARBYTE';
1040 {end}                                                                           // JJV 2000-11-16
1041 
1042 //---Firebird 2.5 keywords------------------------------------------------------
1043   Firebird25KW: string =
1044     'ABS,ACCENT,ACOS,ACTION,ACTIVE,ADD,ADMIN,AFTER,ALL,ALTER,ALWAYS,AND,ANY,'+
1045     'AS,ASC,ASCENDING,ASCII_CHAR,ASCII_VAL,ASIN,AT,ATAN,ATAN2,AUTO,AUTONOMOUS,'+
1046     'AVG,BACKUP,BEFORE,BEGIN,BETWEEN,BIGINT,BIN_AND,BIN_NOT,BIN_OR,BIN_SHL,'+
1047     'BIN_SHR,BIN_XOR,BIT_LENGTH,BLOB,BLOCK,BOTH,BREAK,BY,CALLER,CASCADE,CASE,'+
1048     'CAST,CEIL,CEILING,CHAR,CHAR_LENGTH,CHAR_TO_UUID,CHARACTER,CHARACTER_LENGTH,'+
1049     'CHECK,CLOSE,COALESCE,COLLATE,COLLATION,COLUMN,COMMENT,COMMIT,COMMITTED,'+
1050     'COMMON,COMPUTED,CONDITIONAL,CONNECT,CONSTRAINT,CONTAINING,COS,COSH,COT,'+
1051     'COUNT,CREATE,CROSS,CSTRING,CURRENT,CURRENT_CONNECTION,CURRENT_DATE,'+
1052     'CURRENT_ROLE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_TRANSACTION,'+
1053     'CURRENT_USER,CURSOR,DATABASE,DATA,DATE,DATEADD,DATEDIFF,DAY,DEC,DECIMAL,'+
1054     'DECLARE,DECODE,DEFAULT,DELETE,DELETING,DESC,DESCENDING,DESCRIPTOR,'+
1055     'DIFFERENCE,DISCONNECT,DISTINCT,DO,DOMAIN,DOUBLE,DROP,ELSE,END,ENTRY_POINT,'+
1056     'ESCAPE,EXCEPTION,EXECUTE,EXISTS,EXIT,EXP,EXTERNAL,EXTRACT,FETCH,FILE,'+
1057     'FILTER,FIRST,FIRSTNAME,FLOAT,FLOOR,FOR,FOREIGN,FREE_IT,FROM,FULL,FUNCTION,'+
1058     'GDSCODE,GENERATED,GENERATOR,GEN_ID,GEN_UUID,GLOBAL,GRANT,GRANTED,GROUP,'+
1059     'HASH,HAVING,HOUR,IF,IGNORE,IIF,IN,INACTIVE,INDEX,INNER,INPUT_TYPE,'+
1060     'INSENSITIVE,INSERT,INSERTING,INT,INTEGER,INTO,IS,ISOLATION,JOIN,KEY,LAST,'+
1061     'LASTNAME,LEADING,LEAVE,LEFT,LENGTH,LEVEL,LIKE,LIMBO,LIST,LN,LOCALTIME,'+
1062     'LOCALTIMESTAMP,LOCK,LOG,LOG10,LONG,LOWER,LPAD,MANUAL,MAPPING,MATCHED,'+
1063     'MATCHING,MAX,MAXVALUE,MAXIMUM_SEGMENT,MERGE,MILLISECOND,MIDDLENAME,MIN,'+
1064     'MINUTE,MINVALUE,MOD,MODULE_NAME,MONTH,NAMES,NATIONAL,NATURAL,NCHAR,NEXT,'+
1065     'NO,NOT,NULLIF,NULL,NULLS,NUMERIC,OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,'+
1066     'ORDER,OS_NAME,OUTER,OUTPUT_TYPE,OVERFLOW,OVERLAY,PAD,PAGE,PAGES,PAGE_SIZE,'+
1067     'PARAMETER,PASSWORD,PI,PLACING,PLAN,POSITION,POST_EVENT,POWER,PRECISION,'+
1068     'PRESERVE,PRIMARY,PRIVILEGES,PROCEDURE,PROTECTED,RAND,RDB$DB_KEY,READ,REAL,'+
1069     'RECORD_VERSION,RECREATE,RECURSIVE,REFERENCES,RELEASE,REPLACE,REQUESTS,'+
1070     'RESERV,RESERVING,RESTART,RESTRICT,RETAIN,RETURNING,RETURNING_VALUES,'+
1071     'RETURNS,REVERSE,REVOKE,RIGHT,ROLE,ROLLBACK,ROUND,ROW_COUNT,ROWS,RPAD,'+
1072     'SAVEPOINT,SCALAR_ARRAY,SCHEMA,SECOND,SEGMENT,SELECT,SENSITIVE,SEQUENCE,'+
1073     'SET,SHADOW,SHARED,SIGN,SIMILAR,SIN,SINGULAR,SINH,SIZE,SKIP,SMALLINT,'+
1074     'SNAPSHOT,SOME,SORT,SOURCE,SPACE,SQLCODE,SQLSTATE,SQRT,STABILITY,START,'+
1075     'STARTING,STARTS,STATEMENT,STATISTICS,SUBSTRING,SUB_TYPE,SUM,SUSPEND,TABLE,'+
1076     'TAN,TANH,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEOUT,TO,TRAILING,TRANSACTION,'+
1077     'TRIGGER,TRIM,TRUNC,TWO_PHASE,TYPE,UNCOMMITTED,UNDO,UNION,UNIQUE,UPDATE,'+
1078     'UPDATING,UPPER,USER,USING,UUID_TO_CHAR,VALUE,VALUES,VARCHAR,VARIABLE,'+
1079     'VARYING,VIEW,WAIT,WEEK,WEEKDAY,WHEN,WHERE,WHILE,WITH,WORK,WRITE,YEAR,YEARDAY';
1080 
1081 //---Firebird 3.0 keywords------------------------------------------------------
1082   Firebird30KW: string =
1083     'ABS,ABSOLUTE,ACCENT,ACOS,ACOSH,ACTION,ACTIVE,ADD,ADMIN,AFTER,ALL,ALTER,'+
1084     'ALWAYS,AND,ANY,AS,ASC,ASCENDING,ASCII_CHAR,ASCII_VAL,ASIN,ASINH,AT,ATAN,'+
1085     'ATAN2,ATANH,AUTO,AUTONOMOUS,AVG,BACKUP,BEFORE,BEGIN,BETWEEN,BIGINT,BIN_AND,'+
1086     'BIN_NOT,BIN_OR,BIN_SHL,BIN_SHR,BIN_XOR,BIT_LENGTH,BLOB,BLOCK,BODY,BOOLEAN,'+
1087     'BOTH,BREAK,BY,CALLER,CASCADE,CASE,CAST,CEIL,CEILING,CHAR,CHAR_LENGTH,'+
1088     'CHAR_TO_UUID,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,COLLATE,'+
1089     'COLLATION,COLUMN,COMMENT,COMMIT,COMMITTED,COMMON,COMPUTED,CONDITIONAL,'+
1090     'CONNECT,CONSTRAINT,CONTAINING,CONTINUE,CORR,COS,COSH,COT,COUNT,COVAR_POP,'+
1091     'COVAR_SAMP,CREATE,CROSS,CSTRING,CURRENT,CURRENT_CONNECTION,CURRENT_DATE,'+
1092     'CURRENT_ROLE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_TRANSACTION,'+
1093     'CURRENT_USER,CURSOR,DATABASE,DATA,DATE,DATEADD,DATEDIFF,DAY,DDL,DEC,'+
1094     'DECIMAL,DECLARE,DECODE,DECRYPT,DEFAULT,DELETE,DELETING,DENSE_RANK,DESC,'+
1095     'DESCENDING,DESCRIPTOR,DETERMINISTIC,DIFFERENCE,DISCONNECT,DISTINCT,DO,'+
1096     'DOMAIN,DOUBLE,DROP,ELSE,ENCRYPT,END,ENGINE,ENTRY_POINT,ESCAPE,EXCEPTION,'+
1097     'EXECUTE,EXISTS,EXIT,EXP,EXTERNAL,EXTRACT,FALSE,FETCH,FILE,FILTER,FIRST,'+
1098     'FIRST_VALUE,FIRSTNAME,FLOAT,FLOOR,FOR,FOREIGN,FREE_IT,FROM,FULL,FUNCTION,'+
1099     'GDSCODE,GENERATED,GENERATOR,GEN_ID,GEN_UUID,GLOBAL,GRANT,GRANTED,GROUP,'+
1100     'HASH,HAVING,HOUR,IDENTITY,IF,IGNORE,IIF,IN,INACTIVE,INCREMENT,INDEX,INNER,'+
1101     'INPUT_TYPE,INSENSITIVE,INSERT,INSERTING,INT,INTEGER,INTO,IS,ISOLATION,JOIN,'+
1102     'KEY,LAG,LAST,LAST_VALUE,LASTNAME,LEAD,LEADING,LEAVE,LEFT,LENGTH,LEVEL,LIKE,'+
1103     'LIMBO,LINGER,LIST,LN,LOCALTIME,LOCALTIMESTAMP,LOCK,LOG,LOG10,LONG,LOWER,'+
1104     'LPAD,MANUAL,MAPPING,MATCHED,MATCHING,MAX,MAXVALUE,MERGE,MILLISECOND,'+
1105     'MIDDLENAME,MIN,MINUTE,MINVALUE,MOD,MODULE_NAME,MONTH,NAME,NAMES,NATIONAL,'+
1106     'NATURAL,NCHAR,NEXT,NO,NOT,NTH_VALUE,NULLIF,NULL,NULLS,NUMERIC,OCTET_LENGTH,'+
1107     'OF,OFFSET,ON,ONLY,OPEN,OPTION,OR,ORDER,OS_NAME,OUTER,OUTPUT_TYPE,OVER,'+
1108     'OVERFLOW,OVERLAY,PACKAGE,PAD,PAGE,PAGES,PAGE_SIZE,PARAMETER,PARTITION,'+
1109     'PASSWORD,PI,PLACING,PLAN,PLUGIN,POSITION,POST_EVENT,POWER,PRECISION,'+
1110     'PRESERVE,PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PROTECTED,RAND,RANK,RDB$DB_KEY,'+
1111     'RDB$GET_CONTEXT,RDB$RECORD_VERSION,RDB$SET_CONTEXT,READ,REAL,'+
1112     'RECORD_VERSION,RECREATE,RECURSIVE,REFERENCES,REGR_AVGX,REGR_AVGY,'+
1113     'REGR_COUNT,REGR_INTERCEPT,REGR_R2,REGR_SLOPE,REGR_SXX,REGR_SXY,REGR_SYY,'+
1114     'RELATIVE,RELEASE,REPLACE,REQUESTS,RESERV,RESERVING,RESTART,RESTRICT,RETAIN,'+
1115     'RETURN,RETURNING,RETURNING_VALUES,RETURNS,REVERSE,REVOKE,RIGHT,ROLE,'+
1116     'ROLLBACK,ROUND,ROW,ROW_COUNT,ROW_NUMBER,ROWS,RPAD,SAVEPOINT,SCALAR_ARRAY,'+
1117     'SCHEMA,SCROLL,SECOND,SEGMENT,SELECT,SENSITIVE,SEQUENCE,SERVERWIDE,SET,'+
1118     'SHADOW,SHARED,SIGN,SIMILAR,SIN,SINGULAR,SINH,SIZE,SKIP,SMALLINT,SNAPSHOT,'+
1119     'SOME,SORT,SOURCE,SPACE,SQLCODE,SQLSTATE,SQRT,STABILITY,START,STARTING,'+
1120     'STARTS,STATEMENT,STATISTICS,STDDEV_POP,STDDEV_SAMP,SUBSTRING,SUB_TYPE,SUM,'+
1121     'SUSPEND,TABLE,TAGS,TAN,TANH,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEOUT,TO,'+
1122     'TRAILING,TRANSACTION,TRIGGER,TRIM,TRUE,TRUNC,TRUSTED,TWO_PHASE,TYPE,'+
1123     'UNCOMMITTED,UNDO,UNION,UNIQUE,UNKNOWN,UPDATE,UPDATING,UPPER,USAGE,USER,'+
1124     'USING,UUID_TO_CHAR,VALUE,VALUES,VAR_POP,VAR_SAMP,VARCHAR,VARIABLE,VARYING,'+
1125     'VIEW,WAIT,WEEK,WEEKDAY,WHEN,WHERE,WHILE,WITH,WORK,WRITE,YEAR,YEARDAY';
1126 
1127 //---Firebird 4.0 keywords------------------------------------------------------
1128   Firebird40KW: string =
1129     'ABS,ABSOLUTE,ACCENT,ACOS,ACOSH,ACTION,ACTIVE,ADD,ADMIN,AFTER,ALL,ALTER,'+
1130     'ALWAYS,AND,ANY,AS,ASC,ASCENDING,ASCII_CHAR,ASCII_VAL,ASIN,ASINH,AT,ATAN,'+
1131     'ATAN2,ATANH,AUTO,AUTONOMOUS,AVG,BACKUP,BASE64_DECODE,BASE64_ENCODE,BEFORE,'+
1132     'BEGIN,BETWEEN,BIGINT,BIN_AND,BIN_NOT,BIN_OR,BIN_SHL,BIN_SHR,BIN_XOR,BINARY,'+
1133     'BIND,BIT_LENGTH,BLOB,BLOCK,BODY,BOOLEAN,BOTH,BREAK,BY,CALLER,CASCADE,CASE,'+
1134     'CAST,CEIL,CEILING,CHAR,CHAR_LENGTH,CHAR_TO_UUID,CHARACTER,CHARACTER_LENGTH,'+
1135     'CHECK,CLEAR,CLOSE,COALESCE,COLLATE,COLLATION,COLUMN,COMMENT,COMMIT,'+
1136     'COMMITTED,COMMON,COMPARE_DECFLOAT,COMPUTED,CONDITIONAL,CONNECT,CONNECTIONS,'+
1137     'CONSISTENCY,CONSTRAINT,CONTAINING,CONTINUE,CORR,COS,COSH,COT,COUNT,COUNTER,'+
1138     'COVAR_POP,COVAR_SAMP,CREATE,CROSS,CRYPT_HASH,CSTRING,CTR_BIG_ENDIAN,'+
1139     'CTR_LENGTH,CTR_LITTLE_ENDIAN,CUME_DIST,CURRENT,CURRENT_CONNECTION,'+
1140     'CURRENT_DATE,CURRENT_ROLE,CURRENT_TIME,CURRENT_TIMESTAMP,'+
1141     'CURRENT_TRANSACTION,CURRENT_USER,CURSOR,DATABASE,DATA,DATE,DATEADD,'+
1142     'DATEDIFF,DAY,DDL,DEC,DECFLOAT,DECIMAL,DECLARE,DECODE,DECRYPT,DEFAULT,'+
1143     'DEFINER,DELETE,DELETING,DENSE_RANK,DESC,DESCENDING,DESCRIPTOR,'+
1144     'DETERMINISTIC,DIFFERENCE,DISABLE,DISCONNECT,DISTINCT,DO,DOMAIN,DOUBLE,DROP,'+
1145     'ELSE,ENABLE,ENCRYPT,END,ENGINE,ENTRY_POINT,ESCAPE,EXCEPTION,EXCESS,EXCLUDE,'+
1146     'EXECUTE,EXISTS,EXIT,EXP,EXTENDED,EXTERNAL,EXTRACT,FALSE,FETCH,FILE,FILTER,'+
1147     'FIRST,FIRST_DAY,FIRST_VALUE,FIRSTNAME,FLOAT,FLOOR,FOLLOWING,FOR,FOREIGN,'+
1148     'FREE_IT,FROM,FULL,FUNCTION,GDSCODE,GENERATED,GENERATOR,GEN_ID,GEN_UUID,'+
1149     'GLOBAL,GRANT,GRANTED,GROUP,HASH,HAVING,HEX_DECODE,HEX_ENCODE,HOUR,IDENTITY,'+
1150     'IDLE,IF,IGNORE,IIF,IN,INACTIVE,INCLUDE,INCREMENT,INDEX,INNER,INPUT_TYPE,'+
1151     'INSENSITIVE,INSERT,INSERTING,INT,INT128,INTEGER,INTO,INVOKER,IS,ISOLATION,'+
1152     'IV,JOIN,KEY,LAG,LAST,LAST_DAY,LAST_VALUE,LASTNAME,LEAD,LEADING,LEAVE,LEFT,'+
1153     'LEGACY,LENGTH,LEVEL,LIFETIME,LIKE,LIMBO,LINGER,LIST,LN,LATERAL,LOCAL,'+
1154     'LOCALTIME,LOCALTIMESTAMP,LOCK,LOG,LOG10,LONG,LOWER,LPAD,LPARAM,MAKE_DBKEY,'+
1155     'MANUAL,MAPPING,MATCHED,MATCHING,MAX,MAXVALUE,MERGE,MESSAGE,MILLISECOND,'+
1156     'MIDDLENAME,MIN,MINUTE,MINVALUE,MOD,MODE,MODULE_NAME,MONTH,NAME,NAMES,'+
1157     'NATIONAL,NATIVE,NATURAL,NCHAR,NEXT,NO,NORMALIZE_DECFLOAT,NOT,NTH_VALUE,'+
1158     'NTILE,NULLIF,NULL,NULLS,NUMBER,NUMERIC,OCTET_LENGTH,OF,OFFSET,OLDEST,ON,'+
1159     'ONLY,OPEN,OPTION,OR,ORDER,OS_NAME,OTHERS,OUTER,OUTPUT_TYPE,OVER,OVERFLOW,'+
1160     'OVERLAY,OVERRIDING,PACKAGE,PAD,PAGE,PAGES,PAGE_SIZE,PARAMETER,PARTITION,'+
1161     'PASSWORD,PERCENT_RANK,PI,PLACING,PLAN,PLUGIN,POOL,POSITION,POST_EVENT,'+
1162     'POWER,PRECEDING,PRECISION,PRESERVE,PRIMARY,PRIOR,PRIVILEGE,PRIVILEGES,'+
1163     'PROCEDURE,PROTECTED,PUBLICATION,QUANTIZE,RAND,RANGE,RANK,RDB$DB_KEY,'+
1164     'RDB$ERROR,RDB$GET_CONTEXT,RDB$GET_TRANSACTION_CN,RDB$RECORD_VERSION,'+
1165     'RDB$ROLE_IN_USE,RDB$SET_CONTEXT,RDB$SYSTEM_PRIVILEGE,READ,REAL,'+
1166     'RECORD_VERSION,RECREATE,RECURSIVE,REFERENCES,REGR_AVGX,REGR_AVGY,'+
1167     'REGR_COUNT,REGR_INTERCEPT,REGR_R2,REGR_SLOPE,REGR_SXX,REGR_SXY,REGR_SYY,'+
1168     'RELATIVE,RELEASE,REPLACE,REQUESTS,RESERV,RESERVING,RESET,RESETTING,RESTART,'+
1169     'RESTRICT,RETAIN,RETURN,RETURNING,RETURNING_VALUES,RETURNS,REVERSE,REVOKE,'+
1170     'RIGHT,ROLE,ROLLBACK,ROUND,ROW,ROW_COUNT,ROW_NUMBER,ROWS,RPAD,RSA_DECRYPT,'+
1171     'RSA_ENCRYPT,RSA_PRIVATE,RSA_PUBLIC,RSA_SIGN,RSA_VERIFY,SALT_LENGTH,'+
1172     'SAVEPOINT,SCALAR_ARRAY,SCHEMA,SCROLL,SECOND,SECURITY,SEGMENT,SELECT,'+
1173     'SENSITIVE,SEQUENCE,SERVERWIDE,SESSION,SET,SHADOW,SHARED,SIGN,SIGNATURE,'+
1174     'SIMILAR,SIN,SINGULAR,SINH,SIZE,SKIP,SMALLINT,SNAPSHOT,SOME,SORT,SOURCE,'+
1175     'SPACE,SQL,SQLCODE,SQLSTATE,SQRT,STABILITY,START,STARTING,STARTS,STATEMENT,'+
1176     'STATISTICS,STDDEV_POP,STDDEV_SAMP,SUBSTRING,SUB_TYPE,SUM,SUSPEND,SYSTEM,'+
1177     'TABLE,TAGS,TAN,TANH,TEMPORARY,THEN,TIES,TIME,TIMESTAMP,TIMEOUT,'+
1178     'TIMEZONE_HOUR,TIMEZONE_MINUTE,TO,TOTALORDER,TRAILING,TRANSACTION,TRAPS,'+
1179     'TRIGGER,TRIM,TRUE,TRUNC,TRUSTED,TWO_PHASE,TYPE,UNBOUNDED,UNCOMMITTED,UNDO,'+
1180     'UNION,UNIQUE,UNKNOWN,UPDATE,UPDATING,UPPER,USAGE,USER,USING,UUID_TO_CHAR,'+
1181     'VALUE,VALUES,VAR_POP,VAR_SAMP,VARBINARY,VARCHAR,VARIABLE,VARYING,VIEW,WAIT,'+
1182     'WEEK,WEEKDAY,WHEN,WHERE,WHILE,WINDOW,WITH,WITHOUT,WORK,WRITE,YEAR,YEARDAY,'+
1183     'ZONE';
1184 
1185 procedure MakeIdentTable;
1186 var
1187   c: char;
1188 begin
1189   FillChar(Identifiers, SizeOf(Identifiers), 0);
1190   for c := 'a' to 'z' do
1191     Identifiers[c] := TRUE;
1192   for c := 'A' to 'Z' do
1193     Identifiers[c] := TRUE;
1194   for c := '0' to '9' do
1195     Identifiers[c] := TRUE;
1196   Identifiers['_'] := TRUE;
1197   Identifiers['#'] := TRUE;                                                     // DJLP 2000-09-05
1198   Identifiers['$'] := TRUE;                                                     // DJLP 2000-09-05
1199 
1200   FillChar(mHashTable, SizeOf(mHashTable), 0);
1201   mHashTable['_'] := 1;
1202   for c := 'a' to 'z' do
1203     mHashTable[c] := 2 + Ord(c) - Ord('a');
1204   for c := 'A' to 'Z' do
1205     mHashTable[c] := 2 + Ord(c) - Ord('A');
1206 
1207   Move(Identifiers, IdentifiersMSSQL7, SizeOf(Identifiers));
1208   Move(mHashTable, mHashTableMSSQL7, SizeOf(mHashTable));
1209   IdentifiersMSSQL7['@'] := TRUE;
1210   mHashTableMSSQL7['@'] := mHashTableMSSQL7['Z'] + 1;
1211 end;
1212 
KeyHashnull1213 function TSynSQLSyn.KeyHash(ToHash: PChar): Integer;
1214 var
1215   Start: PChar;
1216 begin
1217   Result := 0;
1218   Start := ToHash;
1219   while fIdentifiersPtr^[ToHash^] do begin
1220 
1221     Result := (2 * Result + fmHashTablePtr^[ToHash^]) and $FFFFFF;
1222     inc(ToHash);
1223   end;
1224   Result := Result and $FF; // 255
1225   fStringLen := ToHash - Start;
1226 end;
1227 
KeyCompnull1228 function TSynSQLSyn.KeyComp(const aKey: string): Boolean;
1229 var
1230   i: integer;
1231   pKey1, pKey2: PChar;
1232 begin
1233   pKey1 := fToIdent;
1234   // Note: fStringLen is always > 0 !
1235   pKey2 := pointer(aKey);
1236   for i := 1 to fStringLen do
1237   begin
1238     if mHashTable[pKey1^] <> mHashTable[pKey2^] then
1239     begin
1240       Result := FALSE;
1241       exit;
1242     end;
1243     Inc(pKey1);
1244     Inc(pKey2);
1245   end;
1246   Result := TRUE;
1247 end;
1248 
TSynSQLSyn.IdentKindnull1249 function TSynSQLSyn.IdentKind(MayBe: PChar): TtkTokenKind;
1250 var
1251   Entry: TSynHashEntry;
1252 begin
1253   fToIdent := MayBe;
1254   Entry := fKeywords[KeyHash(MayBe)];
1255   while Assigned(Entry) do begin
1256     if Entry.KeywordLen > fStringLen then
1257       break
1258     else if Entry.KeywordLen = fStringLen then
1259       if KeyComp(Entry.Keyword) then begin
1260         Result := TtkTokenKind(Entry.Kind);
1261         exit;
1262       end;
1263     Entry := Entry.Next;
1264   end;
1265   Result := tkIdentifier;
1266 end;
1267 
1268 procedure TSynSQLSyn.MakeMethodTables;
1269 var
1270   I: Char;
1271 begin
1272   for I := #0 to #255 do
1273     case I of
1274        #0: fProcTable[I] := @NullProc;
1275       #10: fProcTable[I] := @LFProc;
1276       #13: fProcTable[I] := @CRProc;
1277       #39: fProcTable[I] := @AsciiCharProc;
1278       '=': fProcTable[I] := @EqualProc;
1279       '>': fProcTable[I] := @GreaterProc;
1280       '<': fProcTable[I] := @LowerProc;
1281       '-': fProcTable[I] := @MinusProc;
1282       '|': fProcTable[I] := @OrSymbolProc;
1283       '+': fProcTable[I] := @PlusProc;
1284       '/': fProcTable[I] := @SlashProc;
1285       '&': fProcTable[I] := @AndSymbolProc;
1286       #34: fProcTable[I] := @StringProc;
1287       ':', '@':
1288         fProcTable[I] := @VariableProc;
1289       'A'..'Z', 'a'..'z', '_':
1290         fProcTable[I] := @IdentProc;
1291       '0'..'9':
1292         fProcTable[I] := @NumberProc;
1293       #1..#9, #11, #12, #14..#32:
1294         fProcTable[I] := @SpaceProc;
1295       '^', '%', '*', '!':
1296         fProcTable[I] := @SymbolAssignProc;
1297       '{', '}', '.', ',', ';', '?', '(', ')', '[', ']', '~':
1298         fProcTable[I] := @SymbolProc;
1299       else
1300         fProcTable[I] := @UnknownProc;
1301     end;
1302 end;
1303 
1304 constructor TSynSQLSyn.Create(AOwner: TComponent);
1305 begin
1306   inherited Create(AOwner);
1307   fKeywords := TSynHashEntryList.Create;
1308   fTableNames := TStringList.Create;
1309   TStringList(fTableNames).OnChange := @TableNamesChanged;
1310   fCommentAttri := TSynHighlighterAttributes.Create(@SYNS_AttrComment, SYNS_XML_AttrComment);
1311   fCommentAttri.Style := [fsItalic];
1312   AddAttribute(fCommentAttri);
1313   fDataTypeAttri := TSynHighlighterAttributes.Create(@SYNS_AttrDataType, SYNS_XML_AttrDataType);
1314   fDataTypeAttri.Style := [fsBold];
1315   AddAttribute(fDataTypeAttri);
1316 {begin}                                                                         // DJLP 2000-08-11
1317   fDefaultPackageAttri :=
1318     TSynHighlighterAttributes.Create(@SYNS_AttrDefaultPackage, SYNS_XML_AttrDefaultPackage);
1319   fDefaultPackageAttri.Style := [fsBold];
1320   AddAttribute(fDefaultPackageAttri);
1321 {end}                                                                           // DJLP 2000-08-11
1322   fExceptionAttri := TSynHighlighterAttributes.Create(@SYNS_AttrException, SYNS_XML_AttrException);
1323   fExceptionAttri.Style := [fsItalic];
1324   AddAttribute(fExceptionAttri);
SYNS_XML_AttrFunctionnull1325   fFunctionAttri := TSynHighlighterAttributes.Create(@SYNS_AttrFunction, SYNS_XML_AttrFunction);
1326   fFunctionAttri.Style := [fsBold];
1327   AddAttribute(fFunctionAttri);
1328   fIdentifierAttri := TSynHighlighterAttributes.Create(@SYNS_AttrIdentifier, SYNS_XML_AttrIdentifier);
1329   AddAttribute(fIdentifierAttri);
1330   fKeyAttri := TSynHighlighterAttributes.Create(@SYNS_AttrReservedWord, SYNS_XML_AttrReservedWord);
1331   fKeyAttri.Style := [fsBold];
1332   AddAttribute(fKeyAttri);
1333   fNumberAttri := TSynHighlighterAttributes.Create(@SYNS_AttrNumber, SYNS_XML_AttrNumber);
1334   AddAttribute(fNumberAttri);
1335 {begin}                                                                         // DJLP 2000-08-11
1336   fPLSQLAttri := TSynHighlighterAttributes.Create(@SYNS_AttrPLSQL, SYNS_XML_AttrPLSQL);
1337   fPLSQLAttri.Style := [fsBold];
1338   AddAttribute(fPLSQLAttri);
1339 {end}                                                                           // DJLP 2000-08-11
1340   fSpaceAttri := TSynHighlighterAttributes.Create(@SYNS_AttrSpace, SYNS_XML_AttrSpace);
1341   AddAttribute(fSpaceAttri);
1342 {begin}                                                                         // DJLP 2000-09-05
1343   fSQLPlusAttri:=TSynHighlighterAttributes.Create(@SYNS_AttrSQLPlus, SYNS_XML_AttrSQLPlus);
1344   fSQLPlusAttri.Style := [fsBold];
1345   AddAttribute(fSQLPlusAttri);
1346 {end}                                                                           // DJLP 2000-09-05
1347   fStringAttri := TSynHighlighterAttributes.Create(@SYNS_Attrstring, SYNS_XML_Attrstring);
1348   AddAttribute(fStringAttri);
1349   fSymbolAttri := TSynHighlighterAttributes.Create(@SYNS_AttrSymbol, SYNS_XML_AttrSymbol);
1350   AddAttribute(fSymbolAttri);
1351   fTableNameAttri := TSynHighlighterAttributes.Create(@SYNS_AttrTableName, SYNS_XML_AttrTableName);
1352   AddAttribute(fTableNameAttri);
1353   fVariableAttri := TSynHighlighterAttributes.Create(@SYNS_AttrVariable, SYNS_XML_AttrVariable);
1354   AddAttribute(fVariableAttri);
1355   SetAttributesOnChange(@DefHighlightChange);
1356   MakeMethodTables;
1357   fDefaultFilter := SYNS_FilterSQL;
1358   fRange := rsUnknown;
1359   fDialect := sqlStandard;
1360   SQLDialect := sqlSybase;
1361 end;
1362 
1363 destructor TSynSQLSyn.Destroy;
1364 begin
1365   fKeywords.Free;
1366   fTableNames.Free;
1367   inherited Destroy;
1368 end;
1369 
1370 procedure TSynSQLSyn.Assign(Source: TPersistent);
1371 begin
1372   inherited Assign(Source);
1373   if (Source is TSynSQLSyn) then
1374     SQLDialect := TSynSQLSyn(Source).SQLDialect;
1375 end;
1376 
1377 procedure TSynSQLSyn.SetLine(const NewValue: string; LineNumber: Integer);
1378 begin
1379   inherited;
1380   fLine := PChar(NewValue);
1381   Run := 0;
1382   fLineNumber := LineNumber;
1383   Next;
1384 end;
1385 
1386 procedure TSynSQLSyn.AndSymbolProc;
1387 begin
1388   fTokenID := tkSymbol;
1389   Inc(Run);
1390   if fLine[Run] in ['=', '&'] then Inc(Run);
1391 end;
1392 
1393 procedure TSynSQLSyn.AsciiCharProc;
1394 begin
1395   // Oracle SQL allows strings to go over multiple lines
1396   if fLine[Run] = #0 then
1397     NullProc
1398   else begin
1399     fTokenID := tkString;
1400     // else it's end of multiline string
1401     if SQLDialect <> sqlMySql then begin
1402       if (Run > 0) or (fRange <> rsString) or (fLine[Run] <> #39) then begin
1403         fRange := rsString;
1404         repeat
1405           Inc(Run);
1406         until fLine[Run] in [#0, #10, #13, #39];
1407       end;
1408       if fLine[Run] = #39 then begin
1409         Inc(Run);
1410         fRange := rsUnknown;
1411       end;
1412     end
1413     else begin
1414       if (Run > 0) or (fRange <> rsString) or ((fLine[Run] <> #39) and (fLine[Run-1] <> '\')) then begin
1415         fRange := rsString;
1416         repeat
1417           if (fLine[Run] <> '\') and (fLine[Run+1] = #39) then begin
1418             Inc(Run);
1419             break;
1420           end;
1421           Inc(Run);
1422         until fLine[Run] in [#0, #10, #13];
1423       end;
1424       if (fLine[Run] = #39) and not(fLine[Run-1] = '\') then begin
1425         Inc(Run);
1426         fRange := rsUnknown;
1427       end;
1428     end;
1429   end;
1430 end;
1431 
1432 procedure TSynSQLSyn.CRProc;
1433 begin
1434   fTokenID := tkSpace;
1435   Inc(Run);
1436   if fLine[Run] = #10 then Inc(Run);
1437 end;
1438 
1439 procedure TSynSQLSyn.EqualProc;
1440 begin
1441   fTokenID := tkSymbol;
1442   Inc(Run);
1443   if fLine[Run] in ['=', '>'] then Inc(Run);
1444 end;
1445 
1446 procedure TSynSQLSyn.GreaterProc;
1447 begin
1448   fTokenID := tkSymbol;
1449   Inc(Run);
1450   if fLine[Run] in ['=', '>'] then Inc(Run);
1451 end;
1452 
1453 procedure TSynSQLSyn.IdentProc;
1454 begin
1455   fTokenID := IdentKind((fLine + Run));
1456   inc(Run, fStringLen);
1457 {begin}                                                                         // DJLP 2000-08-11
1458   if fTokenID = tkComment then begin
1459     while not (fLine[Run] in [#0, #10, #13]) do
1460       Inc(Run);
1461   end else
1462 {end}                                                                           // DJLP 2000-08-11
1463     while fIdentifiersPtr^[fLine[Run]] do inc(Run);
1464 end;
1465 
1466 procedure TSynSQLSyn.LFProc;
1467 begin
1468   fTokenID := tkSpace;
1469   inc(Run);
1470 end;
1471 
1472 procedure TSynSQLSyn.LowerProc;
1473 begin
1474   fTokenID := tkSymbol;
1475   Inc(Run);
1476   case fLine[Run] of
1477     '=': Inc(Run);
1478     '<': begin
1479            Inc(Run);
1480            if fLine[Run] = '=' then Inc(Run);
1481          end;
1482   end;
1483 end;
1484 
1485 procedure TSynSQLSyn.MinusProc;
1486 begin
1487   Inc(Run);
1488   if fLine[Run] = '-' then begin
1489     fTokenID := tkComment;
1490     repeat
1491       Inc(Run);
1492     until fLine[Run] in [#0, #10, #13];
1493   end else
1494     fTokenID := tkSymbol;
1495 end;
1496 
1497 procedure TSynSQLSyn.NullProc;
1498 begin
1499   fTokenID := tkNull;
1500 end;
1501 
1502 procedure TSynSQLSyn.NumberProc;
1503 begin
1504   inc(Run);
1505   fTokenID := tkNumber;
1506   while FLine[Run] in ['0'..'9'] do inc(Run);
1507   if (FLine[Run]='.') and not(fLine[Run+1]='.')  then begin
1508     inc(Run);
1509     while FLine[Run] in ['0'..'9'] do inc(Run);
1510   end;
1511   if (FLine[Run]='e') or (fLine[Run]='E')  then begin
1512     inc(Run);
1513     if (FLine[Run]='+') or (fLine[Run]='-')  then inc(Run);
1514     while FLine[Run] in ['0'..'9'] do inc(Run);
1515   end;
1516 end;
1517 
1518 procedure TSynSQLSyn.OrSymbolProc;
1519 begin
1520   fTokenID := tkSymbol;
1521   Inc(Run);
1522   if fLine[Run] in ['=', '|'] then Inc(Run);
1523 end;
1524 
1525 procedure TSynSQLSyn.PlusProc;
1526 begin
1527   fTokenID := tkSymbol;
1528   Inc(Run);
1529   if fLine[Run] in ['=', '+'] then Inc(Run);
1530 end;
1531 
1532 procedure TSynSQLSyn.SlashProc;
1533 begin
1534   Inc(Run);
1535   case fLine[Run] of
1536     '*':
1537       begin
1538         fRange := rsComment;
1539         fTokenID := tkComment;
1540         repeat
1541           Inc(Run);
1542           if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin
1543             fRange := rsUnknown;
1544             Inc(Run, 2);
1545             break;
1546           end;
1547         until fLine[Run] in [#0, #10, #13];
1548       end;
1549     '=':
1550       begin
1551         Inc(Run);
1552         fTokenID := tkSymbol;
1553       end;
1554     else
1555       fTokenID := tkSymbol;
1556   end;
1557 end;
1558 
1559 procedure TSynSQLSyn.SpaceProc;
1560 begin
1561   fTokenID := tkSpace;
1562   repeat
1563     Inc(Run);
1564   until (fLine[Run] > #32) or (fLine[Run] in [#0, #10, #13]);
1565 end;
1566 
1567 procedure TSynSQLSyn.StringProc;
1568 begin
1569   fTokenID := tkString;
1570   Inc(Run);
1571   while not (fLine[Run] in [#0, #10, #13]) do begin
1572     case fLine[Run] of
1573       '\': if fLine[Run + 1] = #34 then
1574              Inc(Run);
1575       #34: if fLine[Run + 1] <> #34 then
1576            begin
1577              Inc(Run);
1578              break;
1579            end;
1580     end;
1581     Inc(Run);
1582   end;
1583 end;
1584 
1585 procedure TSynSQLSyn.SymbolProc;
1586 begin
1587   Inc(Run);
1588   fTokenID := tkSymbol;
1589 end;
1590 
1591 procedure TSynSQLSyn.SymbolAssignProc;
1592 begin
1593   fTokenID := tkSymbol;
1594   Inc(Run);
1595   if fLine[Run] = '=' then Inc(Run);
1596 end;
1597 
1598 procedure TSynSQLSyn.VariableProc;
1599 var
1600   i: integer;
1601 begin
1602   // MS SQL 7 uses @@ to indicate system functions/variables
1603   if (SQLDialect = sqlMSSQL7) and (fLine[Run] = '@') and (fLine[Run + 1] = '@')
1604   then
1605     IdentProc
1606 {begin}                                                                         //JDR 2000-25-2000
1607   else if (SQLDialect in [sqlMySql, sqlOracle]) and (fLine[Run] = '@') then
1608     SymbolProc
1609 {end}                                                                           //JDR 2000-25-2000
1610   // Oracle uses the ':' character to indicate bind variables
1611 {begin}                                                                         //JJV 2000-11-16
1612   // Ingres II also uses the ':' character to indicate variables
1613   else
1614     if not (SQLDialect in [sqlOracle, sqlIngres]) and (fLine[Run] = ':') then
1615 {end}                                                                           //JJV 2000-11-16
1616     SymbolProc
1617   else begin
1618     fTokenID := tkVariable;
1619     i := Run;
1620     repeat
1621       Inc(i);
1622     until not (fIdentifiersPtr^[fLine[i]]);
1623     Run := i;
1624   end;
1625 end;
1626 
1627 procedure TSynSQLSyn.UnknownProc;
1628 begin
1629   if (SQLDialect = sqlMySql) and (fLine[Run] = '#') and (Run = 0) then          //DDH Changes from Tonci Grgin for MYSQL
1630   begin
1631     fTokenID := tkComment;
1632     fRange := rsComment;
1633   end else begin
1634     {$IFDEF SYN_MBCSSUPPORT}
1635     if FLine[Run] in LeadBytes then
1636       Inc(Run,2)
1637     else
1638     {$ENDIF}
1639     inc(Run);
1640     while (fLine[Run] in [#128..#191]) OR // continued utf8 subcode
1641      ((fLine[Run]<>#0) and (fProcTable[fLine[Run]] = @UnknownProc)) do inc(Run);
1642     fTokenID := tkUnknown;
1643   end;
1644 end;
1645 
1646 procedure TSynSQLSyn.AnsiCProc;
1647 begin
1648   case fLine[Run] of
1649      #0: NullProc;
1650     #10: LFProc;
1651     #13: CRProc;
1652     else begin
1653       fTokenID := tkComment;
1654       if (SQLDialect = sqlMySql) and (fLine[Run] = '#') then begin              //DDH Changes from Tonci Grgin for MYSQL
1655         repeat
1656           Inc(Run);
1657         until fLine[Run] in [#0, #10, #13];
1658         fRange := rsUnknown;
1659       end
1660       else begin
1661 
1662         repeat
1663           if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin
1664             fRange := rsUnknown;
1665             Inc(Run, 2);
1666             break;
1667           end;
1668           Inc(Run);
1669         until fLine[Run] in [#0, #10, #13];
1670       end;
1671     end;
1672   end;
1673 end;
1674 
1675 {begin}                                                                         // DJLP 2000-08-09
IsKeywordnull1676 function TSynSQLSyn.IsKeyword(const AKeyword: string): boolean;
1677 var
1678   tk: TtkTokenKind;
1679 begin
1680   tk := IdentKind(PChar(AKeyword));
1681   Result := tk in [tkDatatype, tkException, tkFunction, tkKey, tkPLSQL,
1682     tkDefaultPackage];
1683 end;
1684 {end}                                                                           // DJLP 2000-08-09
1685 
1686 procedure TSynSQLSyn.Next;
1687 begin
1688   fTokenPos := Run;
1689   case fRange of
1690     rsComment:
1691       AnsiCProc;
1692     rsString:
1693       AsciiCharProc;
1694   else
1695     fProcTable[fLine[Run]]();
1696   end;
1697 end;
1698 
GetDefaultAttributenull1699 function TSynSQLSyn.GetDefaultAttribute(Index: integer):
1700   TSynHighlighterAttributes;
1701 begin
1702   case Index of
1703     SYN_ATTR_COMMENT: Result := fCommentAttri;
1704     SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
1705     SYN_ATTR_KEYWORD: Result := fKeyAttri;
1706     SYN_ATTR_STRING: Result := fStringAttri;
1707     SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
1708     SYN_ATTR_SYMBOL: Result := fSymbolAttri;
1709     SYN_ATTR_NUMBER: Result := fNumberAttri;
1710     SYN_ATTR_VARIABLE: Result := fVariableAttri;
1711   else
1712     Result := nil;
1713   end;
1714 end;
1715 
GetEolnull1716 function TSynSQLSyn.GetEol: Boolean;
1717 begin
1718   Result := fTokenID = tkNull;
1719 end;
1720 
GetRangenull1721 function TSynSQLSyn.GetRange: Pointer;
1722 begin
1723   Result := Pointer(PtrInt(fRange));
1724 end;
1725 
GetTokennull1726 function TSynSQLSyn.GetToken: string;
1727 var
1728   Len: LongInt;
1729 begin
1730   Result := '';
1731   Len := Run - fTokenPos;
1732   Setstring(Result, (FLine + fTokenPos), Len);
1733 end;
1734 
1735 procedure TSynSQLSyn.GetTokenEx(out TokenStart: PChar; out TokenLength: integer);
1736 begin
1737   TokenLength:=Run-fTokenPos;
1738   TokenStart:=FLine + fTokenPos;
1739 end;
1740 
GetTokenIDnull1741 function TSynSQLSyn.GetTokenID: TtkTokenKind;
1742 begin
1743   Result := fTokenId;
1744 end;
1745 
GetTokenAttributenull1746 function TSynSQLSyn.GetTokenAttribute: TSynHighlighterAttributes;
1747 begin
1748   case GetTokenID of
1749     tkComment: Result := fCommentAttri;
1750     tkDatatype: Result := fDataTypeAttri;
1751     tkDefaultPackage: Result := fDefaultPackageAttri;                           // DJLP 2000-08-11
1752     tkException: Result := fExceptionAttri;
1753     tkFunction: Result := fFunctionAttri;
1754     tkIdentifier: Result := fIdentifierAttri;
1755     tkKey: Result := fKeyAttri;
1756     tkNumber: Result := fNumberAttri;
1757     tkPLSQL: Result := fPLSQLAttri;                                             // DJLP 2000-08-11
1758     tkSpace: Result := fSpaceAttri;
1759     tkSQLPlus: Result := fSQLPlusAttri;                                         // DJLP 2000-08-11
1760     tkString: Result := fStringAttri;
1761     tkSymbol: Result := fSymbolAttri;
1762     tkTableName: Result := fTableNameAttri;
1763     tkVariable: Result := fVariableAttri;
1764     tkUnknown: Result := fIdentifierAttri;
1765   else
1766     Result := nil;
1767   end;
1768 end;
1769 
GetTokenKindnull1770 function TSynSQLSyn.GetTokenKind: integer;
1771 begin
1772   Result := Ord(fTokenId);
1773 end;
1774 
GetTokenPosnull1775 function TSynSQLSyn.GetTokenPos: Integer;
1776 begin
1777   Result := fTokenPos;
1778 end;
1779 
1780 procedure TSynSQLSyn.ResetRange;
1781 begin
1782   fRange := rsUnknown;
1783 end;
1784 
1785 procedure TSynSQLSyn.SetRange(Value: Pointer);
1786 begin
1787   fRange := TRangeState(PtrUInt(Value));
1788 end;
1789 
GetIdentCharsnull1790 function TSynSQLSyn.GetIdentChars: TSynIdentChars;
1791 begin
1792   Result := TSynValidStringChars;
1793   if (fDialect = sqlMSSQL7) or (fDialect = sqlMSSQL2K) then
1794     Include(Result, '@')
1795 {begin}                                                                         // DJLP 2000-08-11
1796   else if fDialect = sqlOracle then begin
1797     Include(Result, '#');
1798     Include(Result, '$');
1799   end
1800 {end}                                                                           // DJLP 2000-08-11
1801   else if (fDialect = sqlFirebird25) or
1802           (fDialect = sqlFirebird30) or
1803           (fDialect = sqlFirebird40) then Include(Result, '$');
1804 end;
1805 
1806 class function TSynSQLSyn.GetLanguageName: string;
1807 begin
1808   Result := SYNS_LangSQL;
1809 end;
1810 
1811 procedure TSynSQLSyn.DoAddKeyword(AKeyword: string; AKind: integer);
1812 var
1813   HashValue: integer;
1814 begin
1815   HashValue := KeyHash(PChar(AKeyword));
1816   fKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
1817 end;
1818 
1819 procedure TSynSQLSyn.SetTableNames(const Value: TStrings);
1820 begin
1821   fTableNames.Assign(Value);
1822 end;
1823 
1824 procedure TSynSQLSyn.TableNamesChanged(Sender: TObject);
1825 begin
1826   InitializeKeywordLists;
1827 end;
1828 
1829 procedure TSynSQLSyn.PutTableNamesInKeywordList;
1830 var
1831   i: Integer;
1832   Entry: TSynHashEntry;
1833 begin
1834   for i := 0 to (fTableNames.Count - 1) do
1835   begin
1836     Entry := fKeywords[KeyHash(PChar(fTableNames[i]))];
1837     while Assigned(Entry) do
1838     begin
1839       if CompareText(Entry.Keyword, fTableNames[i]) = 0 then
1840         Break;
1841       Entry := Entry.Next;
1842     end;
1843     if not Assigned(Entry) then
1844       DoAddKeyword(fTableNames[i], Ord(tkTableName));
1845   end;
1846 end;
1847 
1848 procedure TSynSQLSyn.InitializeKeywordLists;
1849 begin
1850   fKeywords.Clear;
1851   if (fDialect in [sqlMSSQL7, sqlMSSQL2K]) then
1852   begin
1853     fIdentifiersPtr := @IdentifiersMSSQL7;
1854     fmHashTablePtr := @mHashTableMSSQL7;
1855   end else begin
1856     fIdentifiersPtr := @Identifiers;
1857     fmHashTablePtr := @mHashTable;
1858   end;
1859 
1860   case fDialect of
1861     sqlPostgres:
1862       begin
1863         EnumerateKeywords(Ord(tkKey), PostgresKW, IdentChars, @DoAddKeyword);
1864         EnumerateKeywords(Ord(tkDatatype), PostgresTypes, IdentChars,
1865           @DoAddKeyword);
1866         EnumerateKeywords(Ord(tkFunction), PostgresFunctions, IdentChars,
1867           @DoAddKeyword);
1868         EnumerateKeywords(Ord(tkException), PostgresExceptions, IdentChars,
1869           @DoAddKeyword);
1870       end;
1871     sqlSqlite:
1872       begin
1873         EnumerateKeywords(Ord(tkDatatype), SQLiteTypes, IdentChars,
1874           @DoAddKeyword);
1875         EnumerateKeywords(Ord(tkFunction), SQLiteFunctions, IdentChars,
1876           @DoAddKeyword);
1877         EnumerateKeywords(Ord(tkKey), SQLiteKW, IdentChars, @DoAddKeyword);
1878       end;
1879     sqlIngres:
1880       begin
1881         EnumerateKeywords(Ord(tkDatatype), IngresTypes, IdentChars,
1882           @DoAddKeyword);
1883         EnumerateKeywords(Ord(tkKey), IngresKW, IdentChars, @DoAddKeyword);
1884         EnumerateKeywords(Ord(tkFunction), IngresFunctions, IdentChars,
1885           @DoAddKeyword);
1886       end;
1887     sqlInterbase6:
1888       begin
1889         EnumerateKeywords(Ord(tkDatatype), Interbase6Types, IdentChars,
1890           @DoAddKeyword);
1891         EnumerateKeywords(Ord(tkFunction), Interbase6Functions, IdentChars,
1892           @DoAddKeyword);
1893         EnumerateKeywords(Ord(tkKey), Interbase6KW, IdentChars, @DoAddKeyword);
1894       end;
1895     sqlMSSQL7:
1896       begin
1897         EnumerateKeywords(Ord(tkKey), MSSQL7KW, IdentChars, @DoAddKeyword);
1898         EnumerateKeywords(Ord(tkDatatype), MSSQL7Types, IdentChars,
1899           @DoAddKeyword);
1900         EnumerateKeywords(Ord(tkFunction), MSSQL7Functions, IdentChars,
1901           @DoAddKeyword);
1902       end;
1903     sqlMSSQL2K:
1904       begin
1905         EnumerateKeywords(ord(tkKey), MSSQL2000KW, IdentChars, @DoAddKeyword);
1906         EnumerateKeywords(ord(tkDataType), MSSQL2000Types, IdentChars, @DoAddKeyword);
1907         EnumerateKeywords(ord(tkFunction), MSSQL2000Functions, IdentChars, @DoAddKeyword);
1908       end;
1909     sqlMySql:
1910       begin
1911         EnumerateKeywords(Ord(tkKey), MySqlKW, IdentChars, @DoAddKeyword);
1912         EnumerateKeywords(Ord(tkDatatype), MySqlTypes, IdentChars,
1913           @DoAddKeyword);
1914         EnumerateKeywords(Ord(tkFunction), MySqlFunctions, IdentChars,
1915           @DoAddKeyword);
1916       end;
1917     sqlOracle:
1918       begin
1919         EnumerateKeywords(Ord(tkKey), OracleKW, IdentChars, @DoAddKeyword);
1920         EnumerateKeywords(Ord(tkDatatype), OracleTypes, IdentChars,
1921           @DoAddKeyword);
1922         EnumerateKeywords(Ord(tkException), OracleExceptions, IdentChars,
1923           @DoAddKeyword);
1924         EnumerateKeywords(Ord(tkFunction), OracleFunctions, IdentChars,
1925           @DoAddKeyword);
1926         EnumerateKeywords(Ord(tkComment), OracleCommentKW, IdentChars,
1927           @DoAddKeyword);
1928         EnumerateKeywords(Ord(tkDefaultPackage), OracleDefaultPackages,
1929           IdentChars, @DoAddKeyword);
1930         EnumerateKeywords(Ord(tkPLSQL), OraclePLSQLKW, IdentChars,
1931           @DoAddKeyword);
1932         EnumerateKeywords(Ord(tkSQLPlus), OracleSQLPlusCommands, IdentChars,
1933           @DoAddKeyword);
1934       end;
1935     sqlStandard:
1936       EnumerateKeywords(Ord(tkKey), StandardKW, IdentChars + ['-'], @DoAddKeyword);
1937     sqlSybase:
1938       EnumerateKeywords(Ord(tkKey), SybaseKW, IdentChars, @DoAddKeyword);
1939     sqlFirebird25:
1940       EnumerateKeywords(Ord(tkKey), Firebird25KW, IdentChars, @DoAddKeyword);
1941     sqlFirebird30:
1942       EnumerateKeywords(Ord(tkKey), Firebird30KW, IdentChars, @DoAddKeyword);
1943     sqlFirebird40:
1944       EnumerateKeywords(Ord(tkKey), Firebird40KW, IdentChars, @DoAddKeyword);
1945   end;
1946   PutTableNamesInKeywordList;
1947   DefHighlightChange(Self);
1948 end;
1949 
1950 procedure TSynSQLSyn.SetDialect(Value: TSQLDialect);
1951 begin
1952   if (Value <> fDialect) then
1953   begin
1954     fDialect := Value;
1955     InitializeKeywordLists;
1956   end;
1957 end;
1958 
GetSampleSourcenull1959 function TSynSQLSyn.GetSampleSource: String;
1960 begin
1961   Result:= '';
1962   case fDialect of
1963     sqlPostgres:
1964       Result := '-- PostgreSQL SQL sample source'#13#10 +
1965         'SELECT datname'#13#10 +
1966         'FROM pg_database'#13#10 +
1967         'WHERE datname = ''postgres'';';
1968     sqlStandard:
1969       Result := '-- ansi sql sample source'#13#10 +
1970         'select name , region'#13#10 +
1971         'from cia'#13#10 +
1972         'where area < 2000'#13#10 +
1973         'and gdp > 5000000000';
1974     sqlInterbase6:
1975       Result := '/* Interbase sample source */'#13#10 +
1976         'SET TERM !! ;'#13#10 +
1977         #13#10 +
1978         'CREATE PROCEDURE HelloWorld(P_MSG VARCHAR(80)) AS'#13#10 +
1979         'BEGIN'#13#10 +
1980         '  EXECUTE PROCEDURE WRITELN(:P_MSG);'#13#10 +
1981         'END !!'#13#10 +
1982         #13#10 +
1983         'SET TERM ; !!';
1984     sqlMySQL:
1985       Result := '/* MySQL sample source*/'#13#10 +
1986         'SET @variable= { 1 }'#13#10 +
1987         #13#10 +
1988         'CREATE TABLE sample ('#13#10 +
1989         '        id INT NOT NULL,'#13#10 +
1990         '        first_name CHAR(30) NOT NULL,'#13#10 +
1991         '        PRIMARY KEY (id),'#13#10 +
1992         '        INDEX name (first_name));'#13#10 +
1993         #13#10 +
1994         'SELECT DATE_ADD("1997-12-31 23:59:59",'#13#10 +
1995         '        INTERVAL 1 SECOND);'#13#10 +
1996         #13#10 +
1997         '# End of sample';
1998     sqlOracle:
1999       Result := 'PROMPT Oracle sample source'#13#10 +
2000         'declare'#13#10 +
2001         '  x varchar2(2000);'#13#10 +
2002         'begin   -- Show some text here'#13#10 +
2003         '  select to_char(count(*)) into x'#13#10 +
2004         '  from tab;'#13#10 +
2005         #13#10 +
2006         '  dbms_output.put_line(''Hello World: '' || x);'#13#10 +
2007         'exception'#13#10 +
2008         '  when others then'#13#10 +
2009         '    null;'#13#10 +
2010         'end;';
2011     sqlSybase:
2012       Result := '/* SyBase example source */'#13#10 +
2013         'declare @Integer        int'#13#10 +
2014         #13#10 +
2015         '/* Good for positive numbers only. */'#13#10 +
2016         'select @Integer = 1000'#13#10 +
2017         #13#10 +
2018         'select "Positives Only" ='#13#10 +
2019         '  right(replicate("0",12) + '#13#10 +
2020         '    convert(varchar, @Integer),12)'#13#10 +
2021         #13#10 +
2022         '/* Good for positive and negative numbers. */'#13#10 +
2023         'select @Integer = -1000'#13#10 +
2024         #13#10 +
2025         'select "Both Signs" ='#13#10 +
2026         '  substring( "- +", (sign(@Integer) + 2), 1) +'#13#10 +
2027         '  right(replicate("0",12) + '#13#10 +
2028         '    convert(varchar, abs(@Integer)),12)'#13#10 +
2029         #13#10 +
2030         'select @Integer = 1000'#13#10 +
2031         #13#10 +
2032         'select "Both Signs" ='#13#10 +
2033         '  substring( "- +", (sign(@Integer) + 2), 1) +'#13#10 +
2034         '  right(replicate("0",12) + '#13#10 +
2035         '    convert(varchar, abs(@Integer)),12)'#13#10 +
2036         #13#10 +
2037         'go';
2038     sqlIngres:
2039       Result := '/* Ingres example source */'#13#10 +
2040         'DELETE'#13#10 +
2041         'FROM t1'#13#10 +
2042         'WHERE EXISTS'#13#10 +
2043         '(SELECT t2.column1, t2.column2'#13#10 +
2044         'FROM t2'#13#10 +
2045         'WHERE t1.column1 = t2.column1 and'#13#10 +
2046         't1.column2 = t2.column2)';
2047     sqlMSSQL7:
2048       Result := '/* SQL Server 7 example source */'#13#10 +
2049         'SET QUOTED_IDENTIFIER OFF'#13#10 +
2050         'GO'#13#10 +
2051         'SET ANSI_NULLS OFF'#13#10 +
2052         'GO'#13#10 +
2053         #13#10 +
2054         '/* Object:  Stored Procedure dbo.sp_PPQInsertOrder */'#13#10 +
2055         'CREATE PROCEDURE sp_PPQInsertOrder'#13#10 +
2056         '  @Name    varchar(25),'#13#10 +
2057         '  @Address varchar(255),'#13#10 +
2058         '  @ZipCode varchar(15)'#13#10 +
2059         'As'#13#10 +
2060         '  INSERT INTO PPQOrders(Name, Address, ZipCode, OrderDate)'#13#10 +
2061         '  VALUES (@Name, @Address, @ZipCode, GetDate())'#13#10 +
2062         #13#10 +
2063         '  SELECT SCOPE_IDENTITY()'#13#10 +
2064         'GO';
2065     sqlMSSQL2K:
2066       Result := '/* SQL Server2000 example source */'#13#10 +
2067         'SET QUOTED_IDENTIFIER OFF'#13#10 +
2068         'GO'#13#10 +
2069         'SET ANSI_NULLS OFF'#13#10 +
2070         'GO'#13#10 +
2071         #13#10 +
2072         '/* Object:  Stored Procedure dbo.sp_PPQInsertOrder */'#13#10 +
2073         'CREATE PROCEDURE sp_PPQInsertOrder'#13#10 +
2074         '  @Name    varchar(25),'#13#10 +
2075         '  @Address varchar(255),'#13#10 +
2076         '  @ZipCode varchar(15)'#13#10 +
2077         'As'#13#10 +
2078         '  INSERT INTO PPQOrders(Name, Address, ZipCode, OrderDate)'#13#10 +
2079         '  VALUES (@Name, @Address, @ZipCode, GetDate())'#13#10 +
2080         #13#10 +
2081         '  SELECT SCOPE_IDENTITY()'#13#10 +
2082         'GO';
2083   end;
2084 end;
2085 
2086 initialization
2087   MakeIdentTable;
2088   RegisterPlaceableHighlighter(TSynSQLSyn);
2089 
2090 end.
2091