1 10 11 package com.triactive.jdo.store; 12 13 import java.math.BigInteger ; 14 import java.sql.DatabaseMetaData ; 15 import java.util.ArrayList ; 16 17 18 26 27 class FirebirdAdapter extends DatabaseAdapter 28 { 29 34 35 protected FirebirdAdapter(DatabaseMetaData metadata) 36 { 37 super(metadata); 38 } 39 40 public String getVendorID() 41 { 42 return "firebird"; 43 } 44 45 public String getDropTableStatement(BaseTable table) 46 { 47 return "DROP TABLE " + table.getName(); 48 } 49 50 51 public boolean supportsDeferredConstraints() 52 { 53 return false; 54 } 55 56 public boolean supportsBooleanComparison() 57 { 58 return false; 59 } 60 61 public boolean supportsNullsInCandidateKeys() 62 { 63 return false; 64 } 65 66 public TableExpression newTableExpression(QueryStatement qs, Table table, SQLIdentifier rangeVar) 67 { 68 return new TableExprAsJoins(qs, table, rangeVar); 69 } 70 71 public NumericExpression lengthMethod(CharacterExpression str) 72 { 73 ArrayList args = new ArrayList (); 74 args.add(str); 75 76 return new NumericExpression("STRLEN", args); 77 } 78 79 public CharacterExpression substringMethod(CharacterExpression str, 80 NumericExpression begin) 81 { 82 ArrayList args = new ArrayList (); 83 args.add(str); 84 args.add(begin.add(new IntegerLiteral(str.getQueryStatement(), BigInteger.ONE))); 85 86 return new CharacterExpression("SUBSTR", args); 87 } 88 89 public CharacterExpression substringMethod(CharacterExpression str, 90 NumericExpression begin, 91 NumericExpression end) 92 { 93 ArrayList args = new ArrayList (); 94 args.add(str); 95 args.add(begin.add(new IntegerLiteral(str.getQueryStatement(), BigInteger.ONE))); 96 args.add(end); 97 98 return new CharacterExpression("SUBSTR", args); 99 } 100 } 101 | Popular Tags |