Interface MigrationContext
public interface MigrationContext
What a
JavaMigration may do to the database it is migrating.-
Method Summary
Modifier and TypeMethodDescriptionThe runtime's own database object:com.codename1.db.Databasein an application,com.codename1.backend.Databaseon a server.dialect()The engine being migrated.voidRuns one statement.Runs one query and returns every row with every value as text, null where the column is null.
-
Method Details
-
dialect
String dialect()The engine being migrated.- Returns:
sqlite,postgresqlormysql; MariaDB answersmysql
-
execute
Runs one statement.- Parameters:
sql- a single statement, with?for each parameterparams- the parameter values, or null for none- Throws:
IOException- if the database refuses it
-
query
Runs one query and returns every row with every value as text, null where the column is null. Text is the one representation every engine and both runtimes agree on; a migration that needs typed access usesconnection().- Parameters:
sql- a single query, with?for each parameterparams- the parameter values, or null for none- Returns:
- the rows in order
- Throws:
IOException- if the database refuses it
-
connection
Object connection()The runtime's own database object:com.codename1.db.Databasein an application,com.codename1.backend.Databaseon a server. Test it withinstanceofbefore casting.- Returns:
- the connection the migration runs on
-