Commit ce804e4c authored by unknown's avatar unknown
Browse files

Merge mysql.com:/home/jonas/src/mysql-4.1

into mysql.com:/home/jonas/src/mysql-4.1-ndb

parents 520a7458 e1ae7e48
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -641,7 +641,7 @@ VAR* var_get(const char* var_name, const char** var_name_end, my_bool raw,
  if (*var_name != '$')
    goto err;
  digit = *++var_name - '0';
  if (!(digit < 10 && digit >= 0))
  if (digit < 0 || digit >= 10)
  {
    const char* save_var_name = var_name, *end;
    uint length;
+2 −2
Original line number Diff line number Diff line
@@ -2562,7 +2562,7 @@ case $default_charset in
      ;;
    cp1250)
      default_charset_default_collation="cp1250_general_ci"
      default_charset_collations="cp1250_general_ci cp1250_czech_ci cp1250_bin"
      default_charset_collations="cp1250_general_ci cp1250_czech_cs cp1250_bin"
      ;;
    cp1251)
      default_charset_default_collation="cp1251_general_ci"
@@ -2638,7 +2638,7 @@ case $default_charset in
      ;;
    latin2)
      default_charset_default_collation="latin2_general_ci"
      default_charset_collations="latin2_general_ci latin2_bin latin2_czech_ci latin2_hungarian_ci latin2_croatian_ci"
      default_charset_collations="latin2_general_ci latin2_bin latin2_czech_cs latin2_hungarian_ci latin2_croatian_ci"
      ;;
    latin5)
      default_charset_default_collation="latin5_turkish_ci"
+174 −23
Original line number Diff line number Diff line
@@ -1994,7 +1994,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
  }

  /*
    alloc_root will return valid address even in case param_count
    alloc_root will return valid address even in case when param_count
    and field_count are zero. Thus we should never rely on stmt->bind
    or stmt->params when checking for existence of placeholders or
    result set.
@@ -2091,12 +2091,6 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
    mysql_stmt_result_metadata()
    stmt  statement handle

  RETURN
    NULL  statement contains no result set or out of memory.
          In the latter case you can retreive error message
          with mysql_stmt_error.
   MYSQL_RES  a result set with no rows

  DESCRIPTION
    This function should be used after mysql_stmt_execute().
    You can safely check that prepared statement has a result set by calling
@@ -2110,6 +2104,12 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
      mysql_fetch_field_direct, mysql_fetch_fields, mysql_field_seek.
    - free returned MYSQL_RES structure with mysql_free_result.
    - proceed to binding of output parameters.

  RETURN
    NULL  statement contains no result set or out of memory.
          In the latter case you can retreive error message
          with mysql_stmt_error.
    MYSQL_RES  a result set with no rows
*/

MYSQL_RES * STDCALL
@@ -2194,11 +2194,11 @@ static void store_param_type(char **pos, MYSQL_BIND *param)
    param		MySQL bind param

  DESCRIPTION
    These funtions are invoked from mysql_stmt_execute by
    MYSQL_BIND::store_param_func pointer. This pointer is set once per many
    executions in mysql_stmt_bind_param. The caller must ensure that network
    buffer have enough capacity to store parameter (MYSQL_BIND::buffer_length
    contains needed number of bytes).
    These funtions are invoked from mysql_stmt_execute() by
    MYSQL_BIND::store_param_func pointer. This pointer is set once per
    many executions in mysql_stmt_bind_param(). The caller must ensure
    that network buffer have enough capacity to store parameter
    (MYSQL_BIND::buffer_length contains needed number of bytes).
*/

static void store_param_tinyint(NET *net, MYSQL_BIND *param)
@@ -2701,7 +2701,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
          example a table used in the query was altered.
        Note, that now (4.1.3) we always send metadata in reply to
        COM_EXECUTE (even if it is not necessary), so either this or
        previous always branch works.
        previous branch always works.
        TODO: send metadata only when it's really necessary and add a warning
        'Metadata changed' when it's sent twice.
      */
