| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
package com.healthmarketscience.jackcess; |
| 29 | |
|
| 30 | |
import java.io.BufferedReader; |
| 31 | |
import java.io.Closeable; |
| 32 | |
import java.io.File; |
| 33 | |
import java.io.FileNotFoundException; |
| 34 | |
import java.io.FileReader; |
| 35 | |
import java.io.Flushable; |
| 36 | |
import java.io.IOException; |
| 37 | |
import java.io.RandomAccessFile; |
| 38 | |
import java.nio.ByteBuffer; |
| 39 | |
import java.nio.channels.Channels; |
| 40 | |
import java.nio.channels.FileChannel; |
| 41 | |
import java.sql.ResultSet; |
| 42 | |
import java.sql.ResultSetMetaData; |
| 43 | |
import java.sql.SQLException; |
| 44 | |
import java.util.ArrayList; |
| 45 | |
import java.util.Arrays; |
| 46 | |
import java.util.Collection; |
| 47 | |
import java.util.ConcurrentModificationException; |
| 48 | |
import java.util.Date; |
| 49 | |
import java.util.HashMap; |
| 50 | |
import java.util.HashSet; |
| 51 | |
import java.util.Iterator; |
| 52 | |
import java.util.LinkedList; |
| 53 | |
import java.util.List; |
| 54 | |
import java.util.Map; |
| 55 | |
import java.util.NoSuchElementException; |
| 56 | |
import java.util.Set; |
| 57 | |
|
| 58 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
| 59 | |
import org.apache.commons.logging.Log; |
| 60 | |
import org.apache.commons.logging.LogFactory; |
| 61 | |
|
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
|
| 76 | |
|
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
public class Database |
| 81 | |
implements Iterable<Table>, Closeable, Flushable |
| 82 | |
{ |
| 83 | |
|
| 84 | 1 | private static final Log LOG = LogFactory.getLog(Database.class); |
| 85 | |
|
| 86 | |
|
| 87 | |
|
| 88 | 1 | private static final byte[] SYS_DEFAULT_SID = new byte[2]; |
| 89 | |
static { |
| 90 | 1 | SYS_DEFAULT_SID[0] = (byte) 0xA6; |
| 91 | 1 | SYS_DEFAULT_SID[1] = (byte) 0x33; |
| 92 | |
} |
| 93 | |
|
| 94 | |
|
| 95 | |
|
| 96 | |
public static final boolean DEFAULT_AUTO_SYNC = true; |
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
public static final String USE_BIG_INDEX_PROPERTY = |
| 101 | |
"com.healthmarketscience.jackcess.bigIndex"; |
| 102 | |
|
| 103 | |
|
| 104 | |
private static final int COPY_TABLE_BATCH_SIZE = 200; |
| 105 | |
|
| 106 | |
|
| 107 | |
private static final int PAGE_SYSTEM_CATALOG = 2; |
| 108 | |
|
| 109 | |
private static final String TABLE_SYSTEM_CATALOG = "MSysObjects"; |
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | 1 | private static final Integer SYS_FULL_ACCESS_ACM = 1048575; |
| 115 | |
|
| 116 | |
|
| 117 | |
private static final String ACE_COL_ACM = "ACM"; |
| 118 | |
|
| 119 | |
private static final String ACE_COL_F_INHERITABLE = "FInheritable"; |
| 120 | |
|
| 121 | |
private static final String ACE_COL_OBJECT_ID = "ObjectId"; |
| 122 | |
|
| 123 | |
private static final String ACE_COL_SID = "SID"; |
| 124 | |
|
| 125 | |
|
| 126 | |
private static final String REL_COL_COLUMN_COUNT = "ccolumn"; |
| 127 | |
|
| 128 | |
private static final String REL_COL_FLAGS = "grbit"; |
| 129 | |
|
| 130 | |
private static final String REL_COL_COLUMN_INDEX = "icolumn"; |
| 131 | |
|
| 132 | |
private static final String REL_COL_TO_COLUMN = "szColumn"; |
| 133 | |
|
| 134 | |
private static final String REL_COL_TO_TABLE = "szObject"; |
| 135 | |
|
| 136 | |
private static final String REL_COL_FROM_COLUMN = "szReferencedColumn"; |
| 137 | |
|
| 138 | |
private static final String REL_COL_FROM_TABLE = "szReferencedObject"; |
| 139 | |
|
| 140 | |
private static final String REL_COL_NAME = "szRelationship"; |
| 141 | |
|
| 142 | |
|
| 143 | |
|
| 144 | |
private static final String CAT_COL_ID = "Id"; |
| 145 | |
|
| 146 | |
private static final String CAT_COL_NAME = "Name"; |
| 147 | |
private static final String CAT_COL_OWNER = "Owner"; |
| 148 | |
|
| 149 | |
private static final String CAT_COL_PARENT_ID = "ParentId"; |
| 150 | |
|
| 151 | |
private static final String CAT_COL_TYPE = "Type"; |
| 152 | |
|
| 153 | |
private static final String CAT_COL_DATE_CREATE = "DateCreate"; |
| 154 | |
|
| 155 | |
private static final String CAT_COL_DATE_UPDATE = "DateUpdate"; |
| 156 | |
|
| 157 | |
private static final String CAT_COL_FLAGS = "Flags"; |
| 158 | |
|
| 159 | |
|
| 160 | |
private static final String EMPTY_MDB = "com/healthmarketscience/jackcess/empty.mdb"; |
| 161 | |
|
| 162 | |
private static final String ESCAPE_PREFIX = "x"; |
| 163 | |
|
| 164 | |
private static final String PREFIX_SYSTEM = "MSys"; |
| 165 | |
|
| 166 | |
private static final String SYSTEM_OBJECT_NAME_TABLES = "Tables"; |
| 167 | |
|
| 168 | |
private static final String TABLE_SYSTEM_ACES = "MSysACEs"; |
| 169 | |
|
| 170 | |
private static final String TABLE_SYSTEM_RELATIONSHIPS = "MSysRelationships"; |
| 171 | |
|
| 172 | 1 | private static final Short TYPE_TABLE = (short) 1; |
| 173 | |
|
| 174 | |
|
| 175 | 1 | private static Collection<String> SYSTEM_CATALOG_COLUMNS = |
| 176 | |
new HashSet<String>(Arrays.asList(CAT_COL_NAME, CAT_COL_TYPE, CAT_COL_ID)); |
| 177 | |
|
| 178 | |
|
| 179 | |
|
| 180 | |
|
| 181 | |
|
| 182 | |
|
| 183 | 1 | private static final Set<String> RESERVED_WORDS = new HashSet<String>(); |
| 184 | |
static { |
| 185 | |
|
| 186 | 1 | RESERVED_WORDS.addAll(Arrays.asList( |
| 187 | |
"add", "all", "alphanumeric", "alter", "and", "any", "application", "as", |
| 188 | |
"asc", "assistant", "autoincrement", "avg", "between", "binary", "bit", |
| 189 | |
"boolean", "by", "byte", "char", "character", "column", "compactdatabase", |
| 190 | |
"constraint", "container", "count", "counter", "create", "createdatabase", |
| 191 | |
"createfield", "creategroup", "createindex", "createobject", "createproperty", |
| 192 | |
"createrelation", "createtabledef", "createuser", "createworkspace", |
| 193 | |
"currency", "currentuser", "database", "date", "datetime", "delete", |
| 194 | |
"desc", "description", "disallow", "distinct", "distinctrow", "document", |
| 195 | |
"double", "drop", "echo", "else", "end", "eqv", "error", "exists", "exit", |
| 196 | |
"false", "field", "fields", "fillcache", "float", "float4", "float8", |
| 197 | |
"foreign", "form", "forms", "from", "full", "function", "general", |
| 198 | |
"getobject", "getoption", "gotopage", "group", "group by", "guid", "having", |
| 199 | |
"idle", "ieeedouble", "ieeesingle", "if", "ignore", "imp", "in", "index", |
| 200 | |
"indexes", "inner", "insert", "inserttext", "int", "integer", "integer1", |
| 201 | |
"integer2", "integer4", "into", "is", "join", "key", "lastmodified", "left", |
| 202 | |
"level", "like", "logical", "logical1", "long", "longbinary", "longtext", |
| 203 | |
"macro", "match", "max", "min", "mod", "memo", "module", "money", "move", |
| 204 | |
"name", "newpassword", "no", "not", "null", "number", "numeric", "object", |
| 205 | |
"oleobject", "off", "on", "openrecordset", "option", "or", "order", "outer", |
| 206 | |
"owneraccess", "parameter", "parameters", "partial", "percent", "pivot", |
| 207 | |
"primary", "procedure", "property", "queries", "query", "quit", "real", |
| 208 | |
"recalc", "recordset", "references", "refresh", "refreshlink", |
| 209 | |
"registerdatabase", "relation", "repaint", "repairdatabase", "report", |
| 210 | |
"reports", "requery", "right", "screen", "section", "select", "set", |
| 211 | |
"setfocus", "setoption", "short", "single", "smallint", "some", "sql", |
| 212 | |
"stdev", "stdevp", "string", "sum", "table", "tabledef", "tabledefs", |
| 213 | |
"tableid", "text", "time", "timestamp", "top", "transform", "true", "type", |
| 214 | |
"union", "unique", "update", "user", "value", "values", "var", "varp", |
| 215 | |
"varbinary", "varchar", "where", "with", "workspace", "xor", "year", "yes", |
| 216 | |
"yesno" |
| 217 | |
)); |
| 218 | 1 | } |
| 219 | |
|
| 220 | |
|
| 221 | |
private ByteBuffer _buffer; |
| 222 | |
|
| 223 | |
private Integer _tableParentId; |
| 224 | |
|
| 225 | |
private final JetFormat _format; |
| 226 | |
|
| 227 | |
|
| 228 | |
|
| 229 | |
|
| 230 | 67 | private Map<String, TableInfo> _tableLookup = |
| 231 | |
new HashMap<String, TableInfo>(); |
| 232 | |
|
| 233 | |
private Set<String> _tableNames; |
| 234 | |
|
| 235 | |
private final PageChannel _pageChannel; |
| 236 | |
|
| 237 | |
private Table _systemCatalog; |
| 238 | |
|
| 239 | |
private Table _accessControlEntries; |
| 240 | |
|
| 241 | |
private Integer _relationshipsPageNumber; |
| 242 | |
|
| 243 | |
private Table _relationships; |
| 244 | |
|
| 245 | 67 | private final List<byte[]> _newTableSIDs = new ArrayList<byte[]>(); |
| 246 | |
|
| 247 | |
private boolean _useBigIndex; |
| 248 | |
|
| 249 | |
|
| 250 | |
|
| 251 | |
|
| 252 | |
|
| 253 | |
|
| 254 | |
|
| 255 | |
public static Database open(File mdbFile) throws IOException { |
| 256 | 0 | return open(mdbFile, false); |
| 257 | |
} |
| 258 | |
|
| 259 | |
|
| 260 | |
|
| 261 | |
|
| 262 | |
|
| 263 | |
|
| 264 | |
|
| 265 | |
|
| 266 | |
|
| 267 | |
public static Database open(File mdbFile, boolean readOnly) |
| 268 | |
throws IOException |
| 269 | |
{ |
| 270 | 0 | return open(mdbFile, readOnly, DEFAULT_AUTO_SYNC); |
| 271 | |
} |
| 272 | |
|
| 273 | |
|
| 274 | |
|
| 275 | |
|
| 276 | |
|
| 277 | |
|
| 278 | |
|
| 279 | |
|
| 280 | |
|
| 281 | |
|
| 282 | |
|
| 283 | |
|
| 284 | |
|
| 285 | |
|
| 286 | |
|
| 287 | |
|
| 288 | |
public static Database open(File mdbFile, boolean readOnly, boolean autoSync) |
| 289 | |
throws IOException |
| 290 | |
{ |
| 291 | 44 | if(!mdbFile.exists() || !mdbFile.canRead()) { |
| 292 | 1 | throw new FileNotFoundException("given file does not exist: " + mdbFile); |
| 293 | |
} |
| 294 | 43 | return new Database(openChannel(mdbFile, |
| 295 | |
(!mdbFile.canWrite() || readOnly)), |
| 296 | |
autoSync); |
| 297 | |
} |
| 298 | |
|
| 299 | |
|
| 300 | |
|
| 301 | |
|
| 302 | |
|
| 303 | |
|
| 304 | |
public static Database create(File mdbFile) throws IOException { |
| 305 | 0 | return create(mdbFile, DEFAULT_AUTO_SYNC); |
| 306 | |
} |
| 307 | |
|
| 308 | |
|
| 309 | |
|
| 310 | |
|
| 311 | |
|
| 312 | |
|
| 313 | |
|
| 314 | |
|
| 315 | |
|
| 316 | |
|
| 317 | |
|
| 318 | |
|
| 319 | |
|
| 320 | |
|
| 321 | |
public static Database create(File mdbFile, boolean autoSync) |
| 322 | |
throws IOException |
| 323 | |
{ |
| 324 | 24 | FileChannel channel = openChannel(mdbFile, false); |
| 325 | 24 | channel.truncate(0); |
| 326 | 24 | channel.transferFrom(Channels.newChannel( |
| 327 | |
Thread.currentThread().getContextClassLoader().getResourceAsStream( |
| 328 | |
EMPTY_MDB)), 0, Integer.MAX_VALUE); |
| 329 | 24 | return new Database(channel, autoSync); |
| 330 | |
} |
| 331 | |
|
| 332 | |
private static FileChannel openChannel(File mdbFile, boolean readOnly) |
| 333 | |
throws FileNotFoundException |
| 334 | |
{ |
| 335 | 67 | String mode = (readOnly ? "r" : "rw"); |
| 336 | 67 | return new RandomAccessFile(mdbFile, mode).getChannel(); |
| 337 | |
} |
| 338 | |
|
| 339 | |
|
| 340 | |
|
| 341 | |
|
| 342 | |
|
| 343 | |
|
| 344 | |
|
| 345 | |
protected Database(FileChannel channel, boolean autoSync) throws IOException |
| 346 | 67 | { |
| 347 | 67 | _format = JetFormat.getFormat(channel); |
| 348 | 67 | _pageChannel = new PageChannel(channel, _format, autoSync); |
| 349 | |
|
| 350 | |
|
| 351 | |
|
| 352 | 67 | _pageChannel.initialize(this); |
| 353 | 67 | _buffer = _pageChannel.createPageBuffer(); |
| 354 | 67 | readSystemCatalog(); |
| 355 | 67 | } |
| 356 | |
|
| 357 | |
public PageChannel getPageChannel() { |
| 358 | 228696 | return _pageChannel; |
| 359 | |
} |
| 360 | |
|
| 361 | |
public JetFormat getFormat() { |
| 362 | 311478 | return _format; |
| 363 | |
} |
| 364 | |
|
| 365 | |
|
| 366 | |
|
| 367 | |
|
| 368 | |
public Table getSystemCatalog() { |
| 369 | 0 | return _systemCatalog; |
| 370 | |
} |
| 371 | |
|
| 372 | |
|
| 373 | |
|
| 374 | |
|
| 375 | |
public Table getAccessControlEntries() { |
| 376 | 0 | return _accessControlEntries; |
| 377 | |
} |
| 378 | |
|
| 379 | |
|
| 380 | |
|
| 381 | |
|
| 382 | |
public boolean doUseBigIndex() { |
| 383 | 298 | return _useBigIndex; |
| 384 | |
} |
| 385 | |
|
| 386 | |
|
| 387 | |
|
| 388 | |
|
| 389 | |
public void setUseBigIndex(boolean useBigIndex) { |
| 390 | 0 | _useBigIndex = useBigIndex; |
| 391 | 0 | } |
| 392 | |
|
| 393 | |
|
| 394 | |
|
| 395 | |
|
| 396 | |
private void readSystemCatalog() throws IOException { |
| 397 | 67 | _systemCatalog = readTable(TABLE_SYSTEM_CATALOG, PAGE_SYSTEM_CATALOG, |
| 398 | |
defaultUseBigIndex()); |
| 399 | |
for(Map<String,Object> row : |
| 400 | 67 | Cursor.createCursor(_systemCatalog).iterable( |
| 401 | |
SYSTEM_CATALOG_COLUMNS)) |
| 402 | |
{ |
| 403 | 1326 | String name = (String) row.get(CAT_COL_NAME); |
| 404 | 1326 | if (name != null && TYPE_TABLE.equals(row.get(CAT_COL_TYPE))) { |
| 405 | 456 | if (!name.startsWith(PREFIX_SYSTEM)) { |
| 406 | 96 | addTable((String) row.get(CAT_COL_NAME), (Integer) row.get(CAT_COL_ID)); |
| 407 | 360 | } else if(TABLE_SYSTEM_ACES.equals(name)) { |
| 408 | 67 | int pageNumber = (Integer)row.get(CAT_COL_ID); |
| 409 | 67 | _accessControlEntries = readTable(TABLE_SYSTEM_ACES, pageNumber, |
| 410 | |
defaultUseBigIndex()); |
| 411 | 67 | } else if(TABLE_SYSTEM_RELATIONSHIPS.equals(name)) { |
| 412 | 67 | _relationshipsPageNumber = (Integer)row.get(CAT_COL_ID); |
| 413 | |
} |
| 414 | 870 | } else if (SYSTEM_OBJECT_NAME_TABLES.equals(name)) { |
| 415 | 67 | _tableParentId = (Integer) row.get(CAT_COL_ID); |
| 416 | |
} |
| 417 | 1326 | } |
| 418 | |
|
| 419 | |
|
| 420 | 67 | if(_accessControlEntries == null) { |
| 421 | 0 | throw new IOException("Did not find required " + TABLE_SYSTEM_ACES + |
| 422 | |
" table"); |
| 423 | |
} |
| 424 | 67 | if(_tableParentId == null) { |
| 425 | 0 | throw new IOException("Did not find required parent table id"); |
| 426 | |
} |
| 427 | |
|
| 428 | 67 | if (LOG.isDebugEnabled()) { |
| 429 | 0 | LOG.debug("Finished reading system catalog. Tables: " + |
| 430 | |
getTableNames()); |
| 431 | |
} |
| 432 | 67 | } |
| 433 | |
|
| 434 | |
|
| 435 | |
|
| 436 | |
|
| 437 | |
public Set<String> getTableNames() { |
| 438 | 3 | if(_tableNames == null) { |
| 439 | 3 | _tableNames = new HashSet<String>(); |
| 440 | 3 | for(TableInfo tableInfo : _tableLookup.values()) { |
| 441 | 29 | _tableNames.add(tableInfo.tableName); |
| 442 | |
} |
| 443 | |
} |
| 444 | 3 | return _tableNames; |
| 445 | |
} |
| 446 | |
|
| 447 | |
|
| 448 | |
|
| 449 | |
|
| 450 | |
|
| 451 | |
|
| 452 | |
|
| 453 | |
|
| 454 | |
public Iterator<Table> iterator() { |
| 455 | 1 | return new TableIterator(); |
| 456 | |
} |
| 457 | |
|
| 458 | |
|
| 459 | |
|
| 460 | |
|
| 461 | |
|
| 462 | |
public Table getTable(String name) throws IOException { |
| 463 | 163 | return getTable(name, defaultUseBigIndex()); |
| 464 | |
} |
| 465 | |
|
| 466 | |
|
| 467 | |
|
| 468 | |
|
| 469 | |
|
| 470 | |
|
| 471 | |
|
| 472 | |
|
| 473 | |
public Table getTable(String name, boolean useBigIndex) throws IOException { |
| 474 | |
|
| 475 | 163 | TableInfo tableInfo = lookupTable(name); |
| 476 | |
|
| 477 | 163 | if ((tableInfo == null) || (tableInfo.pageNumber == null)) { |
| 478 | 29 | return null; |
| 479 | |
} |
| 480 | |
|
| 481 | 134 | return readTable(tableInfo.tableName, tableInfo.pageNumber, useBigIndex); |
| 482 | |
} |
| 483 | |
|
| 484 | |
|
| 485 | |
|
| 486 | |
|
| 487 | |
|
| 488 | |
|
| 489 | |
public void createTable(String name, List<Column> columns) |
| 490 | |
throws IOException |
| 491 | |
{ |
| 492 | 28 | validateIdentifierName(name, _format.MAX_TABLE_NAME_LENGTH, "table"); |
| 493 | |
|
| 494 | 28 | if(getTable(name) != null) { |
| 495 | 1 | throw new IllegalArgumentException( |
| 496 | |
"Cannot create table with name of existing table"); |
| 497 | |
} |
| 498 | |
|
| 499 | 27 | if(columns.isEmpty()) { |
| 500 | 1 | throw new IllegalArgumentException( |
| 501 | |
"Cannot create table with no columns"); |
| 502 | |
} |
| 503 | 26 | if(columns.size() > _format.MAX_COLUMNS_PER_TABLE) { |
| 504 | 0 | throw new IllegalArgumentException( |
| 505 | |
"Cannot create table with more than " + |
| 506 | |
_format.MAX_COLUMNS_PER_TABLE + " columns"); |
| 507 | |
} |
| 508 | |
|
| 509 | 26 | Set<String> colNames = new HashSet<String>(); |
| 510 | |
|
| 511 | 26 | for(Column column : columns) { |
| 512 | 303 | column.validate(_format); |
| 513 | 301 | if(!colNames.add(column.getName().toUpperCase())) { |
| 514 | 1 | throw new IllegalArgumentException("duplicate column name: " + |
| 515 | |
column.getName()); |
| 516 | |
} |
| 517 | |
} |
| 518 | |
|
| 519 | 23 | if(Table.countAutoNumberColumns(columns) > 1) { |
| 520 | 0 | throw new IllegalArgumentException( |
| 521 | |
"Can have at most one AutoNumber column per table"); |
| 522 | |
} |
| 523 | |
|
| 524 | |
|
| 525 | 23 | int tdefPageNumber = Table.writeTableDefinition(columns, _pageChannel, |
| 526 | |
_format); |
| 527 | |
|
| 528 | |
|
| 529 | 23 | addTable(name, Integer.valueOf(tdefPageNumber)); |
| 530 | |
|
| 531 | |
|
| 532 | 23 | addToSystemCatalog(name, tdefPageNumber); |
| 533 | 23 | addToAccessControlEntries(tdefPageNumber); |
| 534 | 23 | } |
| 535 | |
|
| 536 | |
|
| 537 | |
|
| 538 | |
|
| 539 | |
public List<Relationship> getRelationships(Table table1, Table table2) |
| 540 | |
throws IOException |
| 541 | |
{ |
| 542 | |
|
| 543 | 8 | if(_relationships == null) { |
| 544 | 1 | if(_relationshipsPageNumber == null) { |
| 545 | 0 | throw new IOException("Could not find system relationships table"); |
| 546 | |
} |
| 547 | 1 | _relationships = readTable(TABLE_SYSTEM_RELATIONSHIPS, |
| 548 | |
_relationshipsPageNumber, |
| 549 | |
defaultUseBigIndex()); |
| 550 | |
} |
| 551 | |
|
| 552 | 8 | int nameCmp = table1.getName().compareTo(table2.getName()); |
| 553 | 8 | if(nameCmp == 0) { |
| 554 | 1 | throw new IllegalArgumentException("Must provide two different tables"); |
| 555 | |
} |
| 556 | 7 | if(nameCmp > 0) { |
| 557 | |
|
| 558 | |
|
| 559 | |
|
| 560 | 3 | Table tmp = table1; |
| 561 | 3 | table1 = table2; |
| 562 | 3 | table2 = tmp; |
| 563 | |
} |
| 564 | |
|
| 565 | |
|
| 566 | 7 | List<Relationship> relationships = new ArrayList<Relationship>(); |
| 567 | 7 | Cursor cursor = createCursorWithOptionalIndex( |
| 568 | |
_relationships, REL_COL_FROM_TABLE, table1.getName()); |
| 569 | 7 | collectRelationships(cursor, table1, table2, relationships); |
| 570 | 7 | cursor = createCursorWithOptionalIndex( |
| 571 | |
_relationships, REL_COL_TO_TABLE, table1.getName()); |
| 572 | 7 | collectRelationships(cursor, table2, table1, relationships); |
| 573 | |
|
| 574 | 7 | return relationships; |
| 575 | |
} |
| 576 | |
|
| 577 | |
|
| 578 | |
|
| 579 | |
|