Class SqlListenerUtils
- java.lang.Object
-
- org.apache.ignite.internal.processors.odbc.SqlListenerUtils
-
public abstract class SqlListenerUtils extends Object
Binary reader with marshaling non-primitive and non-embedded objects with JDK marshaller.
-
-
Constructor Summary
Constructors Constructor Description SqlListenerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intexceptionToSqlErrorCode(Throwable e)static booleanisPlainType(Class<?> cls)static @Nullable ObjectreadObject(byte type, BinaryReaderExImpl reader, boolean binObjAllow, boolean keepBinary)static @Nullable ObjectreadObject(byte type, BinaryReaderExImpl reader, boolean binObjAllow, boolean keepBinary, boolean createByteArrayCopy)static @Nullable ObjectreadObject(BinaryReaderExImpl reader, boolean binObjAllow)static @Nullable ObjectreadObject(BinaryReaderExImpl reader, boolean binObjAllow, boolean keepBinary)static StringtranslateSqlWildcardsToRegex(String sqlPtrn)Converts sql pattern wildcards into java regex wildcards.static voidwriteObject(BinaryWriterExImpl writer, @Nullable Object obj, boolean binObjAllow)
-
-
-
Method Detail
-
readObject
@Nullable public static @Nullable Object readObject(BinaryReaderExImpl reader, boolean binObjAllow) throws BinaryObjectException
- Parameters:
reader- Reader.binObjAllow- Allow to read non plaint objects.- Returns:
- Read object.
- Throws:
BinaryObjectException- On error.
-
readObject
@Nullable public static @Nullable Object readObject(BinaryReaderExImpl reader, boolean binObjAllow, boolean keepBinary) throws BinaryObjectException
- Parameters:
reader- Reader.binObjAllow- Allow to read non plaint objects.keepBinary- Whether to deserialize objects or keep in binary format.- Returns:
- Read object.
- Throws:
BinaryObjectException- On error.
-
readObject
@Nullable public static @Nullable Object readObject(byte type, BinaryReaderExImpl reader, boolean binObjAllow, boolean keepBinary) throws BinaryObjectException
- Parameters:
type- Object type.reader- Reader.binObjAllow- Allow to read non plaint objects.- Returns:
- Read object.
- Throws:
BinaryObjectException- On error.
-
readObject
@Nullable public static @Nullable Object readObject(byte type, BinaryReaderExImpl reader, boolean binObjAllow, boolean keepBinary, boolean createByteArrayCopy) throws BinaryObjectException
- Parameters:
type- Object type.reader- Reader.binObjAllow- Allow to read non plaint objects.keepBinary- Whether to deserialize objects or keep in binary format.createByteArrayCopy- Whether to return new copy or copy-on-write buffer for byte array.- Returns:
- Read object.
- Throws:
BinaryObjectException- On error.
-
writeObject
public static void writeObject(BinaryWriterExImpl writer, @Nullable @Nullable Object obj, boolean binObjAllow) throws BinaryObjectException
- Parameters:
writer- Writer.obj- Object to write.binObjAllow- Allow to write non plain objects.- Throws:
BinaryObjectException- On error.
-
isPlainType
public static boolean isPlainType(Class<?> cls)
- Parameters:
cls- Class.- Returns:
trueis the type is plain (not user's custom class).
-
exceptionToSqlErrorCode
public static int exceptionToSqlErrorCode(Throwable e)
- Parameters:
e- Exception to convert.- Returns:
- IgniteQueryErrorCode.
-
translateSqlWildcardsToRegex
public static String translateSqlWildcardsToRegex(String sqlPtrn)
Converts sql pattern wildcards into java regex wildcards.
Translates "_" to "." and "%" to ".*" if those are not escaped with "\" ("\_" or "\%").
All other characters are considered normal and will be escaped if necessary.
Example: som_ --> som. so% --> so.* s[om]e --> so\[om\]e so\_me --> so_me some? --> some\? som\e --> som\\e
-
-