KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > entity > model > ModelEntityChecker


1 /*
2  * $Id: ModelEntityChecker.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2001-2005 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */

24 package org.ofbiz.entity.model;
25
26 import java.util.Collection JavaDoc;
27 import java.util.Iterator JavaDoc;
28 import java.util.List JavaDoc;
29 import java.util.Map JavaDoc;
30 import java.util.TreeSet JavaDoc;
31
32 import javolution.util.FastMap;
33
34 import org.ofbiz.base.util.Debug;
35 import org.ofbiz.base.util.UtilValidate;
36 import org.ofbiz.entity.GenericDelegator;
37 import org.ofbiz.entity.GenericEntityException;
38
39 /**
40  * Generic Entity - Entity Definition Checker
41  *
42  * @author <a HREF="mailto:jonesde@ofbiz.org">David E. Jones </a>
43  * @version $Rev: 5462 $
44  * @since 3.1
45  */

46 public class ModelEntityChecker {
47
48     public static final String JavaDoc module = ModelEntityChecker.class.getName();
49
50     public static void checkEntities(GenericDelegator delegator, List JavaDoc warningList) throws GenericEntityException {
51         ModelReader reader = delegator.getModelReader();
52
53         TreeSet JavaDoc reservedWords = new TreeSet JavaDoc();
54         initReservedWords(reservedWords);
55
56         Map JavaDoc packages = FastMap.newInstance();
57         TreeSet JavaDoc packageNames = new TreeSet JavaDoc();
58         TreeSet JavaDoc tableNames = new TreeSet JavaDoc();
59
60         //put the entityNames TreeSets in a HashMap by packageName
61
Collection JavaDoc ec = reader.getEntityNames();
62         TreeSet JavaDoc entityNames = new TreeSet JavaDoc(ec);
63         Iterator JavaDoc ecIter = ec.iterator();
64         while (ecIter.hasNext()) {
65             String JavaDoc eName = (String JavaDoc) ecIter.next();
66             ModelEntity ent = reader.getModelEntity(eName);
67
68             //make sure the table name is in the list of all table names, if
69
// not null
70
if (UtilValidate.isNotEmpty(ent.getPlainTableName()))
71                     tableNames.add(ent.getPlainTableName());
72
73             TreeSet JavaDoc entities = (TreeSet JavaDoc) packages.get(ent.getPackageName());
74             if (entities == null) {
75                 entities = new TreeSet JavaDoc();
76                 packages.put(ent.getPackageName(), entities);
77                 packageNames.add(ent.getPackageName());
78             }
79             entities.add(eName);
80         }
81         //int numberOfEntities = ec.size();
82
int numberShowed = 0;
83
84         TreeSet JavaDoc fkNames = new TreeSet JavaDoc();
85         TreeSet JavaDoc indexNames = new TreeSet JavaDoc();
86
87         Iterator JavaDoc piter = packageNames.iterator();
88         while (piter.hasNext()) {
89             String JavaDoc pName = (String JavaDoc) piter.next();
90             TreeSet JavaDoc entities = (TreeSet JavaDoc) packages.get(pName);
91             Iterator JavaDoc i = entities.iterator();
92             while (i.hasNext()) {
93                 String JavaDoc entityName = (String JavaDoc) i.next();
94                 String JavaDoc helperName = delegator.getEntityHelperName(entityName);
95                 String JavaDoc groupName = delegator.getEntityGroupName(entityName);
96                 ModelEntity entity = reader.getModelEntity(entityName);
97                 if (helperName == null) {
98                     warningList.add("[HelperNotFound] No Helper (DataSource) definition found for entity " + entity.getEntityName() + ".");
99                     //only show group name warning if helper name not found
100
if (groupName == null) {
101                             warningList.add("[GroupNotFound] No Group Name found for entity " + entity.getEntityName() + ".");
102                     }
103                 }
104                 if (entity.getPlainTableName() != null && entity.getPlainTableName().length() > 30) {
105                         warningList.add("[TableNameGT30] Table name [" + entity.getPlainTableName() + "] of entity " + entity.getEntityName() + " is longer than 30 characters.");
106                 }
107                 if (entity.getPlainTableName() != null && reservedWords.contains(entity.getPlainTableName().toUpperCase())) {
108                         warningList.add("[TableNameRW] Table name [" + entity.getPlainTableName() + "] of entity " + entity.getEntityName() + " is a reserved word.");
109                 }
110                 TreeSet JavaDoc ufields = new TreeSet JavaDoc();
111                 Iterator JavaDoc fieldIter = entity.getFieldsIterator();
112                 while (fieldIter.hasNext()) {
113                     ModelField field = (ModelField) fieldIter.next();
114                     ModelFieldType type = delegator.getEntityFieldType(entity,field.getType());
115
116                     if (ufields.contains(field.getName())) {
117                         warningList.add("[FieldNotUnique] Field [" + field.getName() + " of entity " + entity.getEntityName() + " is not unique for that entity.");
118                     } else {
119                         ufields.add(field.getName());
120                     }
121                     if (field.getColName().length() > 30 && !(entity instanceof ModelViewEntity)) {
122                         warningList.add("[FieldNameGT30] Column name [" + field.getColName() + "] of entity " + entity.getEntityName() + " is longer than 30 characters.");
123                     }
124                     if (field.getColName().length() == 0) {
125                         warningList.add("[FieldNameEQ0] Column name for field name \"" + field.getName() + "\" of entity " + entity.getEntityName() + " is empty (zero length).");
126                     }
127                     if (reservedWords.contains(field.getColName().toUpperCase()))
128                             warningList.add("[FieldNameRW] Column name " + field.getColName() + " of entity " + entity.getEntityName() + " is a reserved word.");
129                     if (type == null) {
130                         StringBuffer JavaDoc warningMsg = new StringBuffer JavaDoc();
131                         warningMsg.append("[FieldTypeNotFound] Field type " + field.getType() + " of entity " + entity.getEntityName() + " not found in field type definitions");
132                         if (helperName == null) {
133                             warningMsg.append(" (no helper definition found)");
134                         }
135                         warningMsg.append(".");
136                         warningList.add(warningMsg.toString());
137                     }
138                 }
139                 if (entity.getRelationsSize() > 0) {
140                     Iterator JavaDoc indexIter = entity.getIndexesIterator();
141                     while (indexIter.hasNext()) {
142                         ModelIndex index = (ModelIndex) indexIter.next();
143
144                         if (indexNames.contains(index.getName())) {
145                             warningList.add("[IndexDuplicateName] Index on entity "
146                                             + entity.getEntityName() + " has a duplicate index-name \""
147                                             + index.getName() + "\".");
148                         } else {
149                             indexNames.add(index.getName());
150                         }
151
152                         if (tableNames.contains(index.getName())) {
153                             warningList.add("[IndexTableDupName] Index on entity "
154                                             + entity.getEntityName() + " has an index-name \""
155                                             + index.getName() + "\" that is also being used as a table name.");
156                         }
157
158                         if (fkNames.contains(index.getName())) {
159                             warningList.add("[IndexFKDupName] Index on entity "
160                                             + entity.getEntityName()
161                                             + " has an index-name \""
162                                             + index.getName()
163                                             + "\" that is also being used as a Foreign Key name.");
164                         }
165
166                         // make sure all names are <= 18 characters
167
if (index.getName().length() > 18) {
168                             warningList.add("[IndexNameGT18] The index name " + index.getName() + " (length:" + index.getName().length()
169                                             + ") was greater than 18 characters in length for entity " + entity.getEntityName() + ".");
170                         }
171                     }
172
173                     TreeSet JavaDoc relations = new TreeSet JavaDoc();
174                     for (int r = 0; r < entity.getRelationsSize(); r++) {
175                         ModelRelation relation = entity.getRelation(r);
176
177                         if (!entityNames.contains(relation.getRelEntityName())) {
178                             warningList.add("[RelatedEntityNotFound] Related entity " + relation.getRelEntityName()
179                                             + " of entity " + entity.getEntityName() + " not found.");
180                         }
181                         if (relations.contains(relation.getTitle() + relation.getRelEntityName())) {
182                             warningList.add("[RelationNameNotUnique] Relation " + relation.getTitle() + relation.getRelEntityName()
183                                             + " of entity "+ entity.getEntityName() + " is not unique for that entity.");
184                         } else {
185                             relations.add(relation.getTitle() + relation.getRelEntityName());
186                         }
187
188                         if (relation.getFkName().length() > 0) {
189                             if (fkNames.contains(relation.getFkName())) {
190                                 warningList.add("[RelationFkDuplicate] Relation to "+ relation.getRelEntityName()
191                                                 + " from entity " + entity.getEntityName() + " has a duplicate fk-name \""
192                                                 + relation.getFkName() + "\".");
193                             } else {
194                                 fkNames.add(relation.getFkName());
195                             }
196                             if (tableNames.contains(relation.getFkName())) {
197                                 warningList.add("[RelationFkTableDup] Relation to " + relation.getRelEntityName() + " from entity "
198                                                 + entity.getEntityName() + " has an fk-name \""
199                                                 + relation.getFkName() + "\" that is also being used as a table name.");
200                             }
201                             if (indexNames.contains(relation.getFkName())) {
202                                 warningList.add("[RelationFkTableDup] Relation to " + relation.getRelEntityName() + " from entity "
203                                                 + entity.getEntityName() + " has an fk-name \""
204                                                 + relation.getFkName() + "\" that is also being used as an index name.");
205                             }
206                         }
207
208                         // make sure all FK names are <= 18 characters
209
if (relation.getFkName().length() > 18) {
210                             warningList.add("[RelFKNameGT18] The foregn key name (length:" + relation.getFkName().length()
211                                             + ") was greater than 18 characters in length for relation " + relation.getTitle() + relation.getRelEntityName()
212                                             + " of entity " + entity.getEntityName() + ".");
213                         }
214
215                         ModelEntity relatedEntity = null;
216                         try {
217                             relatedEntity = reader.getModelEntity(relation.getRelEntityName());
218                         } catch (GenericEntityException e) {
219                             Debug.log("Entity referred to in relation is not defined: " + relation.getRelEntityName());
220                         }
221                         if (relatedEntity != null) {
222                             //if relation is of type one, make sure keyMaps
223
// match the PK of the relatedEntity
224
if ("one".equals(relation.getType()) || "one-nofk".equals(relation.getType())) {
225                                 if (relatedEntity.getPksSize() != relation.getKeyMapsSize())
226                                         warningList.add("[RelatedOneKeyMapsWrongSize] The number of primary keys (" + relatedEntity.getPksSize()
227                                                         + ") of related entity " + relation.getRelEntityName()
228                                                         + " does not match the number of keymaps (" + relation.getKeyMapsSize()
229                                                         + ") for relation of type one \"" + relation.getTitle() + relation.getRelEntityName()
230                                                         + "\" of entity " + entity.getEntityName() + ".");
231                                 Iterator JavaDoc pksIter = relatedEntity.getPksIterator();
232                                 while (pksIter.hasNext()) {
233                                     ModelField pk = (ModelField) pksIter.next();
234                                     if (relation.findKeyMapByRelated(pk.getName()) == null) {
235                                         warningList.add("[RelationOneRelatedPrimaryKeyMissing] The primary key \"" + pk.getName()
236                                                         + "\" of related entity " + relation.getRelEntityName()
237                                                         + " is missing in the keymaps for relation of type one " + relation.getTitle() + relation.getRelEntityName()
238                                                         + " of entity " + entity.getEntityName() + ".");
239                                     }
240                                 }
241                             }
242                         }
243
244                         //make sure all keyMap 'fieldName's match fields of
245
// this entity
246
//make sure all keyMap 'relFieldName's match fields of
247
// the relatedEntity
248
for (int rkm = 0; rkm < relation.getKeyMapsSize(); rkm++) {
249                             ModelKeyMap keyMap = (ModelKeyMap) relation.getKeyMap(rkm);
250
251                             ModelField field = entity.getField(keyMap.getFieldName());
252                             ModelField rfield = null;
253                             if (relatedEntity != null) {
254                                 rfield = relatedEntity.getField(keyMap.getRelFieldName());
255                             }
256                             if (rfield == null) {
257                                 warningList.add("[RelationRelatedFieldNotFound] The field \"" + keyMap.getRelFieldName()
258                                                 + "\" of related entity " + relation.getRelEntityName()
259                                                 + " was specified in the keymaps but is not found for relation " + relation.getTitle() + relation.getRelEntityName()
260                                                 + " of entity " + entity.getEntityName() + ".");
261                             }
262                             if (field == null) {
263                                 warningList.add("[RelationFieldNotFound] The field " + keyMap.getFieldName()
264                                                 + " was specified in the keymaps but is not found for relation " + relation.getTitle() + relation.getRelEntityName()
265                                                 + " of entity " + entity.getEntityName() + ".");
266                             }
267                             if (field != null && rfield != null) {
268                                 //this was the old check, now more constrained
269
// to keep things cleaner:
270
// if(!field.getType().equals(rfield.getType())
271
// &&
272
// !field.getType().startsWith(rfield.getType())
273
// &&
274
// !rfield.getType().startsWith(field.getType()))
275
// {
276
if (!field.getType().equals(rfield.getType()) && !field.getType().equals(rfield.getType() + "-ne") && !rfield.getType().equals(field.getType() + "-ne")) {
277                                     warningList.add("[RelationFieldTypesDifferent] The field type ("+ field.getType()
278                                                     + ") of " + field.getName() + " of entity " + entity.getEntityName()
279                                                     + " is not the same as field type (" + rfield.getType() + ") of "
280                                                     + rfield.getName() + " of entity " + relation.getRelEntityName() + " for relation "
281                                                     + relation.getTitle() + relation.getRelEntityName() + ".");
282                                 }
283                             }
284                         }
285                     }
286                 }
287                 numberShowed++;
288             }
289         }
290     }
291
292     public static final String JavaDoc[] rwArray = { "ABORT", "ABS", "ABSOLUTE",
293             "ACCEPT", "ACCES", "ACS", "ACTION", "ACTIVATE", "ADD", "ADDFORM",
294             "ADMIN", "AFTER", "AGGREGATE", "ALIAS", "ALL", "ALLOCATE", "ALTER",
295             "ANALYZE", "AND", "ANDFILENAME", "ANY", "ANYFINISH", "APPEND",
296             "ARCHIVE", "ARE", "ARRAY", "AS", "ASC", "ASCENDING", "ASCII",
297             "ASSERT", "ASSERTION", "ASSIGN", "AT", "ATTRIBUTE", "ATTRIBUTES",
298             "AUDIT", "AUTHID", "AUTHORIZATION", "AUTONEXT", "AUTO_INCREMENT",
299             "AVERAGE", "AVG", "AVGU", "AVG_ROW_LENGTH",
300
301             "BACKOUT", "BACKUP", "BEFORE", "BEGIN", "BEGINLOAD", "BEGINMODIFY",
302             "BEGINNING", "BEGWORK", "BETWEEN", "BETWEENBY", "BINARY",
303             "BINARY_INTEGER", "BIT", "BIT_LENGTH", "BLOB", "BODY", "BOOLEAN",
304             "BORDER", "BOTH", "BOTTOM", "BREADTH", "BREAK", "BREAKDISPLAY",
305             "BROWSE", "BUFERED", "BUFFER", "BUFFERED", "BULK", "BY", "BYTE",
306
307             "CALL", "CANCEL", "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG",
308             "CHANGE", "CHAR", "CHAR_LENGTH", "CHAR_BASE", "CHARACTER",
309             "CHARACTER_LENGTH", "CHAR_CONVERT", "CHECK", "CHECKPOINT",
310             "CHECKSUM", "CHR2FL", "CHR2FLO", "CHR2FLOA", "CHR2FLOAT",
311             "CHR2INT", "CLASS", "CLEAR", "CLEARROW", "CLIPPED", "CLOB",
312             "CLOSE", "CLUSTER", "CLUSTERED", "CLUSTERING", "COALESCE", "COBOL",
313             "COLD", "COLLATE", "COLLATION", "COLLECT", "COLUMN", "COLUMNS",
314             "COMMAND", "COMMENT", "COMMIT", "COMMITTED", "COMPLETION",
315             "COMPRESS", "COMPUTE", "CONCAT", "COND", "CONDITION", "CONFIG",
316             "CONFIRM", "CONNECT", "CONNECTION", "CONSTANT", "CONSTRAINT",
317             "CONSTRAINTS", "CONSTRUCT", "CONSTRUCTOR", "CONTAIN", "CONTAINS",
318             "CONTAINSTABLE", "CONTINUE", "CONTROLROW", "CONVERT", "COPY",
319             "CORRESPONDING", "COUNT", "COUNTU", "COUNTUCREATE", "CRASH",
320             "CREATE", "CROSS", "CUBE", "CURRENT", "CURRENT_DATE",
321             "CURRENT_PATH", "CURRENT_ROLE", "CURRENT_SESSION", "CURRENT_TIME",
322             "CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", "CURVAL", "CYCLE",
323
324             "DATA", "DATALINK", "DATABASE", "DATABASES", "DATAPAGES",
325             "DATA_PGS", "DATE", "DATETIME", "DAY", "DAY_HOUR", "DAY_MINUTE",
326             "DAY_SECOND", "DAYNUM", "DAYOFMONTH", "DAYOFWEEK", "DAYOFYEAR",
327             "DBA", "DBCC", "DBE", "DBEFILE", "DBEFILEO", "DBEFILESET",
328             "DBSPACE", "DBYTE", "DEALLOCATE", "DEC", "DECENDING", "DECIMAL",
329             "DECLARE", "DEFAULT", "DEFAULTS", "DEFER", "DEFERRABLE", "DEFINE",
330             "DEFINITION", "DELAY_KEY_WRITE", "DELAYED", "DELETE", "DELETEROW",
331             "DENY", "DEPTH", "DEREF", "DESC", "DESCENDING", "DESCENDNG",
332             "DESCRIBE", "DESCRIPTOR", "DESTPOS", "DESTROY", "DEVICE",
333             "DEVSPACE", "DIAGNOSTICS", "DICTIONARY", "DIRECT", "DIRTY",
334             "DISCONNECT", "DISK", "DISPLACE", "DISPLAY", "DISTINCT",
335             "DISTINCTROW", "DISTRIBUTED", "DISTRIBUTION", "DIV", "DO", "DOES",
336             "DOMAIN", "DOUBLE", "DOWN", "DROP", "DUAL", "DUMMY", "DUMP",
337             "DUPLICATES",
338
339             "EACH", "EBCDIC", "EDITADD", "EDITUPDATE", "ED_STRING", "ELSE",
340             "ELSEIF", "ELSIF", "ENCLOSED", "END", "ENDDATA", "ENDDISPLAY",
341             "ENDFORMS", "ENDIF", "ENDING", "ENDLOAD", "ENDLOOP", "ENDMODIFY",
342             "ENDPOS", "ENDRETRIEVE", "ENDSELECT", "ENDWHILE", "END_ERROR",
343             "END_EXEC", "END_FETCH", "END_FOR", "END_GET", "END_MODIFY",
344             "END_PLACE", "END_SEGMENT_S", "END_SEGMENT_STRING", "END_STORE",
345             "END_STREAM", "ENUM", "EQ", "EQUALS", "ERASE", "ERROR", "ERRLVL",
346             "ERROREXIT", "ESCAPE", "ESCAPED", "EVALUATE", "EVALUATING",
347             "EVERY", "EXCEPT", "EXCEPTION", "EXCLUSIVE", "EXEC", "EXECUTE",
348             "EXISTS", "EXIT", "EXPAND", "EXPANDING", "EXPLAIN", "EXPLICIT",
349             "EXTEND", "EXTENDS", "EXTENT", "EXTERNAL", "EXTRACT",
350
351             "FALSE", "FETCH", "FIELD", "FIELDS", "FILE", "FILENAME",
352             "FILLFACTOR", "FINALISE", "FINALIZE", "FINDSTR", "FINISH", "FIRST",
353             "FIRSTPOS", "FIXED", "FL", "FLOAT", "FLOAT4", "FLOAT8", "FLUSH",
354             "FOR", "FORALL", "FOREACH", "FOREIGN", "FORMAT", "FORMDATA",
355             "FORMINIT", "FORMS", "FORTRAN", "FOUND", "FRANT", "FRAPHIC",
356             "FREE", "FREETEXT", "FREETEXTTABLE", "FROM", "FRS", "FULL",
357             "FUNCTION",
358
359             "GE", "GENERAL", "GET", "GETFORM", "GETOPER", "GETROW", "GLOBAL",
360             "GLOBALS", "GO", "GOTO", "GRANT", "GRANTS", "GRAPHIC", "GROUP",
361             "GROUPING", "GT",
362
363             "HANDLER", "HASH", "HAVING", "HEAP", "HEADER", "HELP", "HELPFILE",
364             "HELP_FRS", "HIGH_PRIORITY", "HOLD", "HOLDLOCK", "HOSTS", "HOUR",
365             "HOUR_MINUTE", "HOUR_SECOND",
366
367             "IDENTIFIED", "IDENTIFIELD", "IDENTITY", "IDENTITY_INSERT", "IF",
368             "IFDEF", "IGNORE", "IMAGE", "IMMEDIATE", "IMMIDIATE", "IMPLICIT",
369             "IN", "INCLUDE", "INCREMENT", "INDEX", "INDEXED", "INDEXNAME",
370             "INDEXPAGES", "INDICATOR", "INFIELD", "INFILE", "INFO", "INGRES",
371             "INIT", "INITIAL", "INITIALISE", "INITIALIZE", "INITIALLY",
372             "INITTABLE", "INNER", "INOUT", "INPUT", "INQUIRE_EQUEL",
373             "INQUIRE_FRS", "INQUIRE_INGRES", "INQUIR_FRS", "INSERT",
374             "INSERT_ID", "INSERTROW", "INSTRUCTIONS", "INT", "INT1", "INT2CHR",
375             "INT2", "INT3", "INT4", "INT8", "INTEGER", "INTEGRITY",
376             "INTERESECT", "INTERFACE", "INTERRUPT", "INTERSECT", "INTERVAL",
377             "INTO", "INTSCHR", "INVOKE", "IS", "ISAM", "ISOLATION", "ITERATE",
378
379             "JAVA", "JOIN", "JOURNALING",
380
381             "KEY", "KEYS", "KILL",
382
383             "LABEL", "LANGUAGE", "LARGE", "LAST", "LAST_INSERT_ID", "LASTPOS",
384             "LATERAL", "LE", "LEADING", "LEAVE", "LEFT", "LENGTH", "LENSTR",
385             "LESS", "LET", "LEVEL", "LIKE", "LIKEPROCEDURETP", "LIMIT",
386             "LIMITED", "LINE", "LINENO", "LINES", "LINK", "LIST", "LISTEN",
387             "LOAD", "LOADTABLE", "LOADTABLERESUME", "LOCAL", "LOCALTIME",
388             "LOCALTIMESTAMP", "LOCATION", "LOCATOR", "LOCK", "LOCKING", "LOG",
389             "LOGS", "LONG", "LONGBLOB", "LONGTEXT", "LOOP", "LOW_PRIORITY",
390             "LOWER", "LPAD", "LT",
391
392             "MAIN", "MANUITEM", "MARGIN", "MATCH", "MATCHES", "MATCHING",
393             "MAX", "MAX_ROWS", "MAXEXTENTS", "MAXPUBLICUNION", "MAXRECLEN",
394             "MDY", "MEDIUMBLOB", "MEDIUMINT", "MEDIUMTEXT", "MEETS", "MENU",
395             "MENUITEM", "MENUITEMSCREEN", "MESSAGE", "MESSAGERELOCATE",
396             "MESSAGESCROLL", "MFETCH", "MIDDLEINT", "MIN", "MIN_ROWS",
397             "MINRECLEN", "MINRETURNUNTIL", "MINUS", "MINUTE", "MINUTE_SECOND",
398             "MIRROREXIT", "MISLABEL", "MISSING", "MIXED", "MOD", "MODE",
399             "MODIFIES", "MODIFY", "MODIFYREVOKEUPDATE", "MODULE", "MONEY",
400             "MONITOR", "MONTH", "MONTHNAME", "MOVE", "MULTI", "MYISAM",
401
402             "NAME", "NAMES", "NATIONAL", "NATURAL", "NATURALN", "NCHAR",
403             "NCLOB", "NE", "NEED", "NEW", "NEWLOG", "NEXT", "NEXTSCROLLDOWN",
404             "NEXTVAL", "NO", "NOAUDIT", "NOCHECK", "NOCOMPRESS", "NOCOPY",
405             "NOCR", "NOJOURNALING", "NOLIST", "NOLOG", "NONCLUSTERED", "NONE",
406             "NORMAL", "NORMALIZE", "NOSYSSORT", "NOT", "NOTFFOUND", "NOTFOUND",
407             "NOTIFY", "NOTRANS", "NOTRIM", "NOTRIMSCROLLUP", "NOTROLLBACKUSER",
408             "NOWAIT", "NULL", "NULLIF", "NULLIFY", "NULLSAVEUSING", "NULLVAL",
409             "NUMBER", "NUMBER_BASE", "NUMERIC", "NXFIELD",
410
411             "OBJECT", "OCIROWID", "OCTET_LENGTH", "OF", "OFF", "OFFLINE",
412             "OFFSET", "OFFSETS", "OFSAVEPOINTVALUES", "OLD", "ON", "ONCE",
413             "ONLINE", "ONLY", "ONSELECTWHERE", "ONTO", "OPAQUE", "OPEN",
414             "OPENDATASOURCE", "OPENQUERY", "OPENROWSET", "OPENXML",
415             "OPENSETWHILE", "OPENSLEEP", "OPERATION", "OPERATOR", "OPTIMIZE",
416             "OPTION", "OPTIONALLY", "OPTIONS", "OR", "ORDER", "ORDERSQLWORK",
417             "ORDINALITY", "ORGANIZATION", "ORSOMEWITH", "ORSORT", "OTHERS",
418             "OTHERWISE", "OUT", "OUTER", "OUTFILE", "OUTPUT", "OUTPUT_PAGE",
419             "OUTSTOP", "OVER", "OVERLAPS", "OWNER", "OWNERSHIP",
420
421             "PACK_KEYS", "PACKAGE", "PAD", "PAGE", "PAGENO", "PAGES", "PARAM",
422             "PARAMETER", "PARAMETERS", "PARTIAL", "PARTITION", "PASCAL",
423             "PASSWORD", "PATH", "PATHNAME", "PATTERN", "PAUSE", "PCTFREE",
424             "PERCENT", "PERIOD", "PERM", "PERMANENT", "PERMIT", "PERMITSUM",
425             "PIPE", "PLACE", "PLAN", "PLI", "PLS_INTEGER", "POS", "POSITION",
426             "POSITIVE", "POSITIVEN", "POSTFIX", "POWER", "PRAGMA", "PRECEDES",
427             "PRECISION", "PREFIX", "PREORDER", "PREPARE", "PREPARETABLE",
428             "PRESERVE", "PREV", "PREVIOUS", "PREVISION", "PRIMARY", "PRINT",
429             "PRINTER", "PRINTSCREEN", "PRINTSCREENSCROLL", "PRINTSUBMENU",
430             "PRINTSUMU", "PRIOR", "PRIV", "PRIVATE", "PRIVILAGES",
431             "PRIVILAGESTHEN", "PRIVILEGES", "PROC", "PROCEDURE", "PROCESS",
432             "PROCESSEXIT", "PROCESSLIST", "PROGRAM", "PROGUSAGE", "PROMPT",
433             "PROMPTSCROLLDOWN", "PROMPTTABLEDATA", "PROTECT", "PSECT",
434             "PUBLIC", "PUBLICREAD", "PUT", "PUTFORM", "PUTFORMSCROLLUP",
435             "PUTFORMUNLOADTABLE", "PUTOPER", "PUTOPERSLEEP", "PUTROW",
436             "PUTROWSUBMENU", "PUTROWUP",
437
438             "QUERY", "QUICK", "QUIT",
439
440             "RAISERROR", "RANGE", "RANGETO", "RAW", "RDB$DB_KEY", "RDB$LENGTH",
441             "RDB$MISSING", "RDB$VALUE", "RDB4DB_KEY", "RDB4LENGTH",
442             "RDB4MISSING", "RDB4VALUE", "READ", "READS", "READONLY",
443             "READPASS", "READTEXT", "READWRITE", "READY", "READ_ONLY",
444             "READ_WRITE", "REAL", "RECONFIGURE", "RECONNECT", "RECORD",
445             "RECOVER", "RECURSIVE", "REDISPLAY", "REDISPLAYTABLEDATA",
446             "REDISPLAYVALIDATE", "REDO", "REDUCED", "REF", "REFERENCES",
447             "REFERENCING", "REGEXP", "REGISTER", "REGISTERUNLOADDATA",
448             "REGISTERVALIDROW", "REJECT", "RELATIVE", "RELEASE", "RELOAD",
449             "RELOCATE", "RELOCATEUNIQUE", "REMOVE", "REMOVEUPRELOCATEV",
450             "REMOVEVALIDATE", "REMOVEWHENEVER", "RENAME", "REPEAT",
451             "REPEATABLE", "REPEATED", "REPEATVALIDROW", "REPLACE",
452             "REPLACEUNTIL", "REPLICATION", "REPLSTR", "REPORT",
453             "REQUEST_HANDLE", "RESERVED_PGS", "RESERVING", "RESET", "RESIGNAL",
454             "RESOURCE", "REST", "RESTART", "RESTORE", "RESTRICT", "RESULT",
455             "RESUME", "RETRIEVE", "RETRIEVEUPDATE", "RETURN", "RETURNS",
456             "RETURNING", "REVERSE", "REVOKE", "RIGHT", "RLIKE", "ROLE",
457             "ROLLBACK", "ROLLFORWARD", "ROLLBACK", "ROLLUP", "ROUND",
458             "ROUTINE", "ROW", "ROWCNT", "ROWCOUNT", "ROWGUID_COL", "ROWID",
459             "ROWLABEL", "ROWNUM", "ROWS", "ROWTYPE", "RPAD", "RULE", "RUN",
460             "RUNTIME",
461
462             "SAMPLSTDEV", "SAVE", "SAVEPOINT", "SAVEPOINTWHERE", "SAVEVIEW",
463             "SCHEMA", "SCOPE", "SCREEN", "SCROLL", "SCROLLDOWN", "SCROLLUP",
464             "SEARCH", "SECOND", "SECTION", "SEGMENT", "SEL", "SELE", "SELEC",
465             "SELECT", "SELUPD", "SEPERATE", "SEQUENCE", "SERIAL", "SESSION",
466             "SESSION_USER", "SET", "SETOF", "SETS", "SETWITH", "SET_EQUEL",
467             "SET_FRS", "SET_INGRES", "SETUSER", "SHARE", "SHARED", "SHORT",
468             "SHOW", "SHUTDOWN", "SIGNAL", "SIZE", "SKIP", "SLEEP",
469             "SMALLFLOAT", "SMALLINT", "SOME", "SONAME", "SORT", "SORTERD",
470             "SOUNDS", "SOURCEPOS", "SPACE", "SPACES", "SPECIFIC",
471             "SPECIFICTYPE", "SQL", "SQL_BIG_RESULT", "SQL_BIG_SELECTS",
472             "SQL_BIG_TABLES", "SQL_LOG_OFF", "SQL_LOG_UPDATE",
473             "SQL_LOW_PRIORITY_UPDATES", "SQL_SELECT_LIMIT", "SQL_SMALL_RESULT",
474             "SQL_WARNINGS", "SQLCODE", "SQLDA", "SQLERRM", "SQLERROR",
475             "SQLEXCEPTION", "SQLEXEPTION", "SQLEXPLAIN", "SQLNOTFOUND",
476             "SQLSTATE", "SQLWARNING", "SQRT", "STABILITY", "START", "STARTING",
477             "STARTPOS", "START_SEGMENT", "START_SEGMENTED_?", "START_STREAM",
478             "START_TRANSACTION", "STATE", "STATIC", "STATISTICS", "STATUS",
479             "STDDEV", "STDEV", "STEP", "STOP", "STORE", "STRAIGHT_JOIN",
480             "STRING", "STRUCTURE", "SUBMENU", "SUBSTR", "SUBSTRING", "SUBTYPE",
481             "SUCCEEDS", "SUCCESFULL", "SUCCESSFULL", "SUM", "SUMU", "SUPERDBA",
482             "SYB_TERMINATE", "SYNONYM", "SYSDATE", "SYSSORT", "SYSTEM_USER",
483
484             "TABLE", "TABLEDATA", "TABLES", "TEMP", "TEMPORARY", "TERMINATE",
485             "TERMINATED", "TEXT", "TEXTSIZE", "THAN", "THEN", "THROUGH",
486             "THRU", "TID", "TIME", "TIMESTAMP", "TIMEZONE_HOUR",
487             "TIMEZONE_MINUTE", "TINYBLOB", "TINYINT", "TINYTEXT", "TO",
488             "TODAY", "TOLOWER", "TOP", "TOTAL", "TOUPPER", "TP", "TRAILER",
489             "TRAILING", "TRAN", "TRANS", "TRANSACTION", "TRANSACTION_HANDLE",
490             "TRANSFER", "TRANSLATE", "TRANSLATION", "TREAT", "TRIGGER",
491             "TRING", "TRUE", "TRUNC", "TRUNCATE", "TSEQUAL", "TYPE",
492
493             "UID", "UNBUFFERED", "UNDER", "UNDO", "UNION", "UNIQUE", "UNKNOWN",
494             "UNLISTEN", "UNLOAD", "UNLOADDATA", "UNLOADTABLE", "UNLOCK",
495             "UNTIL", "UP", "UPDATE", "UPDATETEXT", "UPPER", "USAGE", "USE",
496             "USED_PGS", "USER", "USING", "UTC_TIME",
497
498             "VACUUM", "VALIDATE", "VALIDROW", "VALUE", "VALUES", "VARBINARY",
499             "VARC", "VARCH", "VARCHA", "VARCHAR", "VARGRAPHIC", "VARIABLE",
500             "VARIABLES", "VARIANCE", "VARYING", "VERB_TIME", "VERBOSE",
501             "VERIFY", "VERSION", "VIEW",
502
503             "WAIT", "WAITFOR", "WAITING", "WARNING", "WEEKDAY", "WHEN",
504             "WHENEVER", "WHERE", "WHILE", "WINDOW", "WITH", "WITHOUT", "WORK",
505             "WRAP", "WRITE", "WRITEPASS", "WRITETEXT",
506
507             "YEAR", "YEARS",
508
509             "ZEROFILL", "ZONE" };
510
511     public static void initReservedWords(TreeSet JavaDoc reservedWords) {
512         //create extensive list of reserved words
513
int asize = rwArray.length;
514         Debug.log("[initReservedWords] array length=" + asize);
515         for (int i = 0; i < asize; i++) {
516             reservedWords.add(rwArray[i]);
517         }
518     }
519 }
520
521
Popular Tags