use of org.datanucleus.store.rdbms.RDBMSStoreData in project datanucleus-rdbms by datanucleus.
the class SchemaAutoStarter method addClass.
/**
* Method to add a class to the supported list.
* @param data Data for the class to add.
*/
public void addClass(StoreData data) {
// We only support MappedStoreData
RDBMSStoreData tableData = (RDBMSStoreData) data;
assertIsOpen();
try {
schemaTable.addClass(tableData, mconn);
} catch (SQLException sqe2) {
String msg = Localiser.msg("049003", data.getName(), sqe2);
NucleusLogger.DATASTORE_SCHEMA.error(msg);
throw new NucleusDataStoreException(msg, sqe2);
}
}
use of org.datanucleus.store.rdbms.RDBMSStoreData in project datanucleus-rdbms by datanucleus.
the class SchemaTable method getAllClasses.
/**
* Accessor for the classes already supported by this Schema Table.
* @param conn Connection for this datastore.
* @return The HashSet of class names (StoreData)
* @throws SQLException Thrown when an error occurs in the process.
*/
public HashSet getAllClasses(ManagedConnection conn) throws SQLException {
HashSet schema_data = new HashSet();
if (storeMgr.getDdlWriter() != null && !tableExists((Connection) conn.getConnection())) {
// do not query non-existing schema table when DDL is only written to file
return schema_data;
}
SQLController sqlControl = storeMgr.getSQLController();
PreparedStatement ps = sqlControl.getStatementForQuery(conn, fetchAllStmt);
try {
ResultSet rs = sqlControl.executeStatementQuery(null, conn, fetchAllStmt, ps);
try {
while (rs.next()) {
StoreData data = new RDBMSStoreData(rs.getString(1), rs.getString(2), rs.getString(4).equals("1") ? true : false, rs.getString(3).equals("FCO") ? StoreData.Type.FCO : StoreData.Type.SCO, rs.getString(6));
schema_data.add(data);
}
} finally {
rs.close();
}
} finally {
sqlControl.closeStatement(conn, ps);
}
return schema_data;
}
Aggregations