public class H2Utils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
H2Utils.Getter<T,R>
Field getter.
|
static class |
H2Utils.Setter<T,R>
Field getter.
|
static class |
H2Utils.ValueRuntimeSimpleObject<T> |
| Modifier and Type | Field and Description |
|---|---|
static org.h2.table.IndexColumn[] |
EMPTY_COLUMNS |
static String |
QCTX_VARIABLE_NAME
Query context H2 variable name.
|
static List<GridQueryFieldMetadata> |
UPDATE_RESULT_META
Dummy metadata for update result.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
bindParameters(PreparedStatement stmt,
@Nullable Collection<Object> params)
Binds parameters to prepared statement.
|
static <Z> void |
bubbleUp(Z[] arr,
int off,
Comparator<Z> cmp) |
static boolean |
checkAndStartNotStartedCache(GridKernalContext ctx,
GridCacheContextInfo<?,?> cacheInfo)
Check that given cache is not started and start it for such case.
|
static void |
checkQuery(IgniteH2Indexing idx,
List<Integer> cacheIds,
Collection<QueryTable> tbls)
Check if query is valid.
|
static boolean |
checkSpatialIndexEnabled()
Check if spatial indexes are enabled.
|
static List<Integer> |
collectCacheIds(IgniteH2Indexing idx,
@Nullable Integer mainCacheId,
Collection<QueryTable> tbls)
Collect cache identifiers from two-step query.
|
static QueryContext |
context(H2PooledConnection conn) |
static QueryContext |
context(org.h2.engine.Session ses) |
static Object |
convert(Object val,
CacheObjectValueContext coCtx,
int type)
Convert value to column's expected type by means of H2.
|
static GridH2IndexBase |
createSpatialIndex(GridH2Table tbl,
IndexDescriptor idxDesc,
List<org.h2.table.IndexColumn> cols)
Create spatial index.
|
static boolean |
equals(org.h2.table.IndexColumn c1,
org.h2.table.IndexColumn c2) |
static String |
generateFieldsQueryString(String qry,
String tableAlias,
H2TableDescriptor tbl)
Generate SqlFieldsQuery string from SqlQuery.
|
static <T,R> H2Utils.Getter<T,R> |
getter(Class<? extends T> cls,
String fldName) |
static String |
indexColumnsSql(org.h2.table.IndexColumn[] idxCols)
Generate String represenation of given indexed columns.
|
static String |
indexCreateSql(String fullTblName,
org.h2.index.Index h2Idx,
boolean ifNotExists)
Generate
CREATE INDEX SQL statement for given params. |
static String |
indexDropSql(String schemaName,
String idxName,
boolean ifExists)
Generate
CREATE INDEX SQL statement for given params. |
static List<GridQueryFieldMetadata> |
meta(ResultSetMetaData rsMeta) |
static List<JdbcParameterMeta> |
parametersMeta(ParameterMetaData h2ParamsMeta)
Converts h2 parameters metadata to Ignite one.
|
static String |
queryEngine() |
static void |
resetSession(H2PooledConnection conn)
Clean up session for further reuse.
|
static GridH2RetryException |
retryException(String msg)
Create retry exception for distributed join.
|
static org.h2.engine.Session |
session(Connection c) |
static org.h2.engine.Session |
session(H2PooledConnection c) |
static <T,R> H2Utils.Setter<T,R> |
setter(Class<? extends T> cls,
String fldName) |
static void |
setupConnection(H2PooledConnection conn,
QueryContext qctx,
boolean distributedJoins,
boolean enforceJoinOrder) |
static void |
setupConnection(H2PooledConnection conn,
QueryContext qctx,
boolean distributedJoins,
boolean enforceJoinOrder,
boolean lazy) |
static String |
tableCreateSql(H2TableDescriptor tbl)
Prepare SQL statement for CREATE TABLE command.
|
static GridH2RowMessage |
toRowMessage(org.h2.result.Row row) |
static String |
withQuotes(String str)
Add quotes around the name.
|
static org.h2.value.Value |
wrap(CacheObjectValueContext coCtx,
Object obj,
int type)
Wraps object to respective
Value. |
static QueryCursorImpl<List<?>> |
zeroCursor() |
public static final String QCTX_VARIABLE_NAME
public static final org.h2.table.IndexColumn[] EMPTY_COLUMNS
public static final List<GridQueryFieldMetadata> UPDATE_RESULT_META
public static boolean equals(org.h2.table.IndexColumn c1,
org.h2.table.IndexColumn c2)
c1 - First column.c2 - Second column.true If they are the same.public static String tableCreateSql(H2TableDescriptor tbl)
tbl - Table descriptor.public static String indexCreateSql(String fullTblName, org.h2.index.Index h2Idx, boolean ifNotExists)
CREATE INDEX SQL statement for given params.fullTblName - Fully qualified table name.h2Idx - H2 index.ifNotExists - Quietly skip index creation if it exists.public static String indexColumnsSql(org.h2.table.IndexColumn[] idxCols)
idxCols - Indexed columns.public static String indexDropSql(String schemaName, String idxName, boolean ifExists)
CREATE INDEX SQL statement for given params.schemaName - Quoted schema name.idxName - Index name.ifExists - Quietly skip index drop if it exists.public static GridH2IndexBase createSpatialIndex(GridH2Table tbl, IndexDescriptor idxDesc, List<org.h2.table.IndexColumn> cols)
tbl - Table.idxDesc - Index descriptor.cols - Columns.public static boolean checkSpatialIndexEnabled()
public static String withQuotes(String str)
str - String.public static List<GridQueryFieldMetadata> meta(ResultSetMetaData rsMeta) throws SQLException
rsMeta - Metadata.SQLException - If failed.public static List<JdbcParameterMeta> parametersMeta(ParameterMetaData h2ParamsMeta) throws IgniteCheckedException
h2ParamsMeta - parameters metadata returned by h2.IgniteCheckedExceptionpublic static org.h2.engine.Session session(H2PooledConnection c)
c - Connection.public static org.h2.engine.Session session(Connection c)
c - Connection.public static void setupConnection(H2PooledConnection conn, QueryContext qctx, boolean distributedJoins, boolean enforceJoinOrder)
conn - Connection to use.qctx - Query context.distributedJoins - If distributed joins are enabled.enforceJoinOrder - Enforce join order of tables.public static void setupConnection(H2PooledConnection conn, QueryContext qctx, boolean distributedJoins, boolean enforceJoinOrder, boolean lazy)
conn - Connection to use.qctx - Query context.distributedJoins - If distributed joins are enabled.enforceJoinOrder - Enforce join order of tables.lazy - Lazy query execution mode.public static void resetSession(H2PooledConnection conn)
conn - Connection to use.public static QueryContext context(H2PooledConnection conn)
conn - Connection to use.public static QueryContext context(org.h2.engine.Session ses)
ses - Session.public static Object convert(Object val, CacheObjectValueContext coCtx, int type) throws IgniteCheckedException
val - Source value.coCtx - Cache object context.type - Expected column type to convert to.IgniteCheckedException - if failed.public static QueryCursorImpl<List<?>> zeroCursor()
public static boolean checkAndStartNotStartedCache(GridKernalContext ctx, GridCacheContextInfo<?,?> cacheInfo)
cacheInfo - Cache context info.true in case not started and has been started.public static org.h2.value.Value wrap(CacheObjectValueContext coCtx, Object obj, int type) throws IgniteCheckedException
Value.obj - Object.type - Value type.IgniteCheckedException - If failed.public static String generateFieldsQueryString(String qry, String tableAlias, H2TableDescriptor tbl) throws IgniteCheckedException
qry - Query string.tableAlias - table alias.tbl - Table to use.IgniteCheckedException - In case of error.public static GridH2RowMessage toRowMessage(org.h2.result.Row row)
row - Row.public static GridH2RetryException retryException(String msg)
msg - Message.public static void bindParameters(PreparedStatement stmt, @Nullable @Nullable Collection<Object> params) throws IgniteCheckedException
stmt - Prepared statement.params - Parameters collection.IgniteCheckedException - If failed.public static <Z> void bubbleUp(Z[] arr,
int off,
Comparator<Z> cmp)
arr - Array.off - Offset.cmp - Comparator.public static List<Integer> collectCacheIds(IgniteH2Indexing idx, @Nullable @Nullable Integer mainCacheId, Collection<QueryTable> tbls)
mainCacheId - Id of main cache.public static void checkQuery(IgniteH2Indexing idx, List<Integer> cacheIds, Collection<QueryTable> tbls)
idx - Indexing.cacheIds - Cache IDs.tbls - Tables.public static String queryEngine()
public static <T,R> H2Utils.Getter<T,R> getter(Class<? extends T> cls, String fldName)
cls - Class.fldName - Fld name.public static <T,R> H2Utils.Setter<T,R> setter(Class<? extends T> cls, String fldName)
cls - Class.fldName - Fld name.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023