Package org.apache.empire.db

Examples of org.apache.empire.db.DBTableColumn


  /**
   * Returns the empire DataType of the given DBColumn.
   */
  public DataType getDataType(DBColumn c)
  {
    DBTableColumn dbC = (DBTableColumn) c;
    return dbC.getDataType();
  }
View Full Code Here


  /**
   * Returns the default value of the given DBColumn.
   */
  public String getDefaultValue(DBColumn c)
  {
    DBTableColumn dbC = (DBTableColumn) c;
    Object val = dbC.getDefaultValue();
    if (val == null)
    {
      return "null";
    }

View Full Code Here

  @Test
  public void testGetAccessorName(){
    CodeGenConfig config = new CodeGenConfig();
    WriterService service = new WriterService(config);
   
    DBTableColumn col = Mockito.mock(DBTableColumn.class);
    Mockito.when(col.getDataType()).thenReturn(DataType.INTEGER);
    Mockito.when(col.getName()).thenReturn("name");
    assertEquals("getName",service.getAccessorName(col));
   
    DBTableColumn col2 = Mockito.mock(DBTableColumn.class);
    Mockito.when(col2.getDataType()).thenReturn(DataType.BOOL);
    Mockito.when(col2.getName()).thenReturn("name");
    assertEquals("isName",service.getAccessorName(col2));
  }
View Full Code Here

  @Test
  public void testGetMutatorName(){
    CodeGenConfig config = new CodeGenConfig();
    WriterService service = new WriterService(config);
   
    DBTableColumn col = Mockito.mock(DBTableColumn.class);
    Mockito.when(col.getDataType()).thenReturn(DataType.DECIMAL);
    Mockito.when(col.getName()).thenReturn("name");
    assertEquals("setName", service.getMutatorName(col));   
  }
View Full Code Here

        sql.append(" (");
        boolean addSeparator = false;
        Iterator<DBColumn> columns = t.getColumns().iterator();
        while (columns.hasNext())
        {
            DBTableColumn c = (DBTableColumn) columns.next();
            sql.append((addSeparator) ? ",\r\n   " : "\r\n   ");
            if (appendColumnDesc(c, sql, false) == false)
                continue; // Ignore and continue;
            addSeparator = true;
        }
View Full Code Here

        // Create all Sequences
        for (DBTable table : db.getTables())
        {
            for (DBColumn dbColumn : table.getColumns())
            {
                DBTableColumn c = (DBTableColumn) dbColumn;
                if (c.getDataType() == DataType.AUTOINC) {
                    createSequence(db, c, script);
                }
            }
        }
        // Tables and the rest
View Full Code Here

    {
        // Create all Sequences
        for (DBTable table : db.getTables())
        {
            for (DBColumn dbColumn : table.getColumns()) {
                DBTableColumn c = (DBTableColumn) dbColumn;
                if (c.getDataType() == DataType.AUTOINC) {
                    createSequence(db, c, script);
                }
            }
        }
        // default processing
View Full Code Here

        {
            DBTable table = seqtabs.next();
            Iterator<DBColumn> cols = table.getColumns().iterator();
            while (cols.hasNext())
            {
                DBTableColumn c = (DBTableColumn) cols.next();
                if (c.getDataType() == DataType.AUTOINC)
                {
                    createSequence(db, c, script);
                }
            }
        }
View Full Code Here

        sql.append(" (");
        boolean addSeparator = false;
        Iterator<DBColumn> columns = t.getColumns().iterator();
        while (columns.hasNext())
        {
            DBTableColumn c = (DBTableColumn) columns.next();
            // Append column
            sql.append((addSeparator) ? ",\r\n   " : "\r\n   ");
            appendColumnDesc(c, false, sql);
            addSeparator = true;
        }
View Full Code Here

        {
            DBTable table = seqtabs.next();
            Iterator<DBColumn> cols = table.getColumns().iterator();
            while (cols.hasNext())
            {
                DBTableColumn c = (DBTableColumn) cols.next();
                if (c.getDataType() == DataType.AUTOINC)
                {
                    createSequence(db, c, script);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.empire.db.DBTableColumn

Copyright © 2018 www.massapicom. 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.