1 33 package smallsql.database; 34 35 36 37 final class CommandCreateTable extends Command{ 38 39 final private Columns columns = new Columns(); 40 final private IndexDescriptions indexes = new IndexDescriptions(); 41 final private ForeignKeys foreignKeys = new ForeignKeys(); 42 43 44 CommandCreateTable( Logger log, String name ){ 45 super(log); 46 this.type = SQLTokenizer.TABLE; 47 this.name = name; 48 } 49 50 51 55 void addColumn( Column column ){ 56 columns.add( column ); 57 } 58 59 60 void addIndex( IndexDescription indexDescription ){ 61 indexes.add(indexDescription); 62 } 63 64 65 void addForeingnKey(ForeignKey key){ 66 foreignKeys.add(key); 67 } 68 69 70 void executeImpl(SSConnection con, SSStatement st) throws Exception { 71 con.getDatabase(false).createTable( con, name, columns, indexes, foreignKeys ); 72 } 73 } | Popular Tags |