Package org.apache.empire.db

Examples of org.apache.empire.db.DBTableColumn


        {
            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();
            sql.append((addSeparator) ? ",\r\n   " : "\r\n   ");
            if (appendColumnDesc(c, sql, false)==false)
                continue; // Ignore and continue;
            addSeparator = true;
        }
View Full Code Here

    try {
      rs = dbMeta.getColumns(config.getDbCatalog(), config.getDbSchema(),
          t.getName(), null);
          int i=0;
      while (rs.next()) {
        DBTableColumn c = addColumn(t, rs);
        // check if it is a KeyColumn
        if (pkCols.contains(c.getName()))
          keys[i++] = c;
       
        // check if it is the Timestamp/Locking Column
        if (lockColName!=null && c.getName().equalsIgnoreCase(lockColName))
          t.setTimestampColumn(c);
      }
          // Check whether all key columns have been set
          for (i=0; i<keys.length; i++)
              if (keys[i]==null)
View Full Code Here

   
    // Move from the return statement below so we can add
    // some AUTOINC meta data to the column to be used by
    // the ParserUtil and ultimately the template.
    log.info("\tCOLUMN:\t" + name + " ("+empireType+")");
    DBTableColumn col = t.addColumn(name, empireType, colSize, required, defaultValue);
   
    // We still need to know the base data type for this AUTOINC
    // because the Record g/setters need to know this, right?
    // So, let's add it as meta data every time the column is AUTOINC
    // and reference it in the template.
    if(empireType.equals(DataType.AUTOINC))
      col.setAttribute("AutoIncDataType", originalType);
    return col;
   
  }
View Full Code Here

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

        {
            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();
            sql.append((addSeparator) ? ",\r\n   " : "\r\n   ");
            if (appendColumnDesc(c, sql)==false)
                continue; // Ignore and continue;
            addSeparator = true;
        }
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.