@@ -2776,19 +2776,171 @@ static my_bool int_is_null_false= 0;


/*
  Setup the input parameter data buffers from application
  Set up input data buffers for a statement.

  SYNOPSIS
    mysql_stmt_bind_param()
    stmt    statement handle
            The statement must be prepared with mysql_stmt_prepare().
    bind    Array of mysql_stmt_param_count() bind parameters.
            This function doesn't check that size of this argument
            is >= mysql_stmt_field_count(): it's user's responsibility.

  DESCRIPTION
    Use this call after mysql_stmt_prepare() to bind user variables to
    placeholders.
    Each element of bind array stands for a placeholder. Placeholders
    are counted from 0.  For example statement
    'INSERT INTO t (a, b) VALUES (?, ?)'
    contains two placeholders, and for such statement you should supply
    bind array of two elements (MYSQL_BIND bind[2]).

    By properly initializing bind array you can bind virtually any
    C language type to statement's placeholders:
    First, it's strongly recommended to always zero-initialize entire
    bind structure before setting it's members. This will both shorten
    your application code and make it robust to future extensions of
    MYSQL_BIND structure.
    Then you need to assign typecode of your application buffer to
    MYSQL_BIND::buffer_type. The following typecodes with their
    correspondence to C language types are supported:
    MYSQL_TYPE_TINY       for 8-bit integer variables. Normally it's
                          'signed char' and 'unsigned char';
    MYSQL_TYPE_SHORT      for 16-bit signed and unsigned variables. This
                          is usually 'short' and 'unsigned short';
    MYSQL_TYPE_LONG       for 32-bit signed and unsigned variables. It
                          corresponds to 'int' and 'unsigned int' on
                          vast majority of platforms. On IA-32 and some
                          other 32-bit systems you can also use 'long'
                          here;
    MYSQL_TYPE_LONGLONG   64-bit signed or unsigned integer.  Stands for
                          '[unsigned] long long' on most platforms;
    MYSQL_TYPE_FLOAT      32-bit floating point type, 'float' on most
                          systems;
    MYSQL_TYPE_DOUBLE     64-bit floating point type, 'double' on most
                          systems;
    MYSQL_TYPE_TIME       broken-down time stored in MYSQL_TIME
                          structure
    MYSQL_TYPE_DATE       date stored in MYSQL_TIME structure
    MYSQL_TYPE_DATETIME   datetime stored in MYSQL_TIME structure See
                          more on how to use these types for sending
                          dates and times below;
    MYSQL_TYPE_STRING     character string, assumed to be in
                          character-set-client. If character set of
                          client is not equal to character set of
                          column, value for this placeholder will be
                          converted to destination character set before
                          insert.
    MYSQL_TYPE_BLOB       sequence of bytes. This sequence is assumed to
                          be in binary character set (which is the same
                          as no particular character set), and is never
                          converted to any other character set. See also
                          notes about supplying string/blob length
                          below.
    MYSQL_TYPE_NULL       special typecode for binding nulls.
    These C/C++ types are not supported yet by the API: long double,
    bool.

    As you can see from the list above, it's responsibility of
    application programmer to ensure that chosen typecode properly
    corresponds to host language type. For example on all platforms
    where we build MySQL packages (as of MySQL 4.1.4) int is a 32-bit
    type. So for int you can always assume that proper typecode is
    MYSQL_TYPE_LONG (however queer it sounds, the name is legacy of the
    old MySQL API). In contrary sizeof(long) can be 4 or 8 8-bit bytes,
    depending on platform.

    TODO: provide client typedefs for each integer and floating point
    typecode, i. e. int8, uint8, float32, etc.

    Once typecode was set, it's necessary to assign MYSQL_BIND::buffer
    to point to the buffer of given type. Finally, additional actions
    may be taken for some types or use cases:

      Binding integer types.
    For integer types you might also need to set MYSQL_BIND::is_unsigned
    member. Set it to TRUE when binding unsigned char, unsigned short,
    unsigned int, unsigned long, unsigned long long.

      Binding floating point types.
    For floating point types you just need to set
    MYSQL_BIND::buffer_type and MYSQL_BIND::buffer. The rest of the
    members should be zero-initialized.

      Binding NULLs.
    You might have a column always NULL, never NULL, or sometimes NULL.
    For an always NULL column set MYSQL_BIND::buffer_type to
    MYSQL_TYPE_NULL.  The rest of the members just need to be
    zero-initialized.  For never NULL columns set MYSQL_BIND::is_null to
    0, or this has already been done if you zero-initialized the entire
    structure.  If you set MYSQL_TYPE::is_null to point to an
    application buffer of type 'my_bool', then this buffer will be
    checked on each execution: this way you can set the buffer to TRUE,
    or any non-0 value for NULLs, and to FALSE or 0 for not NULL data.

      Binding text strings and sequences of bytes.
    For strings, in addition to MYSQL_BIND::buffer_type and
    MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
    MYSQL_BIND::buffer_length.
    If 'length' is set, 'buffer_length' is ignored. 'buffer_length'
    member should be used when size of string doesn't change between
    executions. If you want to vary buffer length for each value, set
    'length' to point to an application buffer of type 'unsigned long'
    and set this long to length of the string before each
    mysql_stmt_execute().

      Binding dates and times.
    For binding dates and times prepared statements API provides clients
    with MYSQL_TIME structure. A pointer to instance of this structure
    should be assigned to MYSQL_BIND::buffer whenever MYSQL_TYPE_TIME,
    MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes are used.  When
    typecode is MYSQL_TYPE_TIME, only members 'hour', 'minute', 'second'
    and 'neg' (is time offset negative) are used. These members only
    will be sent to the server.
    MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
    MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure.
    You don't have to set MYSQL_TIME::time_type member: it's not used
    when sending data to the server, typecode information is enough.
    'second_part' member can hold microsecond precision of time value,
    but now it's only supported on protocol level: you can't store
    microsecond in a column, or use in temporal calculations. However,
    if you send a time value with microsecond part for 'SELECT ?',
    statement, you'll get it back unchanged from the server.

      Data conversion.
    If conversion from host language type to data representation,
    corresponding to SQL type, is required it's done on the server.
    Data truncation is possible when conversion is lossy. For example,
    if you supply MYSQL_TYPE_DATETIME value out of valid SQL type
    TIMESTAMP range, the same conversion will be applied as if this
    value would have been sent as string in the old protocol.
    TODO: document how the server will behave in case of truncation/data
    loss.

    After variables were bound, you can repeatedly set/change their
    values and mysql_stmt_execute() the statement.

    See also: mysql_stmt_send_long_data() for sending long text/blob
    data in pieces, examples in tests/client_test.c.
    Next steps you might want to make:
    - execute statement with mysql_stmt_execute(),
    - reset statement using mysql_stmt_reset() or reprepare it with
      another query using mysql_stmt_prepare()
    - close statement with mysql_stmt_close().

  IMPLEMENTATION
    The function copies given bind array to internal storage of the
    statement, and sets up typecode-specific handlers to perform
    serialization of bound data. This means that although you don't need
    to call this routine after each assignment to bind buffers, you
    need to call it each time you change parameter typecodes, or other
    members of MYSQL_BIND array.
    This is a pure local call. Data types of client buffers are sent
    along with buffers' data at first execution of the statement.

  RETURN
    0  success
    1  error, can be retrieved with mysql_stmt_error.
       Note, that this function doesn't check that size of MYSQL_BIND
       array is >= mysql_stmt_field_count(),
*/

