00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "postgres_fe.h"
00013
00014 #include <ctype.h>
00015
00016 #include "extern.h"
00017 #include "preproc.h"
00018
00019
00020 extern const ScanKeyword SQLScanKeywords[];
00021 extern const int NumSQLScanKeywords;
00022
00023
00024
00025
00026
00027
00028
00029 static const ScanKeyword ECPGScanKeywords[] = {
00030
00031
00032
00033
00034
00035
00036 {"allocate", SQL_ALLOCATE, 0},
00037 {"autocommit", SQL_AUTOCOMMIT, 0},
00038 {"bool", SQL_BOOL, 0},
00039 {"break", SQL_BREAK, 0},
00040 {"call", SQL_CALL, 0},
00041 {"cardinality", SQL_CARDINALITY, 0},
00042 {"connect", SQL_CONNECT, 0},
00043 {"count", SQL_COUNT, 0},
00044 {"datetime_interval_code", SQL_DATETIME_INTERVAL_CODE, 0},
00045 {"datetime_interval_precision", SQL_DATETIME_INTERVAL_PRECISION, 0},
00046 {"describe", SQL_DESCRIBE, 0},
00047 {"descriptor", SQL_DESCRIPTOR, 0},
00048 {"disconnect", SQL_DISCONNECT, 0},
00049 {"found", SQL_FOUND, 0},
00050 {"free", SQL_FREE, 0},
00051 {"get", SQL_GET, 0},
00052 {"go", SQL_GO, 0},
00053 {"goto", SQL_GOTO, 0},
00054 {"identified", SQL_IDENTIFIED, 0},
00055 {"indicator", SQL_INDICATOR, 0},
00056 {"key_member", SQL_KEY_MEMBER, 0},
00057 {"length", SQL_LENGTH, 0},
00058 {"long", SQL_LONG, 0},
00059 {"nullable", SQL_NULLABLE, 0},
00060 {"octet_length", SQL_OCTET_LENGTH, 0},
00061 {"open", SQL_OPEN, 0},
00062 {"output", SQL_OUTPUT, 0},
00063 {"reference", SQL_REFERENCE, 0},
00064 {"returned_length", SQL_RETURNED_LENGTH, 0},
00065 {"returned_octet_length", SQL_RETURNED_OCTET_LENGTH, 0},
00066 {"scale", SQL_SCALE, 0},
00067 {"section", SQL_SECTION, 0},
00068 {"short", SQL_SHORT, 0},
00069 {"signed", SQL_SIGNED, 0},
00070 {"sql", SQL_SQL, 0},
00071
00072 {"sqlerror", SQL_SQLERROR, 0},
00073 {"sqlprint", SQL_SQLPRINT, 0},
00074 {"sqlwarning", SQL_SQLWARNING, 0},
00075 {"stop", SQL_STOP, 0},
00076 {"struct", SQL_STRUCT, 0},
00077 {"unsigned", SQL_UNSIGNED, 0},
00078 {"var", SQL_VAR, 0},
00079 {"whenever", SQL_WHENEVER, 0},
00080 };
00081
00082
00083
00084
00085
00086
00087
00088 const ScanKeyword *
00089 ScanECPGKeywordLookup(const char *text)
00090 {
00091 const ScanKeyword *res;
00092
00093
00094 res = ScanKeywordLookup(text, SQLScanKeywords, NumSQLScanKeywords);
00095 if (res)
00096 return res;
00097
00098
00099 res = ScanKeywordLookup(text, ECPGScanKeywords, lengthof(ECPGScanKeywords));
00100 if (res)
00101 return res;
00102
00103 return NULL;
00104 }