use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer in project jaxdb by jaxdb.
the class SqlJaxSBLoader method sqlx2sql.
static void sqlx2sql(final DBVendor vendor, final $Database database, final File sqlOutputFile) throws IOException {
sqlOutputFile.getParentFile().mkdirs();
final ArrayList<Row> rows = new ArrayList<>();
final RowIterator iterator = new RowIterator(database);
final Compiler compiler = Compiler.getCompiler(vendor);
final TableToColumnToIncrement tableToColumnToIncrement = new TableToColumnToIncrement();
while (iterator.hasNext()) {
loadRow(rows, iterator.next(), vendor.getDialect(), compiler, tableToColumnToIncrement);
}
rows.sort(null);
final Iterator<Row> rowIterator = rows.iterator();
try (final OutputStreamWriter out = new FileWriter(sqlOutputFile)) {
for (int i = 0; rowIterator.hasNext(); ++i) {
if (i > 0)
out.write('\n');
out.append(rowIterator.next().toString()).append(';');
}
if (tableToColumnToIncrement.size() > 0)
for (final Map.Entry<String, Map<String, Integer>> entry : tableToColumnToIncrement.entrySet()) for (final Map.Entry<String, Integer> columnToIncrement : entry.getValue().entrySet()) compiler.sequenceReset(null, out, entry.getKey(), columnToIncrement.getKey(), columnToIncrement.getValue() + 1);
} catch (final SQLException e) {
throw new RuntimeException(e);
}
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer in project packages-jpl by SWI-Prolog.
the class TestJUnit method testBigInteger2.
public void testBigInteger2() {
BigInteger b = new BigInteger("12345678901234567890123456789");
// too big for a long
Term i = new Integer(b);
Term g = new Compound("is", new Term[] { new Variable("X"), i });
Term x = Query.oneSolution(g).get("X");
assertTrue("X is an org.jpl7.Integer", x.isInteger());
assertTrue("X is a big org.jpl7.Integer", x.isBigInteger());
assertTrue("X's value is as expected", x.bigValue().equals(b));
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer in project packages-jpl by SWI-Prolog.
the class TestJUnit method testJRef2.
public void testJRef2() {
int i = 76543;
Integer I = new Integer(i);
Query q = new Query("jpl_call(?,intValue,[],I2)", JPL.newJRef(I));
Term I2 = q.oneSolution().get("I2");
assertTrue(I2.isInteger() && I2.intValue() == i);
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer in project packages-jpl by SWI-Prolog.
the class TestJUnit method testWouter1.
public void testWouter1() {
// Wouter says this fails under OS X Mavericks
// 10.9 x86-64
// too big for an int
long n = 7381783232223l;
Compound term = new Compound("is", new Term[] { new Variable("X"), new org.jpl7.Integer(n) });
Map<String, Term>[] solutions = new Query(term).allSolutions();
assertEquals(1, solutions.length);
Map<String, Term> solution = solutions[0];
assertTrue(solution.containsKey("X"));
Object result = solution.get("X");
assertTrue(result instanceof org.jpl7.Integer);
assertEquals(n, ((org.jpl7.Integer) result).longValue());
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Integer in project packages-jpl by SWI-Prolog.
the class TestJUnit method testLength1.
public void testLength1() {
Query q5 = new Query(new Compound("length", new Term[] { new Variable("Zs"), new org.jpl7.Integer(2) }));
Term zs = q5.oneSolution().get("Zs");
assertTrue("length(Zs,2) binds Zs to a list of two distinct variables " + zs.toString(), zs.isListPair() && zs.arg(1).isVariable() && zs.arg(2).isListPair() && zs.arg(2).arg(1).isVariable() && zs.arg(2).arg(2).isListNil() && !zs.arg(1).name().equals(zs.arg(2).arg(1).name()));
}
Aggregations