protected void giveTableSchemaACopy(String tableName,int tableType,SQLiteDatabase db){
  StringBuilder sql=new StringBuilder("select * from ");
  sql.append(Const.TableSchema.TABLE_NAME);
  LogUtil.d(TAG,"giveTableSchemaACopy SQL is >> " + sql);
  Cursor cursor=null;
  try {
    cursor=db.rawQuery(sql.toString(),null);
    if (isNeedtoGiveACopy(cursor,tableName)) {
      ContentValues values=new ContentValues();
      values.put(Const.TableSchema.COLUMN_NAME,BaseUtility.changeCase(tableName));
      values.put(Const.TableSchema.COLUMN_TYPE,tableType);
      db.insert(Const.TableSchema.TABLE_NAME,null,values);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    if (cursor != null) {
      cursor.close();
    }
  }
}

protected void giveTableSchemaACopy ( String tableName , int tableType , SQLiteDatabase db ) { StringBuilder sql = new StringBuilder ( "select * from " ) ; sql . append ( Const . TableSchema . TABLE_NAME ) ; LogUtil . d ( TAG , "giveTableSchemaACopy SQL is >> " + sql ) ; Cursor cursor = null ; try { cursor = db . rawQuery ( sql . toString ( ) , null ) ; if ( isNeedtoGiveACopy ( cursor , tableName ) ) { ContentValues values = new ContentValues ( ) ; values . put ( Const . TableSchema . COLUMN_NAME , BaseUtility . changeCase ( tableName ) ) ; values . put ( Const . TableSchema . COLUMN_TYPE , tableType ) ; db . insert ( Const . TableSchema . TABLE_NAME , null , values ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { if ( cursor != null ) { cursor . close ( ) ; } } }
once there ' s new table created . the table name will be saved into table_schema as a copy . each table name will be saved only once .
