use of org.h2.result.RowImpl in project h2database by h2database.
the class MemoryFootprint method main.
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String... a) {
// System.getProperties().store(System.out, "");
print("Object", new Object());
print("Timestamp", new java.sql.Timestamp(0));
print("Date", new java.sql.Date(0));
print("Time", new java.sql.Time(0));
print("BigDecimal", new BigDecimal("0"));
print("BigInteger", new BigInteger("0"));
print("String", new String("Hello"));
print("Data", Data.create(null, 10));
print("Row", new RowImpl(new Value[0], 0));
System.out.println();
for (int i = 1; i < 128; i += i) {
System.out.println(getArraySize(1, i) + " bytes per p1[]");
print("boolean[" + i + "]", new boolean[i]);
System.out.println(getArraySize(2, i) + " bytes per p2[]");
print("char[" + i + "]", new char[i]);
print("short[" + i + "]", new short[i]);
System.out.println(getArraySize(4, i) + " bytes per p4[]");
print("int[" + i + "]", new int[i]);
print("float[" + i + "]", new float[i]);
System.out.println(getArraySize(8, i) + " bytes per p8[]");
print("long[" + i + "]", new long[i]);
print("double[" + i + "]", new double[i]);
System.out.println(getArraySize(Constants.MEMORY_POINTER, i) + " bytes per obj[]");
print("Object[" + i + "]", new Object[i]);
System.out.println();
}
}
use of org.h2.result.RowImpl in project h2database by h2database.
the class MergeUsing method update.
@Override
public int update() {
// clear list of source table keys & rowids we have processed already
targetRowidsRemembered.clear();
if (targetTableFilter != null) {
targetTableFilter.startQuery(session);
targetTableFilter.reset();
}
if (sourceTableFilter != null) {
sourceTableFilter.startQuery(session);
sourceTableFilter.reset();
}
sourceQueryRowNumber = 0;
checkRights();
setCurrentRowNumber(0);
// process source select query data for row creation
ResultInterface rows = query.query(0);
targetTable.fire(session, evaluateTriggerMasks(), true);
targetTable.lock(session, true, false);
while (rows.next()) {
sourceQueryRowNumber++;
Value[] sourceRowValues = rows.currentRow();
Row sourceRow = new RowImpl(sourceRowValues, 0);
setCurrentRowNumber(sourceQueryRowNumber);
merge(sourceRow);
}
rows.close();
targetTable.fire(session, evaluateTriggerMasks(), false);
return countUpdatedRows;
}
use of org.h2.result.RowImpl in project h2database by h2database.
the class TestPageStore method testInsertDelete.
private void testInsertDelete() {
Row[] x = new Row[0];
Row r = new RowImpl(null, 0);
x = Page.insert(x, 0, 0, r);
assertTrue(x[0] == r);
Row r2 = new RowImpl(null, 0);
x = Page.insert(x, 1, 0, r2);
assertTrue(x[0] == r2);
assertTrue(x[1] == r);
Row r3 = new RowImpl(null, 0);
x = Page.insert(x, 2, 1, r3);
assertTrue(x[0] == r2);
assertTrue(x[1] == r3);
assertTrue(x[2] == r);
x = Page.remove(x, 3, 1);
assertTrue(x[0] == r2);
assertTrue(x[1] == r);
x = Page.remove(x, 2, 0);
assertTrue(x[0] == r);
x = Page.remove(x, 1, 0);
}
Aggregations