Changeset 4589
- Timestamp:
- Oct 16, 2008, 1:23:42 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/src/docbook/admindoc/installation_upgrade.xml
r4567 r4589 1002 1002 Change directory to 1003 1003 <filename class="directory"><base-dir>/bin</filename> 1004 and run <filename>initdb.sh</filename> as 1005 <programlisting>./initdb.sh [base_root_login] base_root_password</programlisting> 1004 and execute the following commands: 1005 <programlisting> 1006 ./initdb.sh [base_root_login] base_root_password 1007 ./updateindexes.sh 1008 </programlisting> 1009 1010 The second command is important for PostgreSQL users 1011 since the Hibernate database initialisation utility 1012 is not able to create all indexes that are required. 1013 BASE will still work without the indexes but performance 1014 may suffer. 1006 1015 1007 1016 <important> -
trunk/src/core/net/sf/basedb/core/HibernateUtil.java
r4557 r4589 2092 2092 2093 2093 TableInfo tiHib = new TableInfo(table, dialect); 2094 2095 2094 if (isVerbose) 2096 2095 { … … 2103 2102 // Write primary key 2104 2103 System.out.println(" Primary key : " + tiHib.getPrimaryKey()); 2104 } 2105 2105 2106 // Write foreign keys 2107 for (ForeignKeyInfo fk : tiHib.getForeignKeys()) 2106 // Write foreign keys 2107 for (ForeignKeyInfo fk : tiHib.getForeignKeys()) 2108 { 2109 if (!silent) 2108 2110 { 2109 2111 System.out.println(" Foreign key : " + fk); 2112 } 2113 2114 // Check that an index for the foreign key exists 2115 String indexName = tiDb.findIndexName(fk.getName(), fk.getFkColumns()); 2116 boolean indexExists = indexName != null; 2117 String createSql = 2118 dbEngine.getCreateIndexSql(table.getCatalog(), table.getSchema(), 2119 table.getName(), fk.getName(), fk.getFkColumns(), false); 2120 boolean actionCreate = updateIndexes && !indexExists; 2121 2122 if (!silent) 2123 { 2124 System.out.println(" Indexed : " + indexExists + (indexExists ? "(" + indexName + ")" : "")); 2125 System.out.println(" INDEX-SQL : " + createSql); 2126 System.out.println(" Actions : " + (actionCreate ? "CREATE INDEX" : "")); 2127 } 2128 if (actionCreate) 2129 { 2130 Statement st = null; 2131 try 2132 { 2133 st = connection.createStatement(); 2134 if (actionCreate) 2135 { 2136 log.info("Creating foreign key index: + " + createSql); 2137 st.executeUpdate(createSql); 2138 } 2139 connection.commit(); 2140 st.close(); 2141 st = null; 2142 } 2143 catch (SQLException ex) 2144 { 2145 log.error("Exception", ex); 2146 throw new BaseException(ex); 2147 } 2148 finally 2149 { 2150 if (st != null) 2151 { 2152 try 2153 { 2154 st.close(); 2155 } 2156 catch (Throwable t) 2157 { 2158 log.error("Exception", t); 2159 } 2160 } 2161 } 2110 2162 } 2111 2163 } -
trunk/src/core/net/sf/basedb/core/dbengine/TableInfo.java
r4517 r4589 218 218 fki.refColumns.add(column.getName()); 219 219 } 220 foreignKeys.add(fki); 220 221 } 221 222 … … 453 454 public String toString() 454 455 { 455 return name == null ? "MISSING" : name+ " " + columns;456 return columns.isEmpty() ? "MISSING" : (name == null ? "<no name>" : name) + " " + columns; 456 457 } 457 458 }
Note: See TracChangeset
for help on using the changeset viewer.