Classes go after methods.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2169 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -764,6 +764,45 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks that there are no database columns for which we no longer have Java fields.
|
||||||
|
*/
|
||||||
|
protected void verifySchemasMatch (
|
||||||
|
TableMetaData meta, PersistenceContext ctx, SQLBuilder builder)
|
||||||
|
throws PersistenceException
|
||||||
|
{
|
||||||
|
for (String fname : _columnFields) {
|
||||||
|
FieldMarshaller fmarsh = _fields.get(fname);
|
||||||
|
meta.tableColumns.remove(fmarsh.getColumnName());
|
||||||
|
}
|
||||||
|
for (String column : meta.tableColumns) {
|
||||||
|
if (builder.isPrivateColumn(column)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
log.warning(getTableName() + " contains stale column '" + column + "'.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateVersion (Connection conn, DatabaseLiaison liaison, int version)
|
||||||
|
throws SQLException
|
||||||
|
{
|
||||||
|
String update =
|
||||||
|
"update " + liaison.tableSQL(SCHEMA_VERSION_TABLE) +
|
||||||
|
" set " + liaison.columnSQL("version") + " = " + version +
|
||||||
|
" where " + liaison.columnSQL("persistentClass") + " = '" + getTableName() + "'";
|
||||||
|
Statement stmt = conn.createStatement();
|
||||||
|
try {
|
||||||
|
if (stmt.executeUpdate(update) == 0) {
|
||||||
|
String insert =
|
||||||
|
"insert into " + liaison.tableSQL(SCHEMA_VERSION_TABLE) +
|
||||||
|
" values('" + getTableName() + "', " + version + ")";
|
||||||
|
stmt.executeUpdate(insert);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
stmt.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected static class TableMetaData
|
protected static class TableMetaData
|
||||||
{
|
{
|
||||||
public boolean tableExists;
|
public boolean tableExists;
|
||||||
@@ -824,45 +863,6 @@ public class DepotMarshaller<T extends PersistentRecord>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that there are no database columns for which we no longer have Java fields.
|
|
||||||
*/
|
|
||||||
protected void verifySchemasMatch (
|
|
||||||
TableMetaData meta, PersistenceContext ctx, SQLBuilder builder)
|
|
||||||
throws PersistenceException
|
|
||||||
{
|
|
||||||
for (String fname : _columnFields) {
|
|
||||||
FieldMarshaller fmarsh = _fields.get(fname);
|
|
||||||
meta.tableColumns.remove(fmarsh.getColumnName());
|
|
||||||
}
|
|
||||||
for (String column : meta.tableColumns) {
|
|
||||||
if (builder.isPrivateColumn(column)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
log.warning(getTableName() + " contains stale column '" + column + "'.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateVersion (Connection conn, DatabaseLiaison liaison, int version)
|
|
||||||
throws SQLException
|
|
||||||
{
|
|
||||||
String update =
|
|
||||||
"update " + liaison.tableSQL(SCHEMA_VERSION_TABLE) +
|
|
||||||
" set " + liaison.columnSQL("version") + " = " + version +
|
|
||||||
" where " + liaison.columnSQL("persistentClass") + " = '" + getTableName() + "'";
|
|
||||||
Statement stmt = conn.createStatement();
|
|
||||||
try {
|
|
||||||
if (stmt.executeUpdate(update) == 0) {
|
|
||||||
String insert =
|
|
||||||
"insert into " + liaison.tableSQL(SCHEMA_VERSION_TABLE) +
|
|
||||||
" values('" + getTableName() + "', " + version + ")";
|
|
||||||
stmt.executeUpdate(insert);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
stmt.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static class RecordMetaData
|
protected static class RecordMetaData
|
||||||
{
|
{
|
||||||
public Map<String, Index> indices = new HashMap<String, Index>();
|
public Map<String, Index> indices = new HashMap<String, Index>();
|
||||||
|
|||||||
Reference in New Issue
Block a user