• unknown's avatar
    Support for character set conversion in binary protocol: another go · eff961a9
    unknown authored
    after Monty's review.
    - Item_param was rewritten.
    - it turns out that we can't convert string data to character set of
      connection on the fly, because they first should be written to the binary
      log.
      To support efficient conversion we need to rewrite prepared statements
      binlogging code first.
    
    
    include/my_global.h:
      Macro swap(a, b, c) was renamed to resolve name conflict with
      String::swap() method.
    include/my_sys.h:
      Added declaration of escape_string_for_mysql()
    include/mysql_com.h:
      Removed and moved back: a macro which is visible to libmysql user but
      has sence only in prepared statement protocol implementation.
    isam/_search.c:
      swap -> swap_variables
    isam/test2.c:
      swap -> swap_variables
    libmysql/libmysql.c:
      - sub_escape_string moved to mysys/charset.c to be visible in sql/
      - few cleanups
    myisam/mi_test2.c:
      swap -> swap_variables
    mysys/charset.c:
      sub_escape_string was moved from libmysql.c to be able to use it in sql/
      code.
    mysys/my_chsize.c:
      rename: swap -> swap_variables
    mysys/my_compress.c:
      swap -> swap_variables
    mysys/my_handler.c:
      swap -> swap_variables
    sql/field.cc:
      Field::store_time refactored to use TIME_to_string function from time.cc
    sql/item.cc:
      New implementation of Item_param class:
      added support for character sets conversion.
    sql/item.h:
      Item_param:
      - 'state' member introduced instead of many boolean variables.
      - put ltime, int_value and real_value into union to save space.
      - remove unimplemented members
      - set_value renamed to set_str
    sql/item_timefunc.cc:
      Refactored to use functions from time.cc
    sql/lock.cc:
      rename: swap -> swap_variables
    sql/mysql_priv.h:
      - added declarations for TIME_to_ulonglong_*, TIME_to_string functions
      - const specifiers for make_date, make_time, make_datetime arguments
    sql/opt_range.cc:
      rename: swap -> swap_variables
    sql/protocol.cc:
      - added character set conversion support to binary protocol.
      - Protocol::convert changed to point at shared buffer in THD.
        This lets us use one convert buffer for binary and simple protocol.
        The same buffer is used for client->server conversions in prepared
        statements code.
      - string conversion code refactored to Protocol::store_string_aux function.
      - few more comments
    sql/protocol.h:
      - Protocol::convert now points at THD::convert_buffer: we want to share one
        buffer between all protocol implementations.
    sql/sql_class.cc:
      - implementation of THD::convert_string using THD::convert_buffer
        (conversion of strings allocated in the system heap).
    sql/sql_class.h:
      - THD::convert_buffer is shared between THD and network Protocols and
        used for character set conversion of strings.
      - new function to convert String object from one charset to another using
        THD::convert_buffer
    sql/sql_insert.cc:
      A little fix in a comment.
    sql/sql_parse.cc:
      Shrink convert buffer in the end of each statement.
    sql/sql_prepare.cc:
        Many changes:
      - static specifier for set_param_* family of functions.
      - FIELD_TYPE -> MYSQL_TYPE
      - added set_param_binary as handler for BLOB types.
      - added character set support
      - added support for param typecode in mysql_stmt_get_longdata
        (mysql_stmt_send_long_data handler)
      - changes in Item_param deployed
      - few cleanups
    sql/sql_select.cc:
      rename: swap -> swap_variables
    sql/sql_string.cc:
      - String::append rewritten to support character set conversion for
      single-byte encodings.
      - added String::swap method to efficiently exchange two string objects.
    sql/sql_string.h:
      Declraration for String::swap().
    sql/time.cc:
      - function TIME_to_string to convert TIME to String in default MySQL format
      - family of functions TIME_to_ulonglong_*
    tests/client_test.c:
      Test for support for character set conversions in prepared statements
      (binary and text data).
    eff961a9
_search.c 24.8 KB