1 21 22 package org.apache.derby.impl.tools.dblook; 23 24 import java.sql.Connection ; 25 import java.sql.Statement ; 26 import java.sql.ResultSet ; 27 import java.sql.SQLException ; 28 29 import java.util.HashMap ; 30 31 import org.apache.derby.tools.dblook; 32 33 public class DB_Schema { 34 35 45 46 public static void doSchemas(Connection conn, 47 boolean tablesOnly) throws SQLException 48 { 49 50 Statement stmt = conn.createStatement(); 51 ResultSet rs = stmt.executeQuery("SELECT SCHEMANAME, SCHEMAID " + 52 "FROM SYS.SYSSCHEMAS"); 53 54 boolean firstTime = true; 55 while (rs.next()) { 56 57 String sName = dblook.addQuotes( 58 dblook.expandDoubleQuotes(rs.getString(1))); 59 if (tablesOnly || dblook.isIgnorableSchema(sName)) 60 continue; 61 62 if (sName.equals("\"APP\"")) 63 continue; 65 66 if (firstTime) { 67 Logs.reportString("----------------------------------------------"); 68 Logs.reportMessage("DBLOOK_SchemasHeader"); 69 Logs.reportString("----------------------------------------------\n"); 70 } 71 72 Logs.writeToNewDDL("CREATE SCHEMA " + sName); 73 Logs.writeStmtEndToNewDDL(); 74 Logs.writeNewlineToNewDDL(); 75 firstTime = false; 76 77 } 78 79 rs.close(); 80 stmt.close(); 81 82 } 83 84 } 85 | Popular Tags |