1 package org.apache.torque.adapter; 2 3 21 22 import java.sql.Connection ; 23 import java.sql.SQLException ; 24 import java.util.StringTokenizer ; 25 26 32 public class DBCloudscape extends AbstractDBAdapter 33 { 34 37 private static final long serialVersionUID = -7475830417640153351L; 38 39 40 private static final String QUALIFIER = "."; 41 42 45 protected DBCloudscape() 46 { 47 } 48 54 public String toUpperCase(String in) 55 { 56 return in; 57 } 58 59 65 public String ignoreCase(String in) 66 { 67 return in; 68 } 69 70 73 public String getIDMethodType() 74 { 75 return AUTO_INCREMENT; 76 } 77 78 81 public String getIDMethodSQL(Object obj) 82 { 83 StringBuffer sql = new StringBuffer (132); 84 sql.append("select distinct ConnectionInfo.lastAutoincrementValue("); 85 86 String qualifiedIdentifier = (String ) obj; 87 88 StringTokenizer tokenizer = new StringTokenizer (qualifiedIdentifier, 89 QUALIFIER); 90 int count = tokenizer.countTokens(); 91 92 String schema, table, column; 93 94 System.out.println("qi = " + qualifiedIdentifier); 95 switch (count) 97 { 98 case 0: 99 case 1: 101 return ""; 103 case 2: 104 table = tokenizer.nextToken(); 105 column = tokenizer.nextToken(); 106 sql.append("'APP', '"); 107 sql.append(table); 108 break; 109 110 case 3: 111 schema = tokenizer.nextToken(); 112 table = tokenizer.nextToken(); 113 column = tokenizer.nextToken(); 114 sql.append("'"); 115 sql.append(schema); 116 sql.append("', '"); 117 sql.append(table); 118 break; 119 120 default: 121 return ""; } 123 124 sql.append("', '"); 125 sql.append(column); 126 sql.append("') FROM "); 127 sql.append(table); 128 129 System.out.println(sql.toString()); 130 return sql.toString(); 131 } 132 133 140 public void lockTable(Connection con, String table) throws SQLException 141 { 142 } 143 144 151 public void unlockTable(Connection con, String table) throws SQLException 152 { 153 } 154 } 155 | Popular Tags |