org.apache.ignite.internal.processors.odbc.odbc

## Class OdbcUtils

- java.lang.Object
- - org.apache.ignite.internal.processors.odbc.odbc.OdbcUtils

    public class OdbcUtils
    extends Object

Various ODBC utility methods.

### Method Summary

All Methods Static Methods Concrete Methods
`static String` `addQuotationMarksIfNeeded(String str)` Add quotation marks at the beginning and end of the string.
`static Collection<OdbcColumnMeta>` `convertMetadata(Collection<GridQueryFieldMetadata> meta)` Convert metadata in collection from `GridQueryFieldMetadata` to `OdbcColumnMeta`.
`static String` `getIgniteTypeFromOdbcType(String odbcDataType)` Lookup Ignite data type corresponding to specific ODBC data type
`static String` `prepareSchema(String schema)` Prepare client's schema for processing.
`static String` `preprocessPattern(String ptrn)` Pre-process table or column pattern.
`static String` `removeQuotationMarksIfNeeded(String str)` Remove quotation marks at the beginning and end of the string if present.
`static long` `rowsAffected(QueryCursor<List<?>> qryCur)` Get affected rows for statement.
`static String` `tryRetrieveH2ErrorMessage(Throwable err)` Tries to retrieve H2 engine error message from exception.

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

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

### Method Detail

#### addQuotationMarksIfNeeded

    public static String addQuotationMarksIfNeeded(String str)

Add quotation marks at the beginning and end of the string.

Parameters:
  `str` - Input string.
Returns:
  String surrounded with quotation marks.

#### removeQuotationMarksIfNeeded

    public static String removeQuotationMarksIfNeeded(String str)

Remove quotation marks at the beginning and end of the string if present.

Parameters:
  `str` - Input string.
Returns:
  String without leading and trailing quotation marks.

#### preprocessPattern

    public static String preprocessPattern(String ptrn)

Pre-process table or column pattern.

Parameters:
  `ptrn` - Pattern to pre-process.
Returns:
  Processed pattern.

#### prepareSchema

    public static String prepareSchema(String schema)

Prepare client's schema for processing.

Parameters:
  `schema` - Schema.
Returns:
  Prepared schema.

#### getIgniteTypeFromOdbcType

    public static String getIgniteTypeFromOdbcType(String odbcDataType)

Lookup Ignite data type corresponding to specific ODBC data type

Parameters:
  `odbcDataType` - ODBC data type identifier
Returns:
  Ignite data type name

#### tryRetrieveH2ErrorMessage

    public static String tryRetrieveH2ErrorMessage(Throwable err)

Tries to retrieve H2 engine error message from exception. If the exception is not of type "org.h2.jdbc.JdbcSQLException" returns original error message.

Parameters:
  `err` - Exception.
Returns:
  Error message.

#### rowsAffected

    public static long rowsAffected(QueryCursor<List<?>> qryCur)

Get affected rows for statement.

Parameters:
  `qryCur` - Cursor.
Returns:
  Number of table rows affected, if the query is DML, and -1 otherwise.

#### convertMetadata

    public static Collection<OdbcColumnMeta> convertMetadata(Collection<GridQueryFieldMetadata> meta)

Convert metadata in collection from `GridQueryFieldMetadata` to `OdbcColumnMeta`.

Parameters:
  `meta` - Internal query field metadata.
Returns:
  Odbc query field metadata.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.14.0
Release Date | : September 29 2022