Automatic Database Validation
Brought to you by:
hwellmann
Generate additional code for automatic validation of a Database based on a given DataScript model.
Add a new interface to the runtime library:
package datascript.runtime;
public interface ValidationListener
{
void onError(String tableName, long primaryKey, Throwable t);
}
Generate a new method for each sql_database:
FooDatabase.validate(ValidationListener listener):
for each table instance
table.validate()
Generate a new method for each sql_table:
FooTable.validate(ValidationListener listener):
selects all rows from the table
for each row
for each BLOB column
find the corresponding DataScript type
decode the column with this type
on exception: notify listener