/** * * Return a tinySQLTable object, given a table name. * * @param tableName * @see tinySQL#getTable * */ internal override TinySQLTable getTable(String tableName) //throws tinySQLException { int i, tableIndex; TinySQLTable nextTable; tableIndex = java.lang.Integer.MIN_VALUE; if (TinySQLGlobals.DEBUG) { java.lang.SystemJ.outJ.println("Trying to create table" + " object for " + tableName); } for (i = 0; i < tableList.size(); i++) { nextTable = (TinySQLTable)tableList.elementAt(i); if (nextTable.table.equals(tableName)) { if (nextTable.isOpen()) { if (TinySQLGlobals.DEBUG) { java.lang.SystemJ.outJ.println("Found in cache " + nextTable.toString()); } return(nextTable); } tableIndex = i; break; } } if (tableIndex == java.lang.Integer.MIN_VALUE) { tableList.addElement(new DBFFileTable(dataDir, tableName)); nextTable = (TinySQLTable)tableList.lastElement(); if (TinySQLGlobals.DEBUG) { java.lang.SystemJ.outJ.println("Add to cache " + nextTable.toString()); } return((TinySQLTable)tableList.lastElement()); } else { tableList.setElementAt(new DBFFileTable(dataDir, tableName), tableIndex); nextTable = (TinySQLTable)tableList.elementAt(tableIndex); if (TinySQLGlobals.DEBUG) { java.lang.SystemJ.outJ.println("Update in cache " + nextTable.toString()); } return((TinySQLTable)tableList.elementAt(tableIndex)); } }