Class SqlListenerUtils


  • public abstract class SqlListenerUtils
    extends Object
    Binary reader with marshaling non-primitive and non-embedded objects with JDK marshaller.
    • Constructor Detail

      • SqlListenerUtils

        public SqlListenerUtils()
    • Method Detail

      • 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.
      • isPlainType

        public static boolean isPlainType​(Class<?> cls)
        Parameters:
        cls - Class.
        Returns:
        true is 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