ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/IBUtils.pas
(Generate patch)

Comparing ibx/trunk/fbintf/IBUtils.pas (file contents):
Revision 45 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 47 by tony, Mon Jan 9 15:31:51 2017 UTC

# Line 55 | Line 55 | const
55    TAB  = #9;
56    NULL_TERMINATOR = #0;
57  
58 <  sqlReservedWords: array [0..166] of string = (
59 <  'ADD','ADMIN','ALL','ALTER','AND','ANY','AS','AT','AVG','BEGIN','BETWEEN','BIGINT','BIT_LENGTH','BLOB','BOTH',
60 < 'BY','CASE','CAST','CHAR','CHAR_LENGTH','CHARACTER','CHARACTER_LENGTH','CHECK','CLOSE','COLLATE','COLUMN',
61 < 'COMMIT','CONNECT','CONSTRAINT','COUNT','CREATE','CROSS','CURRENT','CURRENT_CONNECTION','CURRENT_DATE',
62 < 'CURRENT_ROLE','CURRENT_TIME','CURRENT_TIMESTAMP','CURRENT_TRANSACTION','CURRENT_USER','CURSOR','DATE',
63 < 'DAY','DEC','DECIMAL','DECLARE','DEFAULT','DELETE','DISCONNECT','DISTINCT','DOUBLE','DROP','ELSE','END',
64 < 'ESCAPE','EXECUTE','EXISTS','EXTERNAL','EXTRACT','FETCH','FILTER','FLOAT','FOR','FOREIGN','FROM','FULL',
65 < 'FUNCTION','GDSCODE','GLOBAL','GRANT','GROUP','HAVING','HOUR','IN','INDEX','INNER','INSENSITIVE','INSERT',
66 < 'INT','INTEGER','INTO','IS','JOIN','LEADING','LEFT','LIKE','LONG','LOWER','MAX','MAXIMUM_SEGMENT','MERGE',
67 < 'MIN','MINUTE','MONTH','NATIONAL','NATURAL','NCHAR','NO','NOT','NULL','NUMERIC','OCTET_LENGTH','OF','ON',
68 < 'ONLY','OPEN','OR','ORDER','OUTER','PARAMETER','PLAN','POSITION','POST_EVENT','PRECISION','PRIMARY',
69 < 'PROCEDURE','RDB$DB_KEY','REAL','RECORD_VERSION','RECREATE','RECURSIVE','REFERENCES','RELEASE','RETURNING_VALUES',
70 < 'RETURNS','REVOKE','RIGHT','ROLLBACK','ROW_COUNT','ROWS','SAVEPOINT','SECOND','SELECT','SENSITIVE',
71 < 'SET','SIMILAR','SMALLINT','SOME','SQLCODE','SQLSTATE','START','SUM','TABLE','THEN','TIME',
72 < 'TIMESTAMP','TO','TRAILING','TRIGGER','TRIM','UNION','UNIQUE','UPDATE','UPPER','USER','USING',
73 < 'VALUE','VALUES','VARCHAR','VARIABLE','VARYING','VIEW','WHEN','WHERE','WHILE','WITH','YEAR');
58 >  sqlReservedWords: array [0..197] of string = (
59 >  'ADD',
60 >  'ADMIN',
61 >  'ALL',
62 >  'ALTER',
63 >  'AND',
64 >  'ANY',
65 >  'AS',
66 >  'AT',
67 >  'AVG',
68 >  'BEGIN',
69 >  'BETWEEN',
70 >  'BIGINT',
71 >  'BIT_LENGTH',
72 >  'BLOB',
73 >  'BOOLEAN',
74 >  'BOTH',
75 >  'BY',
76 >  'CASE',
77 >  'CAST',
78 >  'CHAR',
79 >  'CHAR_LENGTH',
80 >  'CHARACTER',
81 >  'CHARACTER_LENGTH',
82 >  'CHECK',
83 >  'CLOSE',
84 >  'COLLATE',
85 >  'COLUMN',
86 >  'COMMIT',
87 >  'CONNECT',
88 >  'CONSTRAINT',
89 >  'CORR',
90 >  'COUNT',
91 >  'COVAR_POP',
92 >  'COVAR_SAMP',
93 >  'CREATE',
94 >  'CROSS',
95 >  'CURRENT',
96 >  'CURRENT_CONNECTION',
97 >  'CURRENT_DATE',
98 >  'CURRENT_ROLE',
99 >  'CURRENT_TIME',
100 >  'CURRENT_TIMESTAMP',
101 >  'CURRENT_TRANSACTION',
102 >  'CURRENT_USER',
103 >  'CURSOR',
104 >  'DATE',
105 >  'DAY',
106 >  'DEC',
107 >  'DECIMAL',
108 >  'DECLARE',
109 >  'DEFAULT',
110 >  'DELETE',
111 >  'DELETING',
112 >  'DETERMINISTIC',
113 >  'DISCONNECT',
114 >  'DISTINCT',
115 >  'DOUBLE',
116 >  'DROP',
117 >  'ELSE',
118 >  'END',
119 >  'ESCAPE',
120 >  'EXECUTE',
121 >  'EXISTS',
122 >  'EXTERNAL',
123 >  'EXTRACT',
124 >  'FALSE',
125 >  'FETCH',
126 >  'FILTER',
127 >  'FLOAT',
128 >  'FOR',
129 >  'FOREIGN',
130 >  'FROM',
131 >  'FULL',
132 >  'FUNCTION',
133 >  'GDSCODE',
134 >  'GLOBAL',
135 >  'GRANT',
136 >  'GROUP',
137 >  'HAVING',
138 >  'HOUR',
139 >  'IN',
140 >  'INDEX',
141 >  'INNER',
142 >  'INSENSITIVE',
143 >  'INSERT',
144 >  'INSERTING',
145 >  'INT',
146 >  'INTEGER',
147 >  'INTO',
148 >  'IS',
149 >  'JOIN',
150 >  'LEADING',
151 >  'LEFT',
152 >  'LIKE',
153 >  'LONG',
154 >  'LOWER',
155 >  'MAX',
156 >  'MAXIMUM_SEGMENT',
157 >  'MERGE',
158 >  'MIN',
159 >  'MINUTE',
160 >  'MONTH',
161 >  'NATIONAL',
162 >  'NATURAL',
163 >  'NCHAR',
164 >  'NO',
165 >  'NOT',
166 >  'NULL',
167 >  'NUMERIC',
168 >  'OCTET_LENGTH',
169 >  'OF',
170 >  'OFFSET',
171 >  'ON',
172 >  'ONLY',
173 >  'OPEN',
174 >  'OR',
175 >  'ORDER',
176 >  'OUTER',
177 >  'OVER',
178 >  'PARAMETER',
179 >  'PLAN',
180 >  'POSITION',
181 >  'POST_EVENT',
182 >  'PRECISION',
183 >  'PRIMARY',
184 >  'PROCEDURE',
185 >  'RDB$DB_KEY',
186 >  'RDB$RECORD_VERSION',
187 >  'REAL',
188 >  'RECORD_VERSION',
189 >  'RECREATE',
190 >  'RECURSIVE',
191 >  'REFERENCES',
192 >  'REGR_AVGX',
193 >  'REGR_AVGY',
194 >  'REGR_COUNT',
195 >  'REGR_INTERCEPT',
196 >  'REGR_R2',
197 >  'REGR_SLOPE',
198 >  'REGR_SXX',
199 >  'REGR_SXY',
200 >  'REGR_SYY',
201 >  'RELEASE',
202 >  'RETURN',
203 >  'RETURNING_VALUES',
204 >  'RETURNS',
205 >  'REVOKE',
206 >  'RIGHT',
207 >  'ROLLBACK',
208 >  'ROW',
209 >  'ROW_COUNT',
210 >  'ROWS',
211 >  'SAVEPOINT',
212 >  'SCROLL',
213 >  'SECOND',
214 >  'SELECT',
215 >  'SENSITIVE',
216 >  'SET',
217 >  'SIMILAR',
218 >  'SMALLINT',
219 >  'SOME',
220 >  'SQLCODE',
221 >  'SQLSTATE',
222 >  'SQLSTATE',
223 >  'START',
224 >  'STDDEV_POP',
225 >  'STDDEV_SAMP',
226 >  'SUM',
227 >  'TABLE',
228 >  'THEN',
229 >  'TIME',
230 >  'TIMESTAMP',
231 >  'TO',
232 >  'TRAILING',
233 >  'TRIGGER',
234 >  'TRIM',
235 >  'TRUE',
236 >  'UNION',
237 >  'UNIQUE',
238 >  'UNKNOWN',
239 >  'UPDATE',
240 >  'UPDATING',
241 >  'UPPER',
242 >  'USER',
243 >  'USING',
244 >  'VALUE',
245 >  'VALUES',
246 >  'VAR_POP',
247 >  'VAR_SAMP',
248 >  'VARCHAR',
249 >  'VARIABLE',
250 >  'VARYING',
251 >  'VIEW',
252 >  'WHEN',
253 >  'WHERE',
254 >  'WHILE',
255 >  'WITH',
256 >  'YEAR'
257 >  );
258  
259   function Max(n1, n2: Integer): Integer;
260   function Min(n1, n2: Integer): Integer;
# Line 84 | Line 268 | function ExtractIdentifier(Dialect: Inte
268   function QuoteIdentifier(Dialect: Integer; Value: String): String;
269   function QuoteIdentifierIfNeeded(Dialect: Integer; Value: String): String;
270   function Space2Underscore(s: string): string;
271 + function SQLSafeString(const s: string): string;
272  
273   implementation
274  
# Line 236 | Line 421 | begin
421              Result[k] := '_';
422   end;
423  
424 + function SQLSafeString(const s: string): string;
425 + begin
426 +  Result := StringReplace(s,'''','''''',[rfReplaceAll]);
427 + end;
428  
429   end.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines