1 22 23 package org.xquark.extractor.oracle; 24 25 import java.sql.Connection ; 26 import java.sql.SQLException ; 27 import java.util.ArrayList ; 28 import java.util.List ; 29 30 import org.xquark.extractor.common.MetaDataException; 31 import org.xquark.extractor.metadata.*; 32 import org.xquark.extractor.runtime.Selection; 33 import org.xquark.jdbc.typing.DBMSInfo; 34 import org.xquark.jdbc.typing.DbType; 35 36 public final class Loader extends org.xquark.extractor.metadata.Loader { 37 38 private static final String RCSRevision = "$Revision: 1.11 $"; 39 private static final String RCSName = "$Name: $"; 40 41 public Loader(Connection connection, DBMSInfo dbmsInfo, QNameEncoder encoder) throws SQLException { 42 super(connection, dbmsInfo, encoder); 43 } 44 45 protected void loadKeys(String catalogName, String schemaName, Table table, Selection selection) throws MetaDataException { 46 48 List key = new ArrayList (); 50 51 PseudoAttribute rowId = new PseudoAttribute("ROWID"); 52 rowId.setMappingInfo(new ExtractorMappingInfo(new DbType(DbType.ORACLE_ROWID), _dbmsInfo.getTypeMap())); 53 key.add(rowId); 54 table.addKey(key); 55 super.loadKeys(catalogName, schemaName, table, selection); 56 } 58 59 protected String createQuery(String catalogName, String schemaName, String origTableName) { 60 StringBuffer retVal = new StringBuffer (); 61 62 retVal.append("SELECT * FROM "); 63 if (null != catalogName && 0 < catalogName.trim().length()) { 64 retVal.append('"'); 65 retVal.append(catalogName.trim()); 66 retVal.append("\"."); 67 } 68 if (null != schemaName && 0 < schemaName.trim().length()) { 69 retVal.append('"'); 70 retVal.append(schemaName.trim()); 71 retVal.append("\"."); 72 } 73 if (null != origTableName && 0 < origTableName.trim().length()) { 74 retVal.append('"'); 75 retVal.append(origTableName.trim()); 76 retVal.append('"'); 77 } 78 retVal.append(" WHERE 0=1"); 79 return retVal.toString(); 80 } 81 } 82 | Popular Tags |