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 Modifier and Type Method Description static StringaddQuotationMarksIfNeeded(String str)Add quotation marks at the beginning and end of the string.static Collection<OdbcColumnMeta>convertMetadata(Collection<GridQueryFieldMetadata> meta)Convert metadata in collection fromGridQueryFieldMetadatatoOdbcColumnMeta.static StringgetIgniteTypeFromOdbcType(String odbcDataType)Lookup Ignite data type corresponding to specific ODBC data typestatic StringprepareSchema(String schema)Prepare client's schema for processing.static StringpreprocessPattern(String ptrn)Pre-process table or column pattern.static StringremoveQuotationMarksIfNeeded(String str)Remove quotation marks at the beginning and end of the string if present.static longrowsAffected(QueryCursor<List<?>> qryCur)Get affected rows for statement.static StringtryRetrieveH2ErrorMessage(Throwable err)Tries to retrieve H2 engine error message from exception.
-
-
-
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 fromGridQueryFieldMetadatatoOdbcColumnMeta.- Parameters:
meta- Internal query field metadata.- Returns:
- Odbc query field metadata.
-
-