public void createTable ( String tblName , Schema sch , Transaction tx ) { if ( tblName != TCAT_TBLNAME && tblName != FCAT_TBLNAME ) formatFileHeader ( tblName , tx ) ; // Optimization: store the ti tiMap . put ( tblName , new TableInfo ( tblName , sch ) ) ; // insert one record into tblcat RecordFile tcatfile = tcatInfo . open ( tx , true ) ; tcatfile . insert ( ) ; tcatfile . setVal ( TCAT_TBLNAME , new VarcharConstant ( tblName ) ) ; tcatfile . close ( ) ; // insert a record into fldcat for each field RecordFile fcatfile = fcatInfo . open ( tx , true ) ; for ( String fldname : sch . fields ( ) ) { fcatfile . insert ( ) ; fcatfile . setVal ( FCAT_TBLNAME , new VarcharConstant ( tblName ) ) ; fcatfile . setVal ( FCAT_FLDNAME , new VarcharConstant ( fldname ) ) ; fcatfile . setVal ( FCAT_TYPE , new IntegerConstant ( sch . type ( fldname ) . getSqlType ( ) ) ) ; fcatfile . setVal ( FCAT_TYPEARG , new IntegerConstant ( sch . type ( fldname ) . getArgument ( ) ) ) ; } fcatfile . close ( ) ; }
Creates a new table having the specified name and schema .