|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.org.ogsadai.database.jdbc.book.JDBCBookDataCreator
public class JDBCBookDataCreator
Class to create OGSA-DAI "littleblackbook"-style tables with schema:
(id INTEGER, name VARCHAR(64), address VARCHAR(128), phone VARCHAR(20))
Two tables created using this class will always have the same data.
| Constructor Summary | |
|---|---|
JDBCBookDataCreator()
|
|
| Method Summary | |
|---|---|
void |
create(java.sql.Connection connection,
java.lang.String table)
Create a table of the given name. |
void |
create(java.sql.Connection connection,
java.lang.String tablePrefix,
int numTables)
Create N tables with the given prefix. |
void |
drop(java.sql.Connection connection,
java.lang.String table)
Drop a table of the given name. |
void |
drop(java.sql.Connection connection,
java.lang.String tablePrefix,
int numTables)
Drop N tables with the given prefix. |
protected java.lang.String |
getCreateTableSQL(java.lang.String table)
Gets an SQL statement that creates a new table. |
protected java.lang.String |
getDropTableSQL(java.lang.String table)
Gets an SQL statement that drops a table. |
protected java.lang.String |
getInsertSQL(java.lang.String table)
Gets a parameterised SQL statement that inserts data into a table. |
void |
populate(java.sql.Connection connection,
java.lang.String table,
int rows)
Populate a table of the given name. |
void |
populate(java.sql.Connection connection,
java.lang.String tablePrefix,
int numTables,
int rows)
Populate N tables with the given prefix. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JDBCBookDataCreator()
| Method Detail |
|---|
public void create(java.sql.Connection connection,
java.lang.String table)
throws java.sql.SQLException
connection - JDBC connection.table - Table name.
java.sql.SQLException - If any problems arise.
public void populate(java.sql.Connection connection,
java.lang.String table,
int rows)
throws java.sql.SQLException
rows rows. If rows if 10000 or greater then
the rows (apart from the ID field) will have identical values
(i.e. row 1 == row 10001 etc).
connection - JDBC connection.table - Table name.rows - Number of rows.
java.sql.SQLException - If any problems arise.
public void drop(java.sql.Connection connection,
java.lang.String table)
throws java.sql.SQLException
connection - JDBC connection.table - Table name.
java.sql.SQLException - If any problems arise.
public void create(java.sql.Connection connection,
java.lang.String tablePrefix,
int numTables)
throws java.sql.SQLException
tablePrefix0 to tablePrefixN where
N = numTables - 1. If each table already
exists it will be initially deleted.
connection - JDBC connection.tablePrefix - Table name prefix.numTables - Number of tables.
java.sql.SQLException - If any problems arise.
public void populate(java.sql.Connection connection,
java.lang.String tablePrefix,
int numTables,
int rows)
throws java.sql.SQLException
tablePrefix0 to tablePrefixN where
N = numTables - 1. Each table is given rows
rows. If rows if 10000 or greater then the rows (apart from
the ID field) will have identical values (i.e. row 1 == row 10001 etc).
connection - JDBC connection.tablePrefix - Table name prefix.numTables - Number of tables.rows - Number of rows.
java.sql.SQLException - If any problems arise.
public void drop(java.sql.Connection connection,
java.lang.String tablePrefix,
int numTables)
throws java.sql.SQLException
tablePrefix0 to tablePrefixN where
N = numTables - 1.
connection - JDBC connection.tablePrefix - Table name prefix.numTables - Number of tables.
java.sql.SQLException - If any problems arise.protected java.lang.String getCreateTableSQL(java.lang.String table)
table - Table name.
protected java.lang.String getInsertSQL(java.lang.String table)
table - Table name.
protected java.lang.String getDropTableSQL(java.lang.String table)
table - Table name.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||