DatabaseCreatorpublic class DatabaseCreator extends Object
Fields Summary |
---|
public static final int | defaultInt | public static final String | defaultString | public static final String | defaultCharacter | public static final double | defaultDouble | public static final String | TEST_TABLE1 | public static final String | TEST_TABLE2 | public static final String | TEST_TABLE3 | public static final String | TEST_TABLE4 | public static final String | SALESPEOPLE_TABLE | public static final String | CUSTOMERS_TABLE | public static final String | ORDERS_TABLE | public static final String | PARENT_TABLE | public static final String | FKSTRICT_TABLE | public static final String | FKCASCADE_TABLE | public static final String | TEST_TABLE5 | public static final String | SIMPLE_TABLE1 | public static final String | SIMPLE_TABLE2 | public static final String | SIMPLE_TABLE3 | public static final String | CREATE_TABLE1 | public static final String | CREATE_TABLE2 | public static final String | CREATE_TABLE3 | public static final String | CREATE_TABLE4 | public static final String | CREATE_TABLE5 | public static final String | CREATE_TABLE_SALESPEOPLE | public static final String | CREATE_TABLE_CUSTOMERS | public static final String | CREATE_TABLE_ORDERS | public static final String | CREATE_TABLE_PARENT | public static final String | CREATE_TABLE_FKSTRICT | public static final String | CREATE_TABLE_FKCASCADE | public static final String | CREATE_TABLE_SIMPLE1 | public static final String | CREATE_TABLE_SIMPLE2 | public static final String | CREATE_TABLE_SIMPLE3 | public static final String | DROP_TABLE1 | public static final String | DROP_TABLE2 | public static final String | DROP_TABLE3 | public static final String | DROP_TABLE4 | public static final String | DROP_TABLE5 | public static final String | DROP_TABLE_CUSTOMERS | public static final String | DROP_TABLE_ORDERS | public static final String | DROP_TABLE_SALESPEOPLE | public static final String | DROP_TABLE_PARENT | public static final String | DROP_TABLE_FKSTRICT | public static final String | DROP_TABLE_FKCASCADE | public static final String | DROP_TABLE_SIMPLE1 | public static final String | DROP_TABLE_SIMPLE2 | public static final String | DROP_TABLE_SIMPLE3 | public static final String | INSERT_SALESPEOPLE1 | public static final String | INSERT_SALESPEOPLE2 | public static final String | INSERT_SALESPEOPLE3 | public static final String | INSERT_SALESPEOPLE4 | public static final String | INSERT_SALESPEOPLE5 | public static final String | INSERT_SALESPEOPLE6 | public static final String | INSERT_CUSTOMERS1 | public static final String | INSERT_CUSTOMERS2 | public static final String | INSERT_CUSTOMERS3 | public static final String | INSERT_CUSTOMERS4 | public static final String | INSERT_CUSTOMERS5 | public static final String | INSERT_CUSTOMERS6 | public static final String | INSERT_CUSTOMERS7 | public static final String | INSERT_ORDERS1 | public static final String | INSERT_ORDERS2 | public static final String | INSERT_ORDERS3 | public static final String | INSERT_ORDERS4 | public static final String | INSERT_ORDERS5 | public static final String | INSERT_ORDERS6 | public static final String | INSERT_ORDERS7 | public static final String | INSERT_ORDERS8 | public static final String | INSERT_ORDERS9 | public static final String | INSERT_ORDERS10 |
Methods Summary |
---|
public static void | fillCustomersTable(java.sql.Connection conn)
Statement statement = conn.createStatement();
statement.execute(DatabaseCreator.INSERT_CUSTOMERS1);
statement.execute(DatabaseCreator.INSERT_CUSTOMERS2);
statement.execute(DatabaseCreator.INSERT_CUSTOMERS3);
statement.execute(DatabaseCreator.INSERT_CUSTOMERS4);
statement.execute(DatabaseCreator.INSERT_CUSTOMERS5);
statement.execute(DatabaseCreator.INSERT_CUSTOMERS6);
statement.execute(DatabaseCreator.INSERT_CUSTOMERS7);
| public static void | fillFKCascadeTable(java.sql.Connection conn)
Statement statement = conn.createStatement();
statement.execute("INSERT INTO " + FKCASCADE_TABLE
+ " VALUES(1, 1, '1')");
statement.execute("INSERT INTO " + FKCASCADE_TABLE
+ " VALUES(2, 2, '2')");
statement.execute("INSERT INTO " + FKCASCADE_TABLE
+ " VALUES(3, 1, '3')");
| public static void | fillFKStrictTable(java.sql.Connection conn)
Statement statement = conn.createStatement();
statement.execute("INSERT INTO " + FKSTRICT_TABLE
+ " VALUES(1, 1, '1')");
statement.execute("INSERT INTO " + FKSTRICT_TABLE
+ " VALUES(2, 2, '2')");
statement.execute("INSERT INTO " + FKSTRICT_TABLE
+ " VALUES(3, 1, '3')");
| public static void | fillOrdersTable(java.sql.Connection conn)
Statement statement = conn.createStatement();
statement.execute(DatabaseCreator.INSERT_ORDERS1);
statement.execute(DatabaseCreator.INSERT_ORDERS2);
statement.execute(DatabaseCreator.INSERT_ORDERS3);
statement.execute(DatabaseCreator.INSERT_ORDERS4);
statement.execute(DatabaseCreator.INSERT_ORDERS5);
statement.execute(DatabaseCreator.INSERT_ORDERS6);
statement.execute(DatabaseCreator.INSERT_ORDERS7);
statement.execute(DatabaseCreator.INSERT_ORDERS8);
statement.execute(DatabaseCreator.INSERT_ORDERS9);
statement.execute(DatabaseCreator.INSERT_ORDERS10);
| public static void | fillParentTable(java.sql.Connection conn)
Statement statement = conn.createStatement();
statement
.execute("INSERT INTO " + PARENT_TABLE + " VALUES(1, 'test1')");
statement.execute("INSERT INTO " + PARENT_TABLE + " VALUES(2,'test2')");
statement
.execute("INSERT INTO " + PARENT_TABLE + " VALUES(3, 'test3')");
| public static void | fillSalesPeopleTable(java.sql.Connection conn)
Statement statement = conn.createStatement();
statement.execute(DatabaseCreator.INSERT_SALESPEOPLE1);
statement.execute(DatabaseCreator.INSERT_SALESPEOPLE2);
statement.execute(DatabaseCreator.INSERT_SALESPEOPLE3);
statement.execute(DatabaseCreator.INSERT_SALESPEOPLE4);
statement.execute(DatabaseCreator.INSERT_SALESPEOPLE5);
statement.execute(DatabaseCreator.INSERT_SALESPEOPLE6);
| public static void | fillSimpleTable1(java.sql.Connection conn)
Statement statement = conn.createStatement();
statement
.execute("INSERT INTO " + SIMPLE_TABLE1 + " VALUES(1, 10, 20)");
statement.execute("INSERT INTO " + SIMPLE_TABLE1 + " VALUES(2, 5, 7)");
| public static void | fillSimpleTable3(java.sql.Connection conn)
Statement statement = conn.createStatement();
statement.execute("INSERT INTO " + SIMPLE_TABLE3 + " VALUES(1, 8)");
statement.execute("INSERT INTO " + SIMPLE_TABLE3 + " VALUES(2, 6)");
statement.execute("INSERT INTO " + SIMPLE_TABLE3 + " VALUES(3, 4)");
| public static void | fillTestTable1(java.sql.Connection conn, int numberOfRecords)
Statement statement = conn.createStatement();
for (int id = 0; id < numberOfRecords; id++) {
String value = DatabaseCreator.defaultString + id;
String insertQuery = "INSERT INTO " + DatabaseCreator.TEST_TABLE1
+ " (id, field1, field2, field3) VALUES(" + id + ", '"
+ value + "', " + id + ", " + id + ")";
statement.execute(insertQuery);
}
| public static void | fillTestTable2(java.sql.Connection conn, int startID, int endID, long time)
Statement statement = conn.createStatement();
for (int id = startID; id <= endID; id++) {
double value = id + DatabaseCreator.defaultDouble;
String insertQuery = "INSERT INTO " + DatabaseCreator.TEST_TABLE2
+ " (finteger, ftext, fcharacter, fdecimal, fnumeric,"
+ " fsmallint, ffloat, freal, fdouble, fdate, ftime)"
+ " VALUES (" + id + ", '" + DatabaseCreator.defaultString
+ id + "'," + " '" + DatabaseCreator.defaultCharacter + id
+ "', " + value + ", " + value + "," + value + ", " + value
+ ", " + value + "," + value + ", '"
+ new Date(time).toString() + "'," + " '"
+ new Time(time).toString() + "')";
statement.execute(insertQuery);
}
| public static void | fillTestTable2(java.sql.Connection conn, int numberOfRecords)
Statement statement = conn.createStatement();
for (int id = 0; id < numberOfRecords; id++) {
double value = id + DatabaseCreator.defaultDouble;
String insertQuery = "INSERT INTO " + DatabaseCreator.TEST_TABLE2
+ " (finteger, ftext, fcharacter, fdecimal, fnumeric,"
+ " fsmallint, ffloat, freal, fdouble)" + " VALUES (" + id
+ ", '" + DatabaseCreator.defaultString + id + "'," + " '"
+ DatabaseCreator.defaultCharacter + id + "', " + value
+ ", " + value + "," + value + ", " + value + ", " + value
+ "," + value + ")";
statement.execute(insertQuery);
}
| public static void | fillTestTable4(java.sql.Connection conn, int numberOfRecords)
Statement statement = conn.createStatement();
for (int id = 0; id < numberOfRecords; id++) {
String insertQuery = "INSERT INTO " + DatabaseCreator.TEST_TABLE4
+ " (fk, field1) VALUES(" + id + ", \""
+ DatabaseCreator.defaultString + id + "\")";
statement.execute(insertQuery);
}
| public static void | fillTestTable5(java.sql.Connection conn)
Statement statement = conn.createStatement();
statement.execute("INSERT INTO " + TEST_TABLE5 + " VALUES(1, '0')");
statement.execute("INSERT INTO " + TEST_TABLE5 + " VALUES(2, '3')");
statement.execute("INSERT INTO " + TEST_TABLE5 + " VALUES(3, '4')");
|
|