Class CallableParameterMetaData

  • All Implemented Interfaces:
    java.sql.ParameterMetaData, java.sql.Wrapper

    public class CallableParameterMetaData
    extends java.lang.Object
    implements java.sql.ParameterMetaData
    • Field Detail

      • PARAMETER_PATTERN

        private static final java.util.regex.Pattern PARAMETER_PATTERN
      • RETURN_PATTERN

        private static final java.util.regex.Pattern RETURN_PATTERN
      • name

        private final java.lang.String name
      • database

        private java.lang.String database
      • valid

        private boolean valid
      • isFunction

        private boolean isFunction
    • Constructor Detail

      • CallableParameterMetaData

        public CallableParameterMetaData​(MariaDbConnection con,
                                         java.lang.String database,
                                         java.lang.String name,
                                         boolean isFunction)
        Retrieve Callable metaData.
        Parameters:
        con - connection
        database - database name
        name - procedure/function name
        isFunction - is it a function
    • Method Detail

      • readMetadataFromDbIfRequired

        public void readMetadataFromDbIfRequired()
                                          throws java.sql.SQLException
        Search metaData if not already loaded.
        Throws:
        java.sql.SQLException - if error append during loading metaData
      • mapMariaDbTypeToJdbc

        private int mapMariaDbTypeToJdbc​(java.lang.String str)
      • queryMetaInfos

        private java.lang.String[] queryMetaInfos​(boolean isFunction)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • parseFunctionReturnParam

        private void parseFunctionReturnParam​(java.lang.String functionReturn)
                                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • parseParamList

        private void parseParamList​(boolean isFunction,
                                    java.lang.String paramList)
                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • readMetadata

        private void readMetadata()
                           throws java.sql.SQLException
        Read procedure metadata from mysql.proc table(column param_list).
        Throws:
        java.sql.SQLException - if data doesn't correspond.
      • getParameterCount

        public int getParameterCount()
        Specified by:
        getParameterCount in interface java.sql.ParameterMetaData
      • getParam

        private CallParameter getParam​(int index)
                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • isNullable

        public int isNullable​(int param)
                       throws java.sql.SQLException
        Specified by:
        isNullable in interface java.sql.ParameterMetaData
        Throws:
        java.sql.SQLException
      • isSigned

        public boolean isSigned​(int param)
                         throws java.sql.SQLException
        Specified by:
        isSigned in interface java.sql.ParameterMetaData
        Throws:
        java.sql.SQLException
      • getPrecision

        public int getPrecision​(int param)
                         throws java.sql.SQLException
        Specified by:
        getPrecision in interface java.sql.ParameterMetaData
        Throws:
        java.sql.SQLException
      • getScale

        public int getScale​(int param)
                     throws java.sql.SQLException
        Specified by:
        getScale in interface java.sql.ParameterMetaData
        Throws:
        java.sql.SQLException
      • getParameterType

        public int getParameterType​(int param)
                             throws java.sql.SQLException
        Specified by:
        getParameterType in interface java.sql.ParameterMetaData
        Throws:
        java.sql.SQLException
      • getParameterTypeName

        public java.lang.String getParameterTypeName​(int param)
                                              throws java.sql.SQLException
        Specified by:
        getParameterTypeName in interface java.sql.ParameterMetaData
        Throws:
        java.sql.SQLException
      • getParameterClassName

        public java.lang.String getParameterClassName​(int param)
                                               throws java.sql.SQLException
        Specified by:
        getParameterClassName in interface java.sql.ParameterMetaData
        Throws:
        java.sql.SQLException
      • getParameterMode

        public int getParameterMode​(int param)
                             throws java.sql.SQLException
        Get mode info.
        • 0 : unknown
        • 1 : IN
        • 2 : INOUT
        • 4 : OUT
        Specified by:
        getParameterMode in interface java.sql.ParameterMetaData
        Parameters:
        param - parameter index
        Returns:
        mode information
        Throws:
        java.sql.SQLException - if index is wrong
      • getName

        public java.lang.String getName​(int param)
                                 throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> iface)
        Specified by:
        unwrap in interface java.sql.Wrapper
      • isWrapperFor

        public boolean isWrapperFor​(java.lang.Class<?> iface)
        Specified by:
        isWrapperFor in interface java.sql.Wrapper