Class BindCallCustomParameter

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    InParameterForCallableStatement, OutputParameterForCallableStatement

    public class BindCallCustomParameter
    extends java.lang.Object
    implements java.io.Serializable
    INTERNAL:

    Purpose: To provide a base type for customary parameters' types used for binding by DatabaseCall: descendants of DatabasePlatform may create instances of descendants of this class in customModifyInDatabaseCall method.

    Responsibilities:

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Object obj  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BindCallCustomParameter()  
        BindCallCustomParameter​(java.lang.Object obj)
      INTERNAL: Binds the custom parameter (obj) into the passed PreparedStatement for the passed DatabaseCall.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object convert​(java.lang.Object parameter, DatabaseField dbField, AbstractSession session, java.sql.Connection connection)
      INTERNAL: Converts the parameter object from a collection or java object into a JDBC type such as an Array or Struct object, based on the type information contained in the dbField object.
      void set​(DatabasePlatform platform, java.sql.CallableStatement statement, java.lang.String parameterName, AbstractSession session)
      Sets this bound parameter, on the given statement, for the given parameterName.
      void set​(DatabasePlatform platform, java.sql.PreparedStatement statement, int parameterIndex, AbstractSession session)
      Sets this bound parameter, on the given statement, at the given parameterIndex.
      boolean shouldUseUnwrappedConnection()
      Return if unwrapped connection should be used.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • obj

        protected java.lang.Object obj
    • Constructor Detail

      • BindCallCustomParameter

        public BindCallCustomParameter​(java.lang.Object obj)
        INTERNAL: Binds the custom parameter (obj) into the passed PreparedStatement for the passed DatabaseCall. Called only by DatabasePlatform.setParameterValueInDatabaseCall method
      • BindCallCustomParameter

        protected BindCallCustomParameter()
    • Method Detail

      • shouldUseUnwrappedConnection

        public boolean shouldUseUnwrappedConnection()
        Return if unwrapped connection should be used.
      • set

        public void set​(DatabasePlatform platform,
                        java.sql.PreparedStatement statement,
                        int parameterIndex,
                        AbstractSession session)
                 throws java.sql.SQLException
        Sets this bound parameter, on the given statement, at the given parameterIndex. Note: PreparedStatement contains setX(int parameterIndex, X x) methods. This method aligns with that pattern.
        Throws:
        java.sql.SQLException
      • set

        public void set​(DatabasePlatform platform,
                        java.sql.CallableStatement statement,
                        java.lang.String parameterName,
                        AbstractSession session)
                 throws java.sql.SQLException
        Sets this bound parameter, on the given statement, for the given parameterName. Note: CallableStatement contains setX(int parameterName, X x) methods. This method aligns with that pattern.
        Throws:
        java.sql.SQLException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • convert

        public java.lang.Object convert​(java.lang.Object parameter,
                                        DatabaseField dbField,
                                        AbstractSession session,
                                        java.sql.Connection connection)
                                 throws java.sql.SQLException
        INTERNAL: Converts the parameter object from a collection or java object into a JDBC type such as an Array or Struct object, based on the type information contained in the dbField object. If the parameter is null, the dbField will be returned to represent the null value. A Struct object will be returned if: 1) the dbField is an ObjectRelationalDatabaseField with its sqltype set to Types.STRUCT 2) parameter is not an instanceof java.sql.Struct 3) There is an ObjectRelationalDataTypeDescriptor defined for the parameter object's class An Array object will be returned if: 1) the dbField is an ObjectRelationalDatabaseField and sqltype is set to Types.ARRAY 2) parameter is an instanceof collection and is not an instanceof java.sql.Array This method will be used recursively on the dbField's nestedField and objects in the collection to build the Array object, allowing for nested structures to be produced ie arrays of arrays
        Throws:
        java.sql.SQLException