Public Member Functions | |
CacheDatabaseSchema (DatabaseSchema dbs) | |
void | addTable (CacheDatabaseTable table) |
void | removeTable (CacheDatabaseTable table) |
void | mergeSchema (CacheDatabaseSchema databaseSchema) throws SQLException |
ArrayList | getTables () |
CacheDatabaseTable | getTable (String tableName) |
boolean | hasTable (String tableName) |
boolean | equals (Object other) |
String | getInformation (boolean longFormat) |
CacheDatabaseSchema
describes all the tables and columns of a database and its associated cache entries.
Definition at line 41 of file CacheDatabaseSchema.java.
|
Creates a new
Definition at line 52 of file CacheDatabaseSchema.java. References org.objectweb.cjdbc.common.sql.schema.DatabaseSchema.getTables(). 00053 { 00054 if (dbs == null) 00055 { 00056 tables = new ArrayList(); 00057 return; 00058 } 00059 00060 // Clone the tables 00061 ArrayList origTables = dbs.getTables(); 00062 int size = origTables.size(); 00063 tables = new ArrayList(size); 00064 for (int i = 0; i < size; i++) 00065 tables.add(new CacheDatabaseTable((DatabaseTable) origTables.get(i))); 00066 }
|
|
Adds a
Definition at line 74 of file CacheDatabaseSchema.java. Referenced by org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.mergeSchema(). 00075 { 00076 tables.add(table); 00077 }
|
|
Two
Definition at line 176 of file CacheDatabaseSchema.java. References org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.equals(), and org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.getTables(). 00177 { 00178 if (!(other instanceof CacheDatabaseSchema)) 00179 return false; 00180 00181 if (tables == null) 00182 return ((CacheDatabaseSchema) other).getTables() == null; 00183 else 00184 return tables.equals(((CacheDatabaseSchema) other).getTables()); 00185 }
|
|
Returns information about the database schema.
Definition at line 194 of file CacheDatabaseSchema.java. References org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getInformation(). 00195 { 00196 String result = ""; 00197 int size = tables.size(); 00198 for (int i = 0; i < size; i++) 00199 { 00200 CacheDatabaseTable t = (CacheDatabaseTable) tables.get(i); 00201 result += t.getInformation(longFormat) + "\n"; 00202 } 00203 return result; 00204 }
|
|
|
Returns an
Definition at line 126 of file CacheDatabaseSchema.java. Referenced by org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.equals(). 00127 {
00128 return tables;
00129 }
|
|
Returns
Definition at line 157 of file CacheDatabaseSchema.java. References org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getName(). 00158 { 00159 int size = tables.size(); 00160 for (int i = 0; i < size; i++) 00161 { 00162 CacheDatabaseTable t = (CacheDatabaseTable) tables.get(i); 00163 if (tableName.equals(t.getName())) 00164 return true; 00165 } 00166 return false; 00167 }
|
|
Merge the given schema with the current one. All missing tables or columns are added if no conflict is detected. An exception is thrown if the given schema definition conflicts with the current one.
Definition at line 98 of file CacheDatabaseSchema.java. References org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.addTable(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getName(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.getTable(), org.objectweb.cjdbc.common.sql.schema.DatabaseSchema.getTables(), and org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.mergeColumns(). 00100 { 00101 if (databaseSchema == null) 00102 return; 00103 00104 ArrayList otherTables = databaseSchema.getTables(); 00105 if (otherTables == null) 00106 return; 00107 00108 int size = otherTables.size(); 00109 for (int i = 0; i < size; i++) 00110 { 00111 CacheDatabaseTable t = (CacheDatabaseTable) otherTables.get(i); 00112 CacheDatabaseTable original = getTable(t.getName()); 00113 if (original == null) 00114 addTable(t); 00115 else 00116 original.mergeColumns(t); 00117 } 00118 }
|
|
Removes a
Definition at line 85 of file CacheDatabaseSchema.java. 00086 { 00087 tables.remove(table); 00088 }
|