static void testScripts(String directory) { TestUtil.deleteDatabase("test1"); try { Class.forName("org.hsqldb.jdbc.JDBCDriver"); String url = "jdbc:hsqldb:test1;sql.enforce_strict_size=true"; String user = "******"; String password = ""; Connection cConnection = null; String[] filelist; String absolute = new File(directory).getAbsolutePath(); filelist = new File(absolute).list(); ArraySort.sort((Object[]) filelist, 0, filelist.length, new StringComparator()); for (int i = 0; i < filelist.length; i++) { String fname = filelist[i]; if (fname.startsWith("TestSelf") && fname.endsWith(".txt")) { print("Openning DB"); cConnection = DriverManager.getConnection(url, user, password); testScript(cConnection, absolute + File.separator + fname); cConnection.close(); } } } catch (Exception e) { e.printStackTrace(); print("TestUtil init error: " + e.getMessage()); } }
SubQuery[] getSubqueries(Session session) { OrderedHashSet subQueries = null; for (int i = 0; i < targetRangeVariables.length; i++) { if (targetRangeVariables[i] == null) { continue; } OrderedHashSet set = targetRangeVariables[i].getSubqueries(); subQueries = OrderedHashSet.addAll(subQueries, set); } for (int i = 0; i < updateExpressions.length; i++) { subQueries = updateExpressions[i].collectAllSubqueries(subQueries); } if (insertExpression != null) { subQueries = insertExpression.collectAllSubqueries(subQueries); } if (condition != null) { subQueries = condition.collectAllSubqueries(subQueries); } if (queryExpression != null) { OrderedHashSet set = queryExpression.getSubqueries(); subQueries = OrderedHashSet.addAll(subQueries, set); } if (subQueries == null || subQueries.size() == 0) { return SubQuery.emptySubqueryArray; } SubQuery[] subQueryArray = new SubQuery[subQueries.size()]; subQueries.toArray(subQueryArray); ArraySort.sort(subQueryArray, 0, subQueryArray.length, subQueryArray[0]); for (int i = 0; i < subQueryArray.length; i++) { subQueryArray[i].prepareTable(session); } return subQueryArray; }