use of org.h2.engine.Session in project ignite by apache.
the class GridH2Table method commitUserIndex.
/**
* Promote temporary index to make it usable in queries.
*
* @param ses H2 session.
* @param idxName Index name.
* @return Temporary index with given name.
*/
private Index commitUserIndex(Session ses, String idxName) {
lock(true);
try {
ensureNotDestroyed();
Index idx = tmpIdxs.remove(idxName);
assert idx != null;
Index cloneIdx = createDuplicateIndexIfNeeded(idx);
ArrayList<Index> newIdxs = new ArrayList<>(idxs.size() + ((cloneIdx == null) ? 1 : 2));
newIdxs.addAll(idxs);
newIdxs.add(idx);
if (cloneIdx != null)
newIdxs.add(cloneIdx);
idxs = newIdxs;
database.addSchemaObject(ses, idx);
if (cloneIdx != null)
database.addSchemaObject(ses, cloneIdx);
setModified();
return idx;
} finally {
unlock(true);
}
}
use of org.h2.engine.Session in project ignite by apache.
the class H2TreeIndex method findFirstOrLast.
/**
* {@inheritDoc}
*/
@Override
public Cursor findFirstOrLast(Session session, boolean b) {
try {
int seg = threadLocalSegment();
H2Tree tree = treeForRead(seg);
GridH2Row row = b ? tree.findFirst() : tree.findLast();
return new SingleRowCursor(row);
} catch (IgniteCheckedException e) {
throw DbException.convert(e);
}
}
use of org.h2.engine.Session in project ignite by apache.
the class H2Utils method setupConnection.
/**
* @param conn Connection to use.
* @param distributedJoins If distributed joins are enabled.
* @param enforceJoinOrder Enforce join order of tables.
*/
public static void setupConnection(Connection conn, boolean distributedJoins, boolean enforceJoinOrder) {
Session s = session(conn);
s.setForceJoinOrder(enforceJoinOrder);
s.setJoinBatchEnabled(distributedJoins);
}
use of org.h2.engine.Session in project ignite by apache.
the class GridMergeIndex method getRowCount.
/**
* {@inheritDoc}
*/
@Override
public long getRowCount(Session ses) {
Cursor c = find(ses, null, null);
long cnt = 0;
while (c.next()) cnt++;
return cnt;
}
use of org.h2.engine.Session in project ignite by apache.
the class GridH2TreeIndex method findFirstOrLast.
/** {@inheritDoc} */
@Override
public Cursor findFirstOrLast(Session ses, boolean first) {
try {
int seg = threadLocalSegment();
IgniteTree t = treeForRead(seg);
GridH2Row row = (GridH2Row) (first ? t.findFirst() : t.findLast());
return new SingleRowCursor(row);
} catch (IgniteCheckedException e) {
throw DbException.convert(e);
}
}
Aggregations