my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
@@ -2971,10 +3123,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
  if (param->buffer_type < MYSQL_TYPE_TINY_BLOB ||
      param->buffer_type > MYSQL_TYPE_STRING)
  {
    /*
      Long data handling should be used only for string/binary
      types only
    */
    /* Long data handling should be used only for string/binary types */
    strmov(stmt->sqlstate, unknown_sqlstate);
    sprintf(stmt->last_error, ER(stmt->last_errno= CR_INVALID_BUFFER_USE),
	    param->param_number);
@@ -3277,7 +3426,8 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
    char buff[22];                              /* Enough for longlong */
    char *end= longlong10_to_str(value, buff, field_is_unsigned ? 10: -10);
    /* Resort to string conversion which supports all typecodes */
    return fetch_string_with_conversion(param, buff, end - buff);
    fetch_string_with_conversion(param, buff, end - buff);
    break;
  }
  }
}
@@ -3349,10 +3499,11 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
    }
    else
    {
      sprintf(buff, "%.*f", field->decimals, value);
      sprintf(buff, "%.*f", (int) field->decimals, value);
      end= strend(buff);
    }
    return fetch_string_with_conversion(param, buff, end - buff);
    fetch_string_with_conversion(param, buff, end - buff);
    break;
  }
  }
}
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ MaxNoOfConcurrentOperations: CHOOSE_MaxNoOfConcurrentOperations
DataMemory: CHOOSE_DataMemory
IndexMemory: CHOOSE_IndexMemory
Diskless: CHOOSE_Diskless
TimeBetweenWatchDogCheck: 30000

