Class SQLExec

    • Field Detail

      • dataMapName

        protected String dataMapName
      • positionalParams

        protected List<Object> positionalParams
      • returnGeneratedKeys

        protected boolean returnGeneratedKeys
      • queryTimeout

        protected int queryTimeout
    • Constructor Detail

      • SQLExec

        public SQLExec​(String sql)
    • Method Detail

      • query

        public static SQLExec query​(String sql)
        Creates a query executing provided SQL run against default database.
      • query

        public static SQLExec query​(String dataMapName,
                                    String sql)
        Creates a query executing provided SQL that performs routing based on the provided DataMap name.
      • getSql

        public String getSql()
      • append

        public SQLExec append​(String sqlChunk)
        Appends a piece of SQL to the previously stored SQL template.
      • paramsArray

        public SQLExec paramsArray​(Object... params)
        Initializes positional parameters of the query. Parameters are bound in the order they are found in the SQL template. If a given parameter name is used more than once, only the first occurrence is treated as "position", subsequent occurrences are bound with the same value as the first one. If template parameters count is different from the array parameter count, an exception will be thrown.

        Note that calling this method will reset any previously set *named* parameters.

      • paramsList

        public SQLExec paramsList​(List<Object> params)
        Initializes positional parameters of the query. Parameters are bound in the order they are found in the SQL template. If a given parameter name is used more than once, only the first occurrence is treated as "position", subsequent occurrences are bound with the same value as the first one. If template parameters count is different from the list parameter count, an exception will be thrown.

        Note that calling this method will reset any previously set *named* parameters.

      • getParams

        public Map<String,​Object> getParams()
        Returns a potentially immutable map of named parameters that will be bound to SQL.
      • getPositionalParams

        public List<Object> getPositionalParams()
        Returns a potentially immutable list of positional parameters that will be bound to SQL.
      • updateBatch

        public int[] updateBatch​(ObjectContext context)
      • isReturnGeneratedKeys

        public boolean isReturnGeneratedKeys()
        Returns:
        returnGeneratedKeys flag value
        Since:
        4.1
      • returnGeneratedKeys

        public SQLExec returnGeneratedKeys​(boolean returnGeneratedKeys)
        Flag indicating that generated keys should be returned by this query execution. Generated keys could be read via QueryResponse.currentList() method
        Parameters:
        returnGeneratedKeys - flag value
        Since:
        4.1
        See Also:
        Statement.RETURN_GENERATED_KEYS
      • queryTimeout

        public SQLExec queryTimeout​(int queryTimeout)
        Since:
        4.2