/** * Creates a temporary bag table for the given QueryClassBag. * * @param c a Connection * @param qcb a QueryClassBag * @param log true to log this action * @param text extra data to place in the log * @return a BagTableToRemove object * @throws SQLException if an error occurs */ protected BagTableToRemove createTempBagTable(Connection c, QueryClassBag qcb, boolean log, String text) throws SQLException { String tableName = "Integer_bag_" + getUniqueInteger(c); if (log) { LOG.info("Creating temporary table " + tableName + " of size " + qcb.getIds().size() + " for " + text); } DatabaseUtil.createBagTable(db, c, tableName, qcb.getIds(), Integer.class); bagConstraintTables.put(qcb, tableName); BagTableToRemove bagTableToRemove = new BagTableToRemove(tableName, bagTablesToRemove); bagTablesInDatabase.add(bagTableToRemove); return bagTableToRemove; }
/** * Creates a temporary bag table for the given QueryClassBag. * * @param c a Connection * @param qcb a QueryClassBag * @param log true to log this action * @param text extra data to place in the log * @return a BagTableToRemove object * @throws SQLException if an error occurs */ protected BagTableToRemove createTempBagTable(Connection c, QueryClassBag qcb, boolean log, String text) throws SQLException { String tableName = "Integer_bag_" + getUniqueInteger(c); if (log) { LOG.info("Creating temporary table " + tableName + " of size " + qcb.getIds().size() + " for " + text); } DatabaseUtil.createBagTable(db, c, tableName, qcb.getIds(), Integer.class); bagConstraintTables.put(qcb, tableName); BagTableToRemove bagTableToRemove = new BagTableToRemove(tableName, bagTablesToRemove); bagTablesInDatabase.add(bagTableToRemove); return bagTableToRemove; }
@Test public void testGetUniqueInteger() throws Exception { ObjectStoreInterMineImpl osii = (ObjectStoreInterMineImpl) os; Connection con = osii.getConnection(); con.setAutoCommit(false); int integer1 = osii.getUniqueInteger(con); int integer2 = osii.getUniqueInteger(con); Assert.assertTrue(integer2 > integer1); con.setAutoCommit(true); int integer3 = osii.getUniqueInteger(con); int integer4 = osii.getUniqueInteger(con); Assert.assertTrue(integer3 > integer2); Assert.assertTrue(integer4 > integer3); }
TypeUtil.unqualifiedName(type.getName()) + "_bag_" + getUniqueInteger(c); if (log) { LOG.info("Creating temporary table " + tableName + " of size "
TypeUtil.unqualifiedName(type.getName()) + "_bag_" + getUniqueInteger(c); if (log) { LOG.info("Creating temporary table " + tableName + " of size "
String sql = null; try { int tableNumber = getUniqueInteger(c); if (getMinBagTableSize() != -1) { createTempBagTables(c, q);
String sql = null; try { int tableNumber = getUniqueInteger(c); if (getMinBagTableSize() != -1) { createTempBagTables(c, q);
if (pt == null) { pt = new PrecomputedTable(new org.intermine.sql.query.Query(sql), sql, "temporary_precomp_" + getUniqueInteger(c), "goFaster", c); ptm.addTableToDatabase(pt, new HashSet<String>(), false); tablesToDrop.add(pt.getName()); subPt = new PrecomputedTable( new org.intermine.sql.query.Query(sql), sql, "temporary_precomp_" + getUniqueInteger(c), "goFaster", c); ptm.addTableToDatabase(subPt, new HashSet<String>(), false); subPt = new PrecomputedTable( new org.intermine.sql.query.Query(sql), sql, "temporary_precomp_" + getUniqueInteger(c), "goFaster", c); ptm.addTableToDatabase(subPt, new HashSet<String>(), false);
if (pt == null) { pt = new PrecomputedTable(new org.intermine.sql.query.Query(sql), sql, "temporary_precomp_" + getUniqueInteger(c), "goFaster", c); ptm.addTableToDatabase(pt, new HashSet<String>(), false); tablesToDrop.add(pt.getName()); subPt = new PrecomputedTable( new org.intermine.sql.query.Query(sql), sql, "temporary_precomp_" + getUniqueInteger(c), "goFaster", c); ptm.addTableToDatabase(subPt, new HashSet<String>(), false); subPt = new PrecomputedTable( new org.intermine.sql.query.Query(sql), sql, "temporary_precomp_" + getUniqueInteger(c), "goFaster", c); ptm.addTableToDatabase(subPt, new HashSet<String>(), false);