org.apache.ignite.cache.store.jdbc.dialect

## Class BasicJdbcDialect

- java.lang.Object
- - org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect

All Implemented Interfaces:
  Serializable, JdbcDialect

Direct Known Subclasses:
  DB2Dialect, H2Dialect, MySQLDialect, OracleDialect, SQLServerDialect

    public class BasicJdbcDialect
    extends Object
    implements JdbcDialect

Basic implementation of dialect based on JDBC specification.

See Also:
  Serialized Form

### Field Summary

Fields
`protected static int` `DFLT_MAX_PARAMS_CNT` Default max query parameters count.
`protected int` `maxParamsCnt` Max query parameters count.

### Constructor Summary

Constructors
Constructor and Description
`BasicJdbcDialect()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`String` `escape(String ident)`
`int` `getFetchSize()` Gives the JDBC driver a hint how many rows should be fetched from the database when more rows are needed.
`int` `getMaxParameterCount()` Get max query parameters count.
`boolean` `hasMerge()`
`String` `insertQuery(String fullTblName, Collection<String> keyCols, Collection<String> valCols)` Construct insert query.
`String` `loadCacheQuery(String fullTblName, Iterable<String> uniqCols)` Construct load cache query.
`String` `loadCacheRangeQuery(String fullTblName, Collection<String> keyCols, Iterable<String> uniqCols, boolean appendLowerBound, boolean appendUpperBound)` Construct load cache query over specified range.
`String` `loadCacheSelectRangeQuery(String fullTblName, Collection<String> keyCols)` Construct query to get ranges bounds.
`String` `loadQuery(String fullTblName, Collection<String> keyCols, Iterable<String> cols, int keyCnt)` Construct load query.
`String` `mergeQuery(String fullTblName, Collection<String> keyCols, Collection<String> uniqCols)` Construct merge query.
`protected static String` `mkString(Iterable<String> strs, String sep)` Concatenates strings using provided separator.
`protected static String` `mkString(Iterable<String> strs, String start, String sep, String end)` Concatenates elements using provided separator.
`protected static <T> String` `mkString(Iterable<T> elems, C1<T,String> f, String start, String sep, String end)` Concatenates elements using provided separator.
`String` `removeQuery(String fullTblName, Iterable<String> keyCols)` Construct remove query.
`protected static String` `repeat(String str, int cnt, String start, String sep, String end)` Concatenates elements using provided delimiter.
`void` `setMaxParameterCount(int maxParamsCnt)` Set max query parameters count.
`String` `updateQuery(String fullTblName, Collection<String> keyCols, Iterable<String> valCols)` Construct update query.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DFLT_MAX_PARAMS_CNT

    protected static final int DFLT_MAX_PARAMS_CNT

Default max query parameters count.

See Also:
  Constant Field Values

#### maxParamsCnt

    protected int maxParamsCnt

Max query parameters count.

### Constructor Detail

#### BasicJdbcDialect

    public BasicJdbcDialect()

### Method Detail

#### mkString

    protected static <T> String mkString(Iterable<T> elems,
                                         C1<T,String> f,
                                         String start,
                                         String sep,
                                         String end)

Concatenates elements using provided separator.

Parameters:
  `elems` - Concatenated elements.
  `f` - closure used for transform element.
  `start` - Start string.
  `sep` - Separator.
  `end` - End string.
Returns:
  Concatenated string.

#### mkString

    protected static String mkString(Iterable<String> strs,
                                     String start,
                                     String sep,
                                     String end)

Concatenates elements using provided separator.

Parameters:
  `strs` - Concatenated string.
  `start` - Start string.
  `sep` - Delimiter.
  `end` - End string.
Returns:
  Concatenated string.

#### mkString

    protected static String mkString(Iterable<String> strs,
                                     String sep)

Concatenates strings using provided separator.

Parameters:
  `strs` - Concatenated string.
  `sep` - Separator.
Returns:
  Concatenated string.

#### repeat

    protected static String repeat(String str,
                                   int cnt,
                                   String start,
                                   String sep,
                                   String end)

Concatenates elements using provided delimiter.

Parameters:
  `str` - Repeated string.
  `cnt` - Repeat count.
  `start` - Start string.
  `sep` - Separator.
  `end` - End string.

#### escape

    public String escape(String ident)

Specified by:
  `escape` in interface `JdbcDialect`
Parameters:
  `ident` - SQL identifier to escape.
Returns:
  Escaped SQL identifier.

#### loadCacheSelectRangeQuery

    public String loadCacheSelectRangeQuery(String fullTblName,
                                            Collection<String> keyCols)

Construct query to get ranges bounds.

Specified by:
  `loadCacheSelectRangeQuery` in interface `JdbcDialect`
Parameters:
  `fullTblName` - Full table name.
  `keyCols` - Database key columns for order.
Returns:
  Query for select count.

#### loadCacheRangeQuery

    public String loadCacheRangeQuery(String fullTblName,
                                      Collection<String> keyCols,
                                      Iterable<String> uniqCols,
                                      boolean appendLowerBound,
                                      boolean appendUpperBound)

Construct load cache query over specified range.

Specified by:
  `loadCacheRangeQuery` in interface `JdbcDialect`
Parameters:
  `fullTblName` - Full table name.
  `keyCols` - Database key columns for order.
  `uniqCols` - Database unique value columns.
  `appendLowerBound` - Need add lower bound for range.
  `appendUpperBound` - Need add upper bound for range.
Returns:
  Query for select count.

#### loadCacheQuery

    public String loadCacheQuery(String fullTblName,
                                 Iterable<String> uniqCols)

Construct load cache query.

Specified by:
  `loadCacheQuery` in interface `JdbcDialect`
Parameters:
  `fullTblName` - Full table name.
  `uniqCols` - Database unique value columns.
Returns:
  Load cache query.

#### loadQuery

    public String loadQuery(String fullTblName,
                            Collection<String> keyCols,
                            Iterable<String> cols,
                            int keyCnt)

Construct load query.

Specified by:
  `loadQuery` in interface `JdbcDialect`
Parameters:
  `fullTblName` - Full table name.
  `keyCols` - Database key columns.
  `cols` - Selected columns.
  `keyCnt` - Key count.
Returns:
  Load query.

#### insertQuery

    public String insertQuery(String fullTblName,
                              Collection<String> keyCols,
                              Collection<String> valCols)

Construct insert query.

Specified by:
  `insertQuery` in interface `JdbcDialect`
Parameters:
  `fullTblName` - Full table name.
  `keyCols` - Database key columns.
  `valCols` - Database value columns.
Returns:
  Insert query.

#### updateQuery

    public String updateQuery(String fullTblName,
                              Collection<String> keyCols,
                              Iterable<String> valCols)

Construct update query.

Specified by:
  `updateQuery` in interface `JdbcDialect`
Parameters:
  `fullTblName` - Full table name.
  `keyCols` - Database key columns.
  `valCols` - Database value columns.
Returns:
  Update query.

#### hasMerge

    public boolean hasMerge()

Specified by:
  `hasMerge` in interface `JdbcDialect`
Returns:
  `True` if database support merge operation.

#### mergeQuery

    public String mergeQuery(String fullTblName,
                             Collection<String> keyCols,
                             Collection<String> uniqCols)

Construct merge query.

Specified by:
  `mergeQuery` in interface `JdbcDialect`
Parameters:
  `fullTblName` - Full table name.
  `keyCols` - Database key columns.
  `uniqCols` - Database unique value columns.
Returns:
  Merge query.

#### removeQuery

    public String removeQuery(String fullTblName,
                              Iterable<String> keyCols)

Construct remove query.

Specified by:
  `removeQuery` in interface `JdbcDialect`
Parameters:
  `fullTblName` - Full table name.
  `keyCols` - Database key columns.
Returns:
  Remove query.

#### getMaxParameterCount

    public int getMaxParameterCount()

Get max query parameters count.

Specified by:
  `getMaxParameterCount` in interface `JdbcDialect`
Returns:
  Max query parameters count.

#### setMaxParameterCount

    public void setMaxParameterCount(int maxParamsCnt)

Set max query parameters count.

Parameters:
  `maxParamsCnt` - Max query parameters count.

#### getFetchSize

    public int getFetchSize()

Gives the JDBC driver a hint how many rows should be fetched from the database when more rows are needed. If the value specified is zero, then the hint is ignored. The default value is zero.

Specified by:
  `getFetchSize` in interface `JdbcDialect`
Returns:
  The fetch size for result sets.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.5.0
Release Date | : May 23 2018