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

    }

    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, -1, conn) >= 0);
        } catch (Exception e) {
            return false;
        }
    }
View Full Code Here

Examples of org.apache.empire.db.DBDatabase

    {
        CodeGenConfig config = new CodeGenConfig();
        config.init("testconfig.xml", true);
        CodeGenWriter codeGen = new CodeGenWriter(config);
       
        DBDatabase db = new DBDatabase() {
        };
       
        List<File> files = codeGen.generateCodeFiles(db);
        assertEquals(4, files.size());
        for(File file:files){
View Full Code Here

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);
        for (DBColumn c : t.getColumns())
        {
            String com = c.getComment();
            if (com != null)
View Full Code Here

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

            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

    // 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

            return ((Record)base).getValue(index);
        }
        else if (base==null)
        {   // LookupDatabase
            String name = StringUtils.toString(property);
            DBDatabase db = DBDatabase.findById(name);
            if (db!=null)
                context.setPropertyResolved(true);
            // done
            return 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

     */
    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.