Examples of DBSQLScript


Examples of org.apache.empire.db.DBSQLScript

    public void createDatabase() {
        Connection conn = getConnection();

        // create DLL for Database Definition
        DBSQLScript script = new DBSQLScript();
        db.getCreateDDLScript(driver, script);
        // Show DLL Statement
        System.out.println(script.toString());
        // Execute Script
        script.run(driver, conn, false);
    }
View Full Code Here

Examples of org.apache.empire.db.DBSQLScript

    //db.setPreparedStatementsEnabled(true);

    db.open(driver, dbResource.getConnection());

    if(!databaseExists(conn, db)){
      DBSQLScript script = new DBSQLScript();
      db.getCreateDDLScript(db.getDriver(), script);
      System.out.println(script.toString());
      script.run(db.getDriver(), dbResource.getConnection(), false);
    }
   
    conn.close();
  }
View Full Code Here

Examples of org.apache.empire.db.DBSQLScript

     * line
     */
    private void createSampleDatabase(DBDatabaseDriver driver, Connection conn)
    {
        // create DLL for Database Definition
        DBSQLScript script = new DBSQLScript();
        db.getCreateDDLScript(driver, script);
        // Show DLL Statements
        System.out.println(script.toString());
        // Execute Script
        script.run(driver, conn, false);
        db.commit(conn);
        // Open again
        if (!db.isOpen()){
        db.open(driver, conn);
        }
View Full Code Here

Examples of org.apache.empire.db.DBSQLScript

     * </PRE>
   */
  private static void createDatabase(DBDatabaseDriver driver, Connection conn)
    {
    // create DLL for Database Definition
      DBSQLScript script = new DBSQLScript();
    db.getCreateDDLScript(driver, script);
    // Show DLL Statement
    System.out.println(script.toString());
    // Execute Script
    script.run(driver, conn, false);
    // Commit
    db.commit(conn);
  }
View Full Code Here

Examples of org.apache.empire.db.DBSQLScript

     * </PRE>
     */
    private static void createDatabase(DBDatabaseDriver driver, Connection conn)
    {
        // create DLL for Database Definition
        DBSQLScript script = new DBSQLScript();
        db.getCreateDDLScript(driver, script);
        // Show DLL Statement
        System.out.println(script.toString());
        // Execute Script
        script.run(driver, conn, false);
        // Commit
        db.commit(conn);
    }
View Full Code Here

Examples of org.apache.empire.db.DBSQLScript

        // First, add a new column to the Table object
        DBTableColumn C_FOO = db.T_EMPLOYEES.addColumn("FOO", DataType.TEXT, 20, false);

        // Now create the corresponding DDL statement
        System.out.println("Creating new column named FOO as varchar(20) for the EMPLOYEES table:");
        DBSQLScript script = new DBSQLScript();
        db.getDriver().getDDLScript(DBCmdType.CREATE, C_FOO, script);
        script.run(db.getDriver(), conn, false);
       
        // Now load a record from that table and set the value for foo
        System.out.println("Changing the value for the FOO field of a particular employee:");
        DBRecord rec = new DBRecord();
        rec.read(db.T_EMPLOYEES, idTestPerson, conn);
        rec.setValue(C_FOO, "Hello World");
        rec.update(conn);
       
        // Now extend the size of the field from 20 to 40 characters
        System.out.println("Extending size of column FOO to 40 characters:");
        C_FOO.setSize(40);
        script.clear();
        db.getDriver().getDDLScript(DBCmdType.ALTER, C_FOO, script);
        script.run(db.getDriver(), conn, false);

        // Now set a longer value for the record
        System.out.println("Changing the value for the FOO field for the above employee to a longer string:");
        rec.setValue(C_FOO, "This is a very long field value!");
        rec.update(conn);

        // Finally, drop the column again
        System.out.println("Dropping the FOO column from the employee table:");
        script.clear();
        db.getDriver().getDDLScript(DBCmdType.DROP, C_FOO, script);
        script.run(db.getDriver(), conn, false);
    }
View Full Code Here

Examples of org.apache.empire.db.DBSQLScript

   * the department tables does not exist, the entire dll-script is executed
   * line by line
   */
  private void createSampleDatabase(DBDatabaseDriver driver, Connection conn) {
    // create DLL for Database Definition
    DBSQLScript script = new DBSQLScript();
    sampleDB.getCreateDDLScript(driver, script);
    // Show DLL Statements
    System.out.println(script.toString());
    // Execute Script
    script.run(driver, conn, false);
    sampleDB.commit(conn);
    // Open again
    if (!sampleDB.isOpen()) {
      sampleDB.open(driver, conn);
    }
View Full Code Here

Examples of org.apache.empire.db.DBSQLScript

     * </PRE>
   */
  private static void createDatabase(DBDatabaseDriver driver, Connection conn)
    {
    // create DDL for Database Definition
      DBSQLScript script = new DBSQLScript();
    db.getCreateDDLScript(driver, script);
    // Show DDL Statement
    System.out.println(script.toString());
    // Execute Script
    script.run(driver, conn, false);
    // Commit
    db.commit(conn);
  }
View Full Code Here

Examples of org.apache.empire.db.DBSQLScript

    public void createDatabase() {
        Connection conn = getConnection();

        // create DLL for Database Definition
        DBSQLScript script = new DBSQLScript();
        db.getCreateDDLScript(driver, script);
        // Show DLL Statement
        System.out.println(script.toString());
        // Execute Script
        script.run(driver, conn, false);
    }
View Full Code Here

Examples of org.apache.empire.db.DBSQLScript

     * </PRE>
   */
  private static void createDatabase(DBDatabaseDriver driver, Connection conn)
    {
    // create DLL for Database Definition
      DBSQLScript script = new DBSQLScript();
    db.getCreateDDLScript(driver, script);
    // Show DLL Statement
    System.out.println(script.toString());
    // Execute Script
    script.run(driver, conn, false);
    // Commit
    db.commit(conn);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.