[COMPUTER]
Id: 1
+65 −7
Original line number Diff line number Diff line
@@ -90,16 +90,23 @@ insert into t1 values
('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
('10:20:10', '%H:%i:%s'),
('10:20:10', '%h:%i:%s.%f'),
('10:20:10', '%T'),
('10:20:10AM', '%h:%i:%s%p'),
('10:20:10AM', '%r'),
('10:20:10.44AM', '%h:%i:%s.%f%p'),
('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
('15 September 2001', '%d %M %Y'),
('15 SEPTEMB 2001', '%d %M %Y'),
('15 MAY 2001', '%d %b %Y'),
('15th May 2001', '%D %b %Y'),
('Sunday 15 MAY 2001', '%W %d %b %Y'),
('Sund 15 MAY 2001', '%W %d %b %Y'),
('Tuesday 00 2002', '%W %U %Y'),
('Thursday 53 1998', '%W %u %Y'),
('Sunday 01 2001', '%W %v %x'),
('Tuesday 52 2001', '%W %V %X'),
('060 2004', '%j %Y'),
('4 53 1998', '%w %u %Y'),
('15-01-2001', '%d-%m-%Y %H:%i:%S'),
('15-01-20', '%d-%m-%y'),
('15-2001-1', '%d-%Y-%c');
@@ -114,16 +121,23 @@ date format str_to_date
2003-01-02 11:11:12Pm	%Y-%m-%d %h:%i:%S%p	2003-01-02 23:11:12
10:20:10	%H:%i:%s	0000-00-00 10:20:10
10:20:10	%h:%i:%s.%f	0000-00-00 10:20:10
10:20:10	%T	0000-00-00 10:20:10
10:20:10AM	%h:%i:%s%p	0000-00-00 10:20:10
10:20:10AM	%r	0000-00-00 10:20:10
10:20:10.44AM	%h:%i:%s.%f%p	0000-00-00 10:20:10.440000
15-01-2001 12:59:58	%d-%m-%Y %H:%i:%S	2001-01-15 12:59:58
15 September 2001	%d %M %Y	2001-09-15 00:00:00
15 SEPTEMB 2001	%d %M %Y	2001-09-15 00:00:00
15 MAY 2001	%d %b %Y	2001-05-15 00:00:00
15th May 2001	%D %b %Y	2001-05-15 00:00:00
Sunday 15 MAY 2001	%W %d %b %Y	2001-05-15 00:00:00
Sund 15 MAY 2001	%W %d %b %Y	2001-05-15 00:00:00
Tuesday 00 2002	%W %U %Y	2002-01-01 00:00:00
Thursday 53 1998	%W %u %Y	1998-12-31 00:00:00
Sunday 01 2001	%W %v %x	2001-01-07 00:00:00
Tuesday 52 2001	%W %V %X	2002-01-01 00:00:00
060 2004	%j %Y	2004-02-29 00:00:00
4 53 1998	%w %u %Y	1998-12-31 00:00:00
15-01-2001	%d-%m-%Y %H:%i:%S	2001-01-15 00:00:00
15-01-20	%d-%m-%y	2020-01-15 00:00:00
15-2001-1	%d-%Y-%c	2001-01-15 00:00:00
@@ -138,16 +152,23 @@ date format con
2003-01-02 11:11:12Pm	%Y-%m-%d %h:%i:%S%p	2003-01-02 23:11:12
10:20:10	%H:%i:%s	0000-00-00 10:20:10
10:20:10	%h:%i:%s.%f	0000-00-00 10:20:10
10:20:10	%T	0000-00-00 10:20:10
10:20:10AM	%h:%i:%s%p	0000-00-00 10:20:10
10:20:10AM	%r	0000-00-00 10:20:10
10:20:10.44AM	%h:%i:%s.%f%p	0000-00-00 10:20:10.440000
15-01-2001 12:59:58	%d-%m-%Y %H:%i:%S	2001-01-15 12:59:58
15 September 2001	%d %M %Y	2001-09-15 00:00:00
15 SEPTEMB 2001	%d %M %Y	2001-09-15 00:00:00
15 MAY 2001	%d %b %Y	2001-05-15 00:00:00
15th May 2001	%D %b %Y	2001-05-15 00:00:00
Sunday 15 MAY 2001	%W %d %b %Y	2001-05-15 00:00:00
Sund 15 MAY 2001	%W %d %b %Y	2001-05-15 00:00:00
Tuesday 00 2002	%W %U %Y	2002-01-01 00:00:00
Thursday 53 1998	%W %u %Y	1998-12-31 00:00:00
Sunday 01 2001	%W %v %x	2001-01-07 00:00:00
Tuesday 52 2001	%W %V %X	2002-01-01 00:00:00
060 2004	%j %Y	2004-02-29 00:00:00
4 53 1998	%w %u %Y	1998-12-31 00:00:00
15-01-2001	%d-%m-%Y %H:%i:%S	2001-01-15 00:00:00
15-01-20	%d-%m-%y	2020-01-15 00:00:00
15-2001-1	%d-%Y-%c	2001-01-15 00:00:00
@@ -162,16 +183,23 @@ date format datetime
2003-01-02 11:11:12Pm	%Y-%m-%d %h:%i:%S%p	2003-01-02 23:11:12
10:20:10	%H:%i:%s	0000-00-00 10:20:10
10:20:10	%h:%i:%s.%f	0000-00-00 10:20:10
10:20:10	%T	0000-00-00 10:20:10
10:20:10AM	%h:%i:%s%p	0000-00-00 10:20:10
10:20:10AM	%r	0000-00-00 10:20:10
10:20:10.44AM	%h:%i:%s.%f%p	0000-00-00 10:20:10.440000
15-01-2001 12:59:58	%d-%m-%Y %H:%i:%S	2001-01-15 12:59:58
15 September 2001	%d %M %Y	2001-09-15 00:00:00
15 SEPTEMB 2001	%d %M %Y	2001-09-15 00:00:00
15 MAY 2001	%d %b %Y	2001-05-15 00:00:00
15th May 2001	%D %b %Y	2001-05-15 00:00:00
Sunday 15 MAY 2001	%W %d %b %Y	2001-05-15 00:00:00
Sund 15 MAY 2001	%W %d %b %Y	2001-05-15 00:00:00
Tuesday 00 2002	%W %U %Y	2002-01-01 00:00:00
Thursday 53 1998	%W %u %Y	1998-12-31 00:00:00
Sunday 01 2001	%W %v %x	2001-01-07 00:00:00
Tuesday 52 2001	%W %V %X	2002-01-01 00:00:00
060 2004	%j %Y	2004-02-29 00:00:00
4 53 1998	%w %u %Y	1998-12-31 00:00:00
15-01-2001	%d-%m-%Y %H:%i:%S	2001-01-15 00:00:00
15-01-20	%d-%m-%y	2020-01-15 00:00:00
15-2001-1	%d-%Y-%c	2001-01-15 00:00:00
@@ -186,16 +214,23 @@ date format date2
2003-01-02 11:11:12Pm	%Y-%m-%d %h:%i:%S%p	2003-01-02
10:20:10	%H:%i:%s	0000-00-00
10:20:10	%h:%i:%s.%f	0000-00-00
10:20:10	%T	0000-00-00
10:20:10AM	%h:%i:%s%p	0000-00-00
10:20:10AM	%r	0000-00-00
10:20:10.44AM	%h:%i:%s.%f%p	0000-00-00
15-01-2001 12:59:58	%d-%m-%Y %H:%i:%S	2001-01-15
15 September 2001	%d %M %Y	2001-09-15
15 SEPTEMB 2001	%d %M %Y	2001-09-15
15 MAY 2001	%d %b %Y	2001-05-15
15th May 2001	%D %b %Y	2001-05-15
Sunday 15 MAY 2001	%W %d %b %Y	2001-05-15
Sund 15 MAY 2001	%W %d %b %Y	2001-05-15
Tuesday 00 2002	%W %U %Y	2002-01-01
Thursday 53 1998	%W %u %Y	1998-12-31
Sunday 01 2001	%W %v %x	2001-01-07
Tuesday 52 2001	%W %V %X	2002-01-01
060 2004	%j %Y	2004-02-29
4 53 1998	%w %u %Y	1998-12-31
15-01-2001	%d-%m-%Y %H:%i:%S	2001-01-15
15-01-20	%d-%m-%y	2020-01-15
15-2001-1	%d-%Y-%c	2001-01-15
@@ -210,16 +245,23 @@ date format time
2003-01-02 11:11:12Pm	%Y-%m-%d %h:%i:%S%p	23:11:12
10:20:10	%H:%i:%s	10:20:10
10:20:10	%h:%i:%s.%f	10:20:10
10:20:10	%T	10:20:10
10:20:10AM	%h:%i:%s%p	10:20:10
10:20:10AM	%r	10:20:10
10:20:10.44AM	%h:%i:%s.%f%p	10:20:10.440000
15-01-2001 12:59:58	%d-%m-%Y %H:%i:%S	12:59:58
15 September 2001	%d %M %Y	00:00:00
15 SEPTEMB 2001	%d %M %Y	00:00:00
15 MAY 2001	%d %b %Y	00:00:00
15th May 2001	%D %b %Y	00:00:00
Sunday 15 MAY 2001	%W %d %b %Y	00:00:00
Sund 15 MAY 2001	%W %d %b %Y	00:00:00
Tuesday 00 2002	%W %U %Y	00:00:00
Thursday 53 1998	%W %u %Y	00:00:00
Sunday 01 2001	%W %v %x	00:00:00
Tuesday 52 2001	%W %V %X	00:00:00
060 2004	%j %Y	00:00:00
4 53 1998	%w %u %Y	00:00:00
15-01-2001	%d-%m-%Y %H:%i:%S	00:00:00
15-01-20	%d-%m-%y	00:00:00
15-2001-1	%d-%Y-%c	00:00:00
@@ -234,16 +276,23 @@ date format time2
2003-01-02 11:11:12Pm	%Y-%m-%d %h:%i:%S%p	23:11:12
10:20:10	%H:%i:%s	10:20:10
10:20:10	%h:%i:%s.%f	10:20:10
10:20:10	%T	10:20:10
10:20:10AM	%h:%i:%s%p	10:20:10
10:20:10AM	%r	10:20:10
10:20:10.44AM	%h:%i:%s.%f%p	10:20:10.440000
15-01-2001 12:59:58	%d-%m-%Y %H:%i:%S	12:59:58
15 September 2001	%d %M %Y	00:00:00
15 SEPTEMB 2001	%d %M %Y	00:00:00
15 MAY 2001	%d %b %Y	00:00:00
15th May 2001	%D %b %Y	00:00:00
Sunday 15 MAY 2001	%W %d %b %Y	00:00:00
Sund 15 MAY 2001	%W %d %b %Y	00:00:00
Tuesday 00 2002	%W %U %Y	00:00:00
Thursday 53 1998	%W %u %Y	00:00:00
Sunday 01 2001	%W %v %x	00:00:00
Tuesday 52 2001	%W %V %X	00:00:00
060 2004	%j %Y	00:00:00
4 53 1998	%w %u %Y	00:00:00
15-01-2001	%d-%m-%Y %H:%i:%S	00:00:00
15-01-20	%d-%m-%y	00:00:00
15-2001-1	%d-%Y-%c	00:00:00
@@ -258,10 +307,13 @@ insert into t1 values
('15 Septembei 2001', '%d %M %Y'),
('15 Ju 2001', '%d %M %Y'),
('Sund 15 MA', '%W %d %b %Y'),
('Sunday 01 2001', '%W %V %X'),
('Thursdai 12 1998', '%W %u %Y'),
(NULL, get_format(DATE,'USA')),
('Tuesday 52 2001', '%W %V %X');
('Sunday 01 2001', '%W %v %X'),
('Tuesday 52 2001', '%W %V %x'),
('Tuesday 52 2001', '%W %V %Y'),
('Tuesday 52 2001', '%W %u %x'),
('7 53 1998', '%w %u %Y'),
(NULL, get_format(DATE,'USA'));
select date,format,str_to_date(date, format) as str_to_date from t1;
date	format	str_to_date
2003-01-02 10:11:12 PM	%Y-%m-%d %H:%i:%S %p	NULL
@@ -273,10 +325,13 @@ date format str_to_date
15 Septembei 2001	%d %M %Y	NULL
15 Ju 2001	%d %M %Y	NULL
Sund 15 MA	%W %d %b %Y	NULL
Sunday 01 2001	%W %V %X	NULL
Thursdai 12 1998	%W %u %Y	NULL
Sunday 01 2001	%W %v %X	NULL
Tuesday 52 2001	%W %V %x	NULL
Tuesday 52 2001	%W %V %Y	NULL
Tuesday 52 2001	%W %u %x	NULL
7 53 1998	%w %u %Y	NULL
NULL	%m.%d.%Y	NULL
Tuesday 52 2001	%W %V %X	NULL
select date,format,concat(str_to_date(date, format),'') as con from t1;
date	format	con
2003-01-02 10:11:12 PM	%Y-%m-%d %H:%i:%S %p	NULL
@@ -288,10 +343,13 @@ date format con
15 Septembei 2001	%d %M %Y	NULL
15 Ju 2001	%d %M %Y	NULL
Sund 15 MA	%W %d %b %Y	NULL
Sunday 01 2001	%W %V %X	NULL
Thursdai 12 1998	%W %u %Y	NULL
Sunday 01 2001	%W %v %X	NULL
Tuesday 52 2001	%W %V %x	NULL
Tuesday 52 2001	%W %V %Y	NULL
Tuesday 52 2001	%W %u %x	NULL
7 53 1998	%w %u %Y	NULL
NULL	%m.%d.%Y	NULL
Tuesday 52 2001	%W %V %X	NULL
truncate table t1;
insert into t1 values
('10:20:10AM', '%h:%i:%s'),
Loading