1 10 11 package com.triactive.jdo.store; 12 13 import java.sql.DatabaseMetaData ; 14 import java.sql.ResultSet ; 15 16 17 23 24 public class MySQLAdapter extends DatabaseAdapter 25 { 26 36 37 public static final String NONSQL92_RESERVED_WORDS = 38 "ANALYZE,AUTO_INCREMENT,BDB,BERKELEYDB,BIGINT,BINARY,BLOB,BTREE," + 39 "CHANGE,COLUMNS,DATABASE,DATABASES,DAY_HOUR,DAY_MINUTE,DAY_SECOND," + 40 "DELAYED,DISTINCTROW,DIV,ENCLOSED,ERRORS,ESCAPED,EXPLAIN,FIELDS," + 41 "FORCE,FULLTEXT,FUNCTION,GEOMETRY,HASH,HELP,HIGH_PRIORITY," + 42 "HOUR_MINUTE,HOUR_SECOND,IF,IGNORE,INDEX,INFILE,INNODB,KEYS,KILL," + 43 "LIMIT,LINES,LOAD,LOCALTIME,LOCALTIMESTAMP,LOCK,LONG,LONGBLOB," + 44 "LONGTEXT,LOW_PRIORITY,MASTER_SERVER_ID,MEDIUMBLOB,MEDIUMINT," + 45 "MEDIUMTEXT,MIDDLEINT,MINUTE_SECOND,MOD,MRG_MYISAM,OPTIMIZE," + 46 "OPTIONALLY,OUTFILE,PURGE,REGEXP,RENAME,REPLACE,REQUIRE,RETURNS," + 47 "RLIKE,RTREE,SHOW,SONAME,SPATIAL,SQL_BIG_RESULT,SQL_CALC_FOUND_ROWS," + 48 "SQL_SMALL_RESULT,SSL,STARTING,STRAIGHT_JOIN,STRIPED,TABLES," + 49 "TERMINATED,TINYBLOB,TINYINT,TINYTEXT,TYPES,UNLOCK,UNSIGNED,USE," + 50 "USER_RESOURCES,VARBINARY,VARCHARACTER,WARNINGS,XOR,YEAR_MONTH," + 51 "ZEROFILL"; 52 53 54 public MySQLAdapter(DatabaseMetaData metadata) 55 { 56 super(metadata); 57 58 keywords.addAll(parseKeywordList(NONSQL92_RESERVED_WORDS)); 59 } 60 61 public String getVendorID() 62 { 63 return "mysql"; 64 } 65 66 public TableExpression newTableExpression(QueryStatement qs, Table table, SQLIdentifier rangeVar) 67 { 68 return new TableExprAsJoins(qs, table, rangeVar); 69 } 70 71 public TypeInfo newTypeInfo(ResultSet rs) 72 { 73 TypeInfo ti = new MySQLTypeInfo(rs); 74 75 80 if (ti.typeName.equalsIgnoreCase("binary") || 81 ti.typeName.equalsIgnoreCase("varbinary")) 82 return null; 83 84 return ti; 85 } 86 87 public boolean createIndexesBeforeForeignKeys() 88 { 89 return true; 90 } 91 92 public boolean supportsAlterTableDropConstraint() 93 { 94 return false; 95 } 96 97 public boolean supportsDeferredConstraints() 98 { 99 return false; 100 } 101 } 102 | Popular Tags |