Skip to content
Snippets Groups Projects
  1. Apr 15, 2021
    • Mergen Imeev's avatar
      sql: introduce mem_cast_explicit() · c8b8fd66
      Mergen Imeev authored
      This patch introduces mem_cast_explicit(). This function is used to
      convert a MEM to a given field type according to explicit cast rules.
      
      Part of #5818
      c8b8fd66
    • Mergen Imeev's avatar
      sql: introduce mem_to_str() and mem_to_str0() · b47715c1
      Mergen Imeev authored
      This patch introduces mem_to_str() and mem_to_str0() functions. These
      functions are used to convert a MEM to a MEM that contains string value.
      These functions defines the rules that are used during convertion from
      values of all other types to STRING.
      
      Part of #5818
      b47715c1
    • Mergen Imeev's avatar
      sql: introduce mem_to_number() · 985eca7c
      Mergen Imeev authored
      This patch introduces mem_to_number(). This function is used to convert
      MEM to MEM contains number.
      
      Part of #5818
      985eca7c
    • Mergen Imeev's avatar
      sql: introduce mem_to_double() · 5b438e24
      Mergen Imeev authored
      This patch intruduces mem_to_double(). This function is used to convert
      a MEM to a MEM that contains double value. This function defines the
      rules that are used during conversion from values of all other types to
      double.
      
      Part of #5818
      5b438e24
    • Mergen Imeev's avatar
      sql: introduce mem_to_int*() functions · 829daeed
      Mergen Imeev authored
      This patch introduces mem_to_int() and mem_to_int_precise() functions.
      These functions are used to convert a MEM to a MEM that contains
      integer value. These functions defines the rules that are used during
      convertion from values of all other types to INTEGER.
      
      Part of #5818
      829daeed
    • Mergen Imeev's avatar
      sql: introduce mem_set_null_clear() · 1581f883
      Mergen Imeev authored
      This patch introduces mem_set_null_clear() function. This function sets
      "cleared" NULL to MEM. This NULL is used only in internal VDBE
      operations.
      
      Part of #5818
      1581f883
    • Mergen Imeev's avatar
      sql: introduce mem_set_agg() · bdb64c1d
      Mergen Imeev authored
      This patch introduces mem_set_agg() function. This function stores
      aggregation function to MEM and allocates enough memory to hold
      accumulation structure for aggregate function.
      
      Part of #5818
      bdb64c1d
    • Mergen Imeev's avatar
      sql: introduce mem_set_frame() · d15f2a72
      Mergen Imeev authored
      This patch introduces mem_set_frame() function. This function clears the
      MEM and sets a frame to MEM. Frames used for internal VDBE operations.
      
      Part of #5818
      d15f2a72
    • Mergen Imeev's avatar
      sql: refactor mem_set_ptr() · f22686dc
      Mergen Imeev authored
      This patch refactors mem_set_ptr() function. Also, it moves the function
      to all others mem_set_*() functions.
      
      Part of #5818
      f22686dc
    • Mergen Imeev's avatar
      sql: introduce mem_set_invalid() · 8bdc9da8
      Mergen Imeev authored
      This patch introduces mem_set_invalid() function. This function clears
      MEM and invalidates it.
      
      Part of #5818
      8bdc9da8
    • Mergen Imeev's avatar
      sql: introduce mem_set_*() for map and array · f149b5ad
      Mergen Imeev authored
      This patch introduces set of mem_set_*() functions for MAP and ARRAY.
      These functions clears MEM and sets it to given binary value. Binary
      value must be MAP or ARRAY. Degree of clearing and type of allocation of
      the binary value is determined by the function used.
      
      Part of #5818
      f149b5ad
    • Mergen Imeev's avatar
      sql: introduce mem_set_zerobin() · fe92a240
      Mergen Imeev authored
      This patch introduces mem_set_zerobin() function. This function clears
      MEM and sets it to binary value that consists of given number of zero
      bytes.
      
      Part of #5818
      fe92a240
    • Mergen Imeev's avatar
      sql: introduce mem_copy_bin() · 95d49373
      Mergen Imeev authored
      This patch introduces mem_copy_bin() function. This function copies
      given binary value to a newly allocated by MEM memory.
      
      Part of #5818
      95d49373
    • Mergen Imeev's avatar
      sql: introduce mem_set_bin_*() functions · 2a4efdd5
      Mergen Imeev authored
      This patch introduces set of mem_set_bin_*() functions. These functions
      clears MEM and sets it to given binary value. Degree of clearing and
      type of allocation of the binary value is determined by the function
      used.
      
      Part of #5818
      2a4efdd5
    • Mergen Imeev's avatar
      sql: introduce mem_copy_str() and mem_copy_str0() · d089a6cf
      Mergen Imeev authored
      This patch introduces mem_copy_str() and mem_copy_str0() functions.
      These functions copy given string to newly allocated by MEM memory.
      String given to mem_copy_str0() should be NULL-terminated. This is not
      necessary for mem_copy_str().
      
      Part of #5818
      d089a6cf
    • Mergen Imeev's avatar
      sql: introduce mem_set_str_*() functions · 79273e38
      Mergen Imeev authored
      This patch introduces set of mem_set_str_*() functions. These functions
      clears MEM and sets it to given string value. Degree of clearing and
      type of allocation of the string is determined by the function used.
      
      Part of #5818
      79273e38
    • Mergen Imeev's avatar
      sql: move mem_set_bool() and mem_set_double() · d689a3af
      Mergen Imeev authored
      This patch performs a small refactoring of mem_set_double() and moves
      this function and mem_set_bool() to another place so that they are part
      of the code block containing all mem_set_*() functions.
      
      Part of #5818
      d689a3af
    • Mergen Imeev's avatar
      sql: introduce mem_set_uint() · c4a86696
      Mergen Imeev authored
      This patch introduces mem_set_uint(). This function clears MEM and sets
      it to given unsigned value.
      
      Part of #5818
      c4a86696
    • Mergen Imeev's avatar
      sql: introduce mem_set_int() · c9b6a278
      Mergen Imeev authored
      This patch introduces mem_set_int(). This function clears MEM and sets
      it to given integer value.
      
      Part of #5818
      c9b6a278
    • Mergen Imeev's avatar
      sql: introduce mem_set_null() · 1aad8fdb
      Mergen Imeev authored
      This patch introduces mem_set_null(). This function clears MEM and sets
      it to NULL.
      
      Part of #5818
      1aad8fdb
    • Mergen Imeev's avatar
      sql: Initialize MEM in sqlVdbeAllocUnpackedRecord() · 4d801264
      Mergen Imeev authored
      This patch adds initialization for newly created MEM objects in
      sqlVdbeAllocUnpackedRecord(). Changing a MEM without being
      initialized may give us unexpected result.
      
      Part of #5818
      4d801264
    • Mergen Imeev's avatar
      sql: introduce bitwise operations for MEM · 8bc1b411
      Mergen Imeev authored
      This patch introduces mem_bit_and(), mem_bit_or(), mem_shift_left(),
      mem_shift_right(), and mem_bit_not(), which perform bitwise operations
      on MEM.
      
      Part of #5818
      8bc1b411
    • Mergen Imeev's avatar
      sql: introduce mem_cmp_*() functions · 80cbac4d
      Mergen Imeev authored
      This patch introduces set of mem_cmp_*() functions. These functions are
      used to compare MEMs.
      
      Part of #5818
      80cbac4d
    • Mergen Imeev's avatar
      sql: introduce arithmetic operations for MEM · de0e77f9
      Mergen Imeev authored
      This patch introduces mem_add(), mem_sub(), mem_mul(), mem_div() and
      mem_rem(), which perform arithmetic operations on two MEMs. Operands
      must contain values of numeric types or values that can be converted
      to a number according to implicit casting rules.
      
      Part of #5818
      de0e77f9
    • Mergen Imeev's avatar
      sql: introduce mem_concat() · 0c3d0af3
      Mergen Imeev authored
      This patch introduces mem_concat(). Function mem_concat() concatenates
      values from two MEMs in case these values are strings or binaries and
      writes the result to the third MEM.
      
      Part of #5818
      0c3d0af3
    • Mergen Imeev's avatar
      sql: remove sql_column_to_messagepack() · f9b70495
      Mergen Imeev authored
      Function sql_column_to_messagepack() has almost the same functionality
      as sql_vdbe_mem_encode_tuple(). Due to this it is not necessary to
      have sql_column_to_messagepack(), so it is removed in this commit.
      
      Part of #5818
      f9b70495
    • Mergen Imeev's avatar
      sql: rework vdbe_decode_msgpack_into_mem() · f7a3eff7
      Mergen Imeev authored
      The original vdbe_decode_msgpack_into_mem() returns a MEM that contains
      string and binary values as ephemeral. This patch renames this function
      to mem_from_mp_ephemeral() and introduces new function mem_from_mp(),
      which returns a MEM that contains string and binary values in newly
      allocated memory.
      
      This patch changes behavior for this query:
      
      CREATE TABLE t1(m VARBINARY primary key);
      INSERT INTO t1 VALUES(x'6178'), (x'6278'), (x'6379');
      SELECT count(*), substr(m,2,1) AS mx FROM t1 GROUP BY mx;
      
      Before this patch:
      
      tarantool> SELECT count(*), substr(m,2,1) AS mx FROM t1 GROUP BY mx;
      ---
      - metadata:
        - name: COLUMN_1
          type: integer
        - name: MX
          type: string
        rows:
        - [2, 'y']
        - [1, 'y']
      ...
      
      After this patch.
      
      tarantool> SELECT count(*), substr(m,2,1) AS mx FROM t1 GROUP BY mx;
      ---
      - metadata:
        - name: COLUMN_1
          type: integer
        - name: MX
          type: string
        rows:
        - [2, 'x']
        - [1, 'y']
      ...
      
      Part of #5818
      Closes #5890
      f7a3eff7
    • Mergen Imeev's avatar
      sql: rework mem_move() · 1d24bef8
      Mergen Imeev authored
      This patch reworks mem_move(). This function moves all content of source
      MEM to destination MEM. Source mem is set to NULL.
      
      Part of #5818
      1d24bef8
    • Mergen Imeev's avatar
      sql: introduce mem_copy_as_ephemeral() · aae2c0a3
      Mergen Imeev authored
      This patch intoduces mem_copy_as_ephemeral(). This function copies value
      from source MEM to destination MEM. In case value is of string or binary
      type and its allocation type is not static, it copied as value with
      ephemeral allocation type.
      
      Part of #5818
      aae2c0a3
    • Mergen Imeev's avatar
      sql: introduce mem_copy() · 29c93d02
      Mergen Imeev authored
      This patch introduces mem_copy(). This function copies value from source
      MEM to destination MEM. In case value is string or binary and have not
      static allocation type, it is copied to newly allocated memory.
      
      Part of #5818
      29c93d02
    • Mergen Imeev's avatar
      sql: introduce mem_is_*() functions() · 2d0870fc
      Mergen Imeev authored
      This patch introduces mem_is_*() functions that allows to check current
      MEM state.
      
      Part of #5818
      2d0870fc
    • Mergen Imeev's avatar
      sql: introduce mem_destroy() · 65959761
      Mergen Imeev authored
      This patch introduces mem_destroy(). This function should be used to
      free and destroy all objects owned by MEM, if necessary.
      
      Part of #5818
      65959761
    • Mergen Imeev's avatar
      sql: introduce mem_create() · 5360768a
      Mergen Imeev authored
      This patch introduces mem_create(). This function should be used to
      initialize a MEM. MEM should be initialized before usage.
      
      Part of #5818
      5360768a
    • Mergen Imeev's avatar
      sql: introduce mem_str() · c976ea84
      Mergen Imeev authored
      This patch introduces mem_str() which allows to receive value of MEM as
      a string. Due to the limitations of static_alloc(), this function cannot
      be used to safely retrieve a value of MEM converted to string. This
      function is suitable for debugging, displaying the value in an error
      message, etc.
      
      Part of #5818
      c976ea84
    • Mergen Imeev's avatar
      sql: disable unused code in sql/vdbemem.c · c14e14f9
      Mergen Imeev authored
      This patch disables unused code in sql/vdbemem.c. It will simplify
      refactoring.
      
      Part of #5818
      c14e14f9
    • Mergen Imeev's avatar
      sql: remove unused MEM-related functions · 91ec46e4
      Mergen Imeev authored
      Part of #5818
      91ec46e4
    • Mergen Imeev's avatar
      sql: refactor port_vdbemem_*() functions · 5bc230c6
      Mergen Imeev authored
      This patch simplifies port_vdbemem_dump_lua() and
      port_vdbemem_get_msgpack() functions.
      
      Part of #5818
      5bc230c6
    • Mergen Imeev's avatar
      sql: move MEM-related functions to mem.c/mem.h · 89db11f4
      Mergen Imeev authored
      This patch moves all MEM-related functions in mem.c/mem.h.
      
      Part of #5818
      89db11f4
    • Mergen Imeev's avatar
      sql: remove NULL-termination in OP_ResultRow · c60fff92
      Mergen Imeev authored
      There is no need for NULL-termination, since MEMs converted to msgpack
      and msgpack do not require NULL-terminated strings.
      
      Needed for #5818
      c60fff92
    • Mergen Imeev's avatar
      sql: disable unused code in sql/legacy.c · bc4b8459
      Mergen Imeev authored
      This patch disables unused code in sql/legacy.c. It will simplify
      refactoring.
      
      Needed for #5818
      bc4b8459
Loading