Class NativeQuery


  • public class NativeQuery
    extends Object
    Represents a query that is ready for execution by backend. The main difference from JDBC is ? are replaced with $1, $2, etc.
    • Field Detail

      • nativeSql

        public final String nativeSql
      • bindPositions

        public final int[] bindPositions
      • multiStatement

        public final boolean multiStatement
    • Constructor Detail

      • NativeQuery

        public NativeQuery​(String nativeSql,
                           int[] bindPositions,
                           boolean multiStatement,
                           SqlCommand dml)
    • Method Detail

      • toString

        public String toString​(ParameterList parameters)
        Stringize this query to a human-readable form, substituting particular parameter values for parameter placeholders.
        Parameters:
        parameters - a ParameterList returned by this Query's Query.createParameterList() method, or null to leave the parameter placeholders unsubstituted.
        Returns:
        a human-readable representation of this query
      • bindName

        public static String bindName​(int index)
        Returns $1, $2, etc names of bind variables used by backend.
        Parameters:
        index - index of a bind variable
        Returns:
        bind variable name
      • calculateBindLength

        public static int calculateBindLength​(int bindCount)
        Calculate the text length required for the given number of bind variables including dollars. Do this to avoid repeated calls to AbstractStringBuilder.expandCapacity(...) and Arrays.copyOf
        Parameters:
        bindCount - total number of parameters in a query
        Returns:
        int total character length for $xyz kind of binds