Examples of DBDatabase


Examples of org.apache.empire.db.DBDatabase

     * returns the Database driver or null if the Expression is not attached to an open database<BR>
     * This function is intended for convenience only.
     */
    protected final DBDatabaseDriver getDatabaseDriver()
    {
        DBDatabase db = getDatabase();
        return (db!=null) ? db.getDriver() : null;
    }
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

     * returns the Database driver or null if the Expression is not attached to an open database<BR/>
     * This function is intended for convenience only.
     */
    protected final DBDatabaseDriver getDatabaseDriver()
    {
        DBDatabase db = getDatabase();
        return (db!=null) ? db.getDriver() : null;
    }
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

            }
            sql.append(")");
        }
        sql.append(")");
        // Create the table
        DBDatabase db = t.getDatabase();
        if (script.addStmt(sql) == false)
            return false;
        // Create other Indexes (except primary key)
        Iterator<DBIndex> indexes = t.getIndexes().iterator();
        while (indexes.hasNext())
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

        parser = new CodeGenParser(config);
    }

    @Test
    public void testLoadDbModel() {
        final DBDatabase db = parser.loadDbModel();

        final DBTable departments = db.getTable("DEPARTMENTS");
        final DBTable employees = db.getTable("EMPLOYEES");

        assertNotNull("Expected DEPARTMENTS table.", departments);
    assertNotNull("Expected EMPLOYEES table.", employees);

        final List<DBRelation> relations = db.getRelations();
        assertEquals("Should have two relations.", 2, relations.size());

        final DBRelation dbRelation = relations.get(1);
        assertEquals("EMPLOYEES_DEPARTMENT_I_FK", dbRelation.getName());
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

     * returns the Database driver or null if the Expression is not attached to an open database<BR/>
     * This function is intended for convenience only.
     */
    protected final DBDatabaseDriver getDatabaseDriver()
    {
        DBDatabase db = getDatabase();
        return (db!=null) ? db.getDriver() : null;
    }
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

    // log all options
    listOptions(config);
   
    // read the database model
    CodeGenParser parser = new CodeGenParser(config);
    DBDatabase db = parser.loadDbModel();
   
    // create the source-code for that database
    CodeGenWriter codeGen = new CodeGenWriter(config);
    codeGen.generateCodeFiles(db);
   
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

  /**
   * returns the populated DBDatabase
   */
  public DBDatabase loadDbModel() {
    DBDatabase db = new InMemoryDatabase();
      try {          
            con = openJDBCConnection(config);
            populateDatabase(db);
        }
        catch (SQLException e)
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

            }
            sql.append(")");
        }
        sql.append(")");
        // Create the table
        DBDatabase db = t.getDatabase();
        if (script.addStmt(sql) == false)
            return false;
        // Create other Indexes (except primary key)
        Iterator<DBIndex> indexes = t.getIndexes().iterator();
        while (indexes.hasNext())
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

    }

    public boolean databaseExists() {
        Connection conn = getConnection();
        try {
            DBDatabase db = getDatabase();
            if (db.getTables() == null || db.getTables().isEmpty()) {
                throw new AssertionError("There are no tables in this database!");
            }
            DBCommand cmd = db.createCommand();
            if (cmd == null) {
                throw new AssertionError("The DBCommand object is null.");
            }
            DBTable t = db.getTables().get(0);
            cmd.select(t.count());
            return (db.querySingleInt(cmd.getSelect(), -1, conn) >= 0);
        } catch (Exception e) {
            return false;
        }
    }
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

     */
    public BeanResult(Class<T> clazz, DBRowSet rowset)
    {
        this.clazz = clazz;
        // Create the command
        DBDatabase db = rowset.getDatabase();
        cmd = db.createCommand();
        // Select all accessible columns
        int count = 0;
        Method[] methods = clazz.getMethods();
        for (DBColumn col : rowset.getColumns())
        {   // obtain the bean property Name
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.