1 10 11 package com.triactive.jdo.store; 12 13 import java.sql.Connection ; 14 import java.sql.DatabaseMetaData ; 15 import java.sql.ResultSet ; 16 import java.sql.SQLException ; 17 import javax.jdo.JDODataStoreException; 18 19 20 class ProbeTable extends BaseTable 21 { 22 public ProbeTable(StoreManager storeMgr) 23 { 24 super(storeMgr); 25 26 name = new TableIdentifier(dba, "deleteMe" + System.currentTimeMillis()); 27 } 28 29 30 public void initialize() 31 { 32 assertIsUninitialized(); 33 34 dba.getMapping(newColumn(int.class, "unused")); 35 36 state = TABLE_STATE_INITIALIZED; 37 } 38 39 40 public String findSchemaName(Connection conn) throws SQLException 41 { 42 String schemaName = null; 43 DatabaseMetaData dmd = conn.getMetaData(); 44 45 ResultSet rs = dmd.getTables(null, null, name.getSQLIdentifier(), null); 46 47 try 48 { 49 if (!rs.next()) 50 throw new JDODataStoreException("Cannot find probe table " + name); 51 52 schemaName = rs.getString(2); 53 } 54 finally 55 { 56 rs.close(); 57 } 58 59 return schemaName; 60 } 61 } 62 | Popular Tags |