DbTable.java 1.41 KB
package com.bitstrips.imoji.database;

public class DbTable
{
  private final String a;
  private final DbTableSchema[] b;
  
  public DbTable(String paramString, DbTableSchema[] paramArrayOfDbTableSchema)
  {
    this.a = paramString;
    this.b = paramArrayOfDbTableSchema;
  }
  
  public final DbTableSchema[] getColumns()
  {
    return this.b;
  }
  
  public String getCreateTableQuery()
  {
    int i = 0;
    String str = getName();
    StringBuilder localStringBuilder = new StringBuilder();
    while (i < this.b.length)
    {
      DbTableSchema localDbTableSchema = this.b[i];
      if (i > 0) {
        localStringBuilder.append(", ");
      }
      localStringBuilder.append(localDbTableSchema.getColumnName()).append(' ').append(localDbTableSchema.getDataType());
      if (localDbTableSchema.getConstraints() != null) {
        localStringBuilder.append(' ').append(localDbTableSchema.getConstraints());
      }
      i += 1;
    }
    return String.format("CREATE TABLE IF NOT EXISTS %s (%s)", new Object[] { str, localStringBuilder.toString() });
  }
  
  public String getDropTableQuery()
  {
    return String.format("DROP TABLE IF EXISTS %s;", new Object[] { getName() });
  }
  
  public final String getName()
  {
    return this.a;
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/database/DbTable.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */