| 45 | } |
| 46 | |
| 47 | static void schema(String filename) throws IOException{ |
| 48 | |
| 49 | Database db = DatabaseBuilder.open(new File(filename)); |
| 50 | try{ |
| 51 | for(String tableName : db.getTableNames()){ |
| 52 | Table table = db.getTable(tableName); |
| 53 | System.out.println(String.format("CREATE TABLE %s (", tableName)); |
| 54 | for(Column col : table.getColumns()){ |
| 55 | System.out.println(String.format(" %s %s,", |
| 56 | col.getName(), col.getType())); |
| 57 | } |
| 58 | System.out.println(")"); |
| 59 | } |
| 60 | }finally{ |
| 61 | db.close(); |
| 62 | } |
| 63 | |
| 64 | } |
| 65 | |
| 66 | static void exportAll(String filename) throws IOException{ |
| 67 | Database db = DatabaseBuilder.open(new File(filename)); |