Search in sources :

Example 66 with Mode

use of org.h2.engine.Mode in project ignite by apache.

the class H2Utils method setupConnection.

/**
 * @param conn Connection to use.
 * @param qctx Query context.
 * @param distributedJoins If distributed joins are enabled.
 * @param enforceJoinOrder Enforce join order of tables.
 * @param lazy Lazy query execution mode.
 */
public static void setupConnection(H2PooledConnection conn, QueryContext qctx, boolean distributedJoins, boolean enforceJoinOrder, boolean lazy) {
    Session s = session(conn);
    s.setForceJoinOrder(enforceJoinOrder);
    s.setJoinBatchEnabled(distributedJoins);
    s.setLazyQueryExecution(lazy);
    QueryContext oldCtx = (QueryContext) s.getVariable(QCTX_VARIABLE_NAME).getObject();
    assert oldCtx == null || oldCtx == qctx : oldCtx;
    s.setVariable(QCTX_VARIABLE_NAME, new ValueRuntimeSimpleObject<>(qctx));
    // Hack with thread local context is used only for H2 methods that is called without Session object.
    // e.g. GridH2Table.getRowCountApproximation (used only on optimization phase, after parse).
    QueryContext.threadLocal(qctx);
}
Also used : QueryContext(org.apache.ignite.internal.processors.query.h2.opt.QueryContext) Session(org.h2.engine.Session)

Aggregations

Connection (java.sql.Connection)12 Mode (org.h2.engine.Mode)12 ValueString (org.h2.value.ValueString)11 PreparedStatement (java.sql.PreparedStatement)9 Column (org.h2.table.Column)9 IOException (java.io.IOException)8 Statement (java.sql.Statement)8 ArrayList (java.util.ArrayList)8 DbException (org.h2.message.DbException)8 CompareMode (org.h2.value.CompareMode)8 Value (org.h2.value.Value)8 ResultSet (java.sql.ResultSet)7 IgniteSQLException (org.apache.ignite.internal.processors.query.IgniteSQLException)7 SQLException (java.sql.SQLException)6 GridH2Table (org.apache.ignite.internal.processors.query.h2.opt.GridH2Table)6 ValueExpression (org.h2.expression.ValueExpression)5 JdbcDataSource (org.h2.jdbcx.JdbcDataSource)5 GridH2RowDescriptor (org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor)4 GridSqlColumn (org.apache.ignite.internal.processors.query.h2.sql.GridSqlColumn)4 GridSqlElement (org.apache.ignite.internal.processors.query.h2.sql.GridSqlElement)4