Examples of DBDatabase


Examples of org.apache.empire.db.DBDatabase

    @Override
    protected void createTable(DBTable t, DBSQLScript script)
    {
        super.createTable(t, script);
        // Add Column comments (if any)
        DBDatabase db = t.getDatabase();
        createComment(db, "TABLE", t, t.getComment(), script);
        Iterator<DBColumn> columns = t.getColumns().iterator();
        while (columns.hasNext())
        {
            DBColumn c = columns.next();
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 Indizes (except primary key)
        Iterator<DBIndex> indexes = t.getIndexes().iterator();
        while (indexes.hasNext())
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

            if (dbix<=0)
            {
                log.error("Invalid column expression '{}'!", name);
                return null; // not found
            }
            DBDatabase db = DBDatabase.findById(name.substring(0,dbix));
            if (db==null)
            {
                log.error("Database '{}' not found!", name.substring(0,dbix));
                return null; // not found
            }
            int co = name.lastIndexOf('.');
            int to = name.lastIndexOf('.', co - 1);
            String cn = name.substring(co + 1);
            String tn = name.substring(to + 1, co);
            DBRowSet rs = db.getRowSet(tn);
            if (rs == null)
            {
                log.error("Table/View '{}' not found in database!", tn);
                return null; // not found
            }
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

    //config.setExceptionsEnabled(true);
   
    getLog().info("Generating code for " + jdbcURL + " ...");
   
    CodeGenParser parser = new CodeGenParser(config);
    DBDatabase db = parser.loadDbModel();
   
    CodeGenWriter codeGen = new CodeGenWriter(config);
    codeGen.generateCodeFiles(db);
   
    getLog().info("Code successfully generated in: " + targetDirectory);
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

    //config.setExceptionsEnabled(true);
   
    getLog().info("Generating code for " + jdbcURL + " ...");
   
    CodeGenParser parser = new CodeGenParser(config);
    DBDatabase db = parser.loadDbModel();
   
    CodeGenWriter codeGen = new CodeGenWriter(config);
    codeGen.generateCodeFiles(db);
   
    getLog().info("Code successfully generated in: " + targetDirectory);
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 Indizes (except primary key)
        Iterator<DBIndex> indexes = t.getIndexes().iterator();
        while (indexes.hasNext())
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

  /**
   * returns the populated DBDatabase
   */
  public DBDatabase loadDbModel() {
    DBDatabase db = new InMemoryDatabase();
      try {          
            con = openJDBCConnection(config);
            populateDatabase(db);
        }
        catch (SQLException e)
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.