public abstract class AssociationCreator extends Generator
| 构造器和说明 |
|---|
AssociationCreator() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
addForeignKeyColumn(java.lang.String tableName,
java.lang.String associatedTableName,
java.lang.String tableHoldsForeignKey,
android.database.sqlite.SQLiteDatabase db)
This method is used to add many to one association or one to one
association on tables.
|
protected void |
addOrUpdateAssociation(android.database.sqlite.SQLiteDatabase db,
boolean force)
AssociationCreator analyzes two things. |
protected abstract void |
createOrUpgradeTable(android.database.sqlite.SQLiteDatabase db,
boolean force)
Analysis the TableModel by the purpose of subclasses, and generate a SQL
to do the intention job.
|
protected java.lang.String |
generateAddColumnSQL(java.lang.String tableName,
ColumnModel columnModel)
Generate a SQL for add new column into the existing table.
|
protected java.lang.String |
generateCreateTableSQL(java.lang.String tableName,
java.util.List<ColumnModel> columnModels,
boolean autoIncrementId)
Generate a create table SQL by the passed in parameters.
|
protected java.lang.String |
generateDropTableSQL(java.lang.String tableName)
Generate a SQL for dropping table.
|
protected void |
giveTableSchemaACopy(java.lang.String tableName,
int tableType,
android.database.sqlite.SQLiteDatabase db)
Once there's new table created.
|
protected boolean |
isForeignKeyColumnFormat(java.lang.String columnName)
Judge the passed in column is a foreign key column format or not.
|
execute, getAllAssociations, getAllTableModelsprotected abstract void createOrUpgradeTable(android.database.sqlite.SQLiteDatabase db,
boolean force)
GeneratorcreateOrUpgradeTable 在类中 Generatordb - Instance of SQLiteDatabase.force - Drop the table first if it already exists.protected void addOrUpdateAssociation(android.database.sqlite.SQLiteDatabase db,
boolean force)
AssociationCreator analyzes two things. Add associations
including add foreign key column to tables and create intermediate join
tables.addOrUpdateAssociation 在类中 Generatordb - Instance of SQLiteDatabase.force - Drop the table first if it already exists.protected java.lang.String generateCreateTableSQL(java.lang.String tableName,
java.util.List<ColumnModel> columnModels,
boolean autoIncrementId)
tableName - The table name.columnModels - A list contains all column models with column info.autoIncrementId - Generate an auto increment id or not. Only intermediate join table doesn't need
an auto increment id.protected java.lang.String generateDropTableSQL(java.lang.String tableName)
tableName - The table name.protected java.lang.String generateAddColumnSQL(java.lang.String tableName,
ColumnModel columnModel)
tableName - The table which want to add a columncolumnModel - Which contains column infoprotected boolean isForeignKeyColumnFormat(java.lang.String columnName)
columnName - The name of column.protected void giveTableSchemaACopy(java.lang.String tableName,
int tableType,
android.database.sqlite.SQLiteDatabase db)
tableName - The table name.tableType - 0 means normal table, 1 means intermediate join table.db - Instance of SQLiteDatabase.protected void addForeignKeyColumn(java.lang.String tableName,
java.lang.String associatedTableName,
java.lang.String tableHoldsForeignKey,
android.database.sqlite.SQLiteDatabase db)
tableName - The table name.associatedTableName - The associated table name.tableHoldsForeignKey - The table which holds the foreign key.db - Instance of SQLiteDatabase.DatabaseGenerateException