mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
merge
sql/item.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_lex.cc: Auto merged sql/sql_prepare.cc: Auto merged
This commit is contained in:
commit
0f0ca5e35b
36 changed files with 594 additions and 499 deletions
13
BUILD/compile-pentium-debug-max-no-embedded
Executable file
13
BUILD/compile-pentium-debug-max-no-embedded
Executable file
|
@ -0,0 +1,13 @@
|
|||
#! /bin/sh
|
||||
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
extra_flags="$pentium_cflags $debug_cflags"
|
||||
c_warnings="$c_warnings $debug_extra_warnings"
|
||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||
extra_configs="$pentium_configs $debug_configs"
|
||||
|
||||
extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --with-openssl --with-raid"
|
||||
|
||||
. "$path/FINISH.sh"
|
|
@ -54,6 +54,7 @@ jani@janikt.pp.saunalahti.fi
|
|||
jani@rhols221.adsl.netsonic.fi
|
||||
jani@rhols221.arenanet.fi
|
||||
jani@ua126d19.elisa.omakaista.fi
|
||||
jani@ua141d10.elisa.omakaista.fi
|
||||
jani@ua167d18.elisa.omakaista.fi
|
||||
jcole@abel.spaceapes.com
|
||||
jcole@main.burghcom.com
|
||||
|
|
|
@ -839,7 +839,9 @@ static int get_options(int argc, char **argv)
|
|||
opt_reconnect= 0;
|
||||
connect_flag= 0; /* Not in interactive mode */
|
||||
}
|
||||
if (!(charset_info= get_charset_by_csname(default_charset,
|
||||
|
||||
if (strcmp(default_charset, charset_info->csname) &&
|
||||
!(charset_info= get_charset_by_csname(default_charset,
|
||||
MY_CS_PRIMARY, MYF(MY_WME))))
|
||||
exit(1);
|
||||
if (argc > 1)
|
||||
|
|
|
@ -311,7 +311,8 @@ static int get_options(int *argc, char ***argv)
|
|||
}
|
||||
|
||||
/* TODO: This variable is not yet used */
|
||||
if (!(charset_info= get_charset_by_csname(default_charset,
|
||||
if (strcmp(default_charset, charset_info->csname) &&
|
||||
!(charset_info= get_charset_by_csname(default_charset,
|
||||
MY_CS_PRIMARY, MYF(MY_WME))))
|
||||
exit(1);
|
||||
if (*argc > 0 && opt_alldbs)
|
||||
|
|
|
@ -536,7 +536,8 @@ static int get_options(int *argc, char ***argv)
|
|||
my_progname);
|
||||
return(1);
|
||||
}
|
||||
if (!(charset_info= get_charset_by_csname(default_charset,
|
||||
if (strcmp(default_charset, charset_info->csname) &&
|
||||
!(charset_info= get_charset_by_csname(default_charset,
|
||||
MY_CS_PRIMARY, MYF(MY_WME))))
|
||||
exit(1);
|
||||
if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs))
|
||||
|
@ -664,7 +665,7 @@ static char *quote_name(const char *name, char *buff, my_bool force)
|
|||
while (*name)
|
||||
{
|
||||
if (*name == QUOTE_CHAR)
|
||||
*to= QUOTE_CHAR;
|
||||
*to++= QUOTE_CHAR;
|
||||
*to++= *name++;
|
||||
}
|
||||
to[0]=QUOTE_CHAR;
|
||||
|
@ -1662,7 +1663,7 @@ static int dump_all_tables_in_db(char *database)
|
|||
if (opt_xml)
|
||||
fputs("</database>\n", md_result_file);
|
||||
if (lock_tables)
|
||||
mysql_query(sock,"UNLOCK_TABLES");
|
||||
mysql_query(sock,"UNLOCK TABLES");
|
||||
return 0;
|
||||
} /* dump_all_tables_in_db */
|
||||
|
||||
|
|
|
@ -238,7 +238,8 @@ static int get_options(int *argc, char ***argv)
|
|||
fprintf(stderr, "You can't use --ignore (-i) and --replace (-r) at the same time.\n");
|
||||
return(1);
|
||||
}
|
||||
if (!(charset_info= get_charset_by_csname(default_charset,
|
||||
if (strcmp(default_charset, charset_info->csname) &&
|
||||
!(charset_info= get_charset_by_csname(default_charset,
|
||||
MY_CS_PRIMARY, MYF(MY_WME))))
|
||||
exit(1);
|
||||
if (*argc < 2)
|
||||
|
|
|
@ -452,6 +452,9 @@ then
|
|||
FIND_PROC="$PS \$\$PID | grep mysqld > /dev/null"
|
||||
else
|
||||
case $SYSTEM_TYPE in
|
||||
*freebsd*)
|
||||
FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null"
|
||||
;;
|
||||
*darwin*)
|
||||
FIND_PROC="$PS -uaxww | grep mysqld | grep \" \$\$PID \" > /dev/null"
|
||||
;;
|
||||
|
|
|
@ -57,9 +57,6 @@ typedef int my_socket;
|
|||
#include "mysql_com.h"
|
||||
#include "mysql_version.h"
|
||||
#include "typelib.h"
|
||||
#ifndef DBUG_OFF
|
||||
#define CHECK_EXTRA_ARGUMENTS
|
||||
#endif
|
||||
|
||||
#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */
|
||||
|
||||
|
@ -575,6 +572,7 @@ typedef struct st_mysql_methods
|
|||
int (*unbuffered_fetch)(MYSQL *mysql, char **row);
|
||||
void (*free_embedded_thd)(MYSQL *mysql);
|
||||
const char *(*read_statistic)(MYSQL *mysql);
|
||||
int (*next_result)(MYSQL *mysql);
|
||||
#endif
|
||||
} MYSQL_METHODS;
|
||||
|
||||
|
|
|
@ -1653,14 +1653,6 @@ mysql_prepare(MYSQL *mysql, const char *query, ulong length)
|
|||
DBUG_ENTER("mysql_prepare");
|
||||
DBUG_ASSERT(mysql != 0);
|
||||
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (!query)
|
||||
{
|
||||
set_mysql_error(mysql, CR_NULL_POINTER, unknown_sqlstate);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(stmt= (MYSQL_STMT *) my_malloc(sizeof(MYSQL_STMT),
|
||||
MYF(MY_WME | MY_ZEROFILL))) ||
|
||||
!(stmt->query= my_strdup_with_length((byte *) query, length, MYF(0))))
|
||||
|
@ -2086,19 +2078,6 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt)
|
|||
{
|
||||
DBUG_ENTER("mysql_execute");
|
||||
|
||||
if (stmt->state == MY_ST_UNKNOWN)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (stmt->param_count && !stmt->param_buffers)
|
||||
{
|
||||
/* Parameters exists, but no bound buffers */
|
||||
set_stmt_error(stmt, CR_NOT_ALL_PARAMS_BOUND, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#endif
|
||||
if ((*stmt->mysql->methods->stmt_execute)(stmt))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
|
@ -2144,19 +2123,6 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
|
|||
MYSQL_BIND *param, *end;
|
||||
DBUG_ENTER("mysql_bind_param");
|
||||
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (stmt->state == MY_ST_UNKNOWN)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (!stmt->param_count)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NO_PARAMETERS_EXISTS, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Allocated on prepare */
|
||||
memcpy((char*) stmt->params, (char*) bind,
|
||||
sizeof(MYSQL_BIND) * stmt->param_count);
|
||||
|
@ -2279,11 +2245,6 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number,
|
|||
DBUG_PRINT("enter",("param no : %d, data : %lx, length : %ld",
|
||||
param_number, data, length));
|
||||
|
||||
if (param_number >= stmt->param_count)
|
||||
{
|
||||
set_stmt_error(stmt, CR_INVALID_PARAMETER_NO, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
param= stmt->params+param_number;
|
||||
if (param->buffer_type < MYSQL_TYPE_TINY_BLOB ||
|
||||
param->buffer_type > MYSQL_TYPE_STRING)
|
||||
|
@ -2853,18 +2814,6 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
|||
DBUG_ENTER("mysql_bind_result");
|
||||
DBUG_ASSERT(stmt != 0);
|
||||
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (stmt->state == MY_ST_UNKNOWN)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (!bind)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NULL_POINTER, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#endif
|
||||
if (!(bind_count= stmt->field_count) &&
|
||||
!(bind_count= alloc_stmt_fields(stmt)))
|
||||
DBUG_RETURN(0);
|
||||
|
@ -3035,6 +2984,15 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt)
|
|||
}
|
||||
else /* un-buffered */
|
||||
{
|
||||
if (mysql->status != MYSQL_STATUS_GET_RESULT)
|
||||
{
|
||||
if (!stmt->field_count)
|
||||
goto no_data;
|
||||
|
||||
set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
if((*mysql->methods->unbuffered_fetch)(mysql, ( char **)&row))
|
||||
{
|
||||
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
|
||||
|
@ -3065,7 +3023,7 @@ no_data:
|
|||
mysql_fetch_column()
|
||||
stmt Prepared statement handler
|
||||
bind Where data should be placed. Should be filled in as
|
||||
when calling mysql_bind_param()
|
||||
when calling mysql_bind_result()
|
||||
column Column to fetch (first column is 0)
|
||||
ulong offset Offset in result data (to fetch blob in pieces)
|
||||
This is normally 0
|
||||
|
@ -3083,14 +3041,6 @@ int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
|
|||
if (!stmt->current_row)
|
||||
goto no_data;
|
||||
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (column >= stmt->field_count)
|
||||
{
|
||||
set_stmt_errmsg(stmt, "Invalid column descriptor",1, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (param->null_field)
|
||||
{
|
||||
if (bind->is_null)
|
||||
|
@ -3510,7 +3460,6 @@ my_bool STDCALL mysql_more_results(MYSQL *mysql)
|
|||
/*
|
||||
Reads and returns the next query results
|
||||
*/
|
||||
|
||||
int STDCALL mysql_next_result(MYSQL *mysql)
|
||||
{
|
||||
DBUG_ENTER("mysql_next_result");
|
||||
|
@ -3529,8 +3478,8 @@ int STDCALL mysql_next_result(MYSQL *mysql)
|
|||
mysql->affected_rows= ~(my_ulonglong) 0;
|
||||
|
||||
if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS)
|
||||
DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
|
||||
|
||||
DBUG_RETURN((*mysql->methods->next_result)(mysql));
|
||||
|
||||
DBUG_RETURN(-1); /* No more results */
|
||||
}
|
||||
|
||||
|
|
|
@ -245,6 +245,18 @@ static MYSQL_RES * emb_mysql_store_result(MYSQL *mysql)
|
|||
return mysql_store_result(mysql);
|
||||
}
|
||||
|
||||
int emb_next_result(MYSQL *mysql)
|
||||
{
|
||||
THD *thd= (THD*)mysql->thd;
|
||||
DBUG_ENTER("emb_next_result");
|
||||
|
||||
if (emb_advanced_command(mysql, COM_QUERY,0,0,
|
||||
thd->query_rest,thd->query_rest_length,1)
|
||||
|| emb_mysql_read_query_result(mysql))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
DBUG_RETURN(0); /* No more results */
|
||||
}
|
||||
|
||||
MYSQL_METHODS embedded_methods=
|
||||
{
|
||||
|
@ -259,7 +271,8 @@ MYSQL_METHODS embedded_methods=
|
|||
emb_read_binary_rows,
|
||||
emb_unbuffered_fetch,
|
||||
emb_free_embedded_thd,
|
||||
emb_read_statistic
|
||||
emb_read_statistic,
|
||||
emb_next_result
|
||||
};
|
||||
|
||||
C_MODE_END
|
||||
|
@ -749,6 +762,11 @@ bool Protocol::net_store_data(const char *from, uint length)
|
|||
return false;
|
||||
}
|
||||
|
||||
char *memdup_mysql(struct st_mysql *mysql, const char*data, int length)
|
||||
{
|
||||
return memdup_root(&mysql->field_alloc, data, length);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* The same as Protocol::net_store_data but does the converstion
|
||||
*/
|
||||
|
|
|
@ -64,12 +64,6 @@ test
|
|||
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
|
||||
cast(_koi8r'ÔÅÓÔ' as char character set cp1251)
|
||||
òåñò
|
||||
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
|
||||
convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci")
|
||||
test
|
||||
select convert(_koi8r'ÔĹÓÔ', "koi8r_general_ci", "cp1251_general_ci");
|
||||
convert(_koi8r'ÔĹÓÔ', "koi8r_general_ci", "cp1251_general_ci")
|
||||
ňĺńň
|
||||
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
|
|
|
@ -340,129 +340,6 @@ CYR CAPIT SOFT SIGN
|
|||
CYR CAPIT E ü ü
|
||||
CYR CAPIT YU à à
|
||||
CYR CAPIT YA ñ ñ
|
||||
select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||
CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci') comment
|
||||
a LAT SMALL A
|
||||
b LAT SMALL B
|
||||
c LAT SMALL C
|
||||
d LAT SMALL D
|
||||
e LAT SMALL E
|
||||
f LAT SMALL F
|
||||
g LAT SMALL G
|
||||
h LAT SMALL H
|
||||
i LAT SMALL I
|
||||
j LAT SMALL J
|
||||
k LAT SMALL K
|
||||
l LAT SMALL L
|
||||
m LAT SMALL M
|
||||
n LAT SMALL N
|
||||
o LAT SMALL O
|
||||
p LAT SMALL P
|
||||
q LAT SMALL Q
|
||||
r LAT SMALL R
|
||||
s LAT SMALL S
|
||||
t LAT SMALL T
|
||||
u LAT SMALL U
|
||||
v LAT SMALL V
|
||||
w LAT SMALL W
|
||||
x LAT SMALL X
|
||||
y LAT SMALL Y
|
||||
z LAT SMALL Z
|
||||
A LAT CAPIT A
|
||||
B LAT CAPIT B
|
||||
C LAT CAPIT C
|
||||
D LAT CAPIT D
|
||||
E LAT CAPIT E
|
||||
F LAT CAPIT F
|
||||
G LAT CAPIT G
|
||||
H LAT CAPIT H
|
||||
I LAT CAPIT I
|
||||
J LAT CAPIT J
|
||||
K LAT CAPIT K
|
||||
L LAT CAPIT L
|
||||
M LAT CAPIT M
|
||||
N LAT CAPIT N
|
||||
O LAT CAPIT O
|
||||
P LAT CAPIT P
|
||||
Q LAT CAPIT Q
|
||||
R LAT CAPIT R
|
||||
S LAT CAPIT S
|
||||
T LAT CAPIT T
|
||||
U LAT CAPIT U
|
||||
V LAT CAPIT V
|
||||
W LAT CAPIT W
|
||||
X LAT CAPIT X
|
||||
Y LAT CAPIT Y
|
||||
Z LAT CAPIT Z
|
||||
â CYR SMALL A
|
||||
÷ CYR SMALL BE
|
||||
ţ CYR SMALL VE
|
||||
ú CYR SMALL GE
|
||||
ä CYR SMALL DE
|
||||
ĺ CYR SMALL IE
|
||||
? CYR SMALL IO
|
||||
ă CYR SMALL ZHE
|
||||
˙ CYR SMALL ZE
|
||||
ę CYR SMALL I
|
||||
ě CYR SMALL KA
|
||||
í CYR SMALL EL
|
||||
î CYR SMALL EM
|
||||
ď CYR SMALL EN
|
||||
đ CYR SMALL O
|
||||
ň CYR SMALL PE
|
||||
ô CYR SMALL ER
|
||||
ő CYR SMALL ES
|
||||
ć CYR SMALL TE
|
||||
č CYR SMALL U
|
||||
ö CYR SMALL EF
|
||||
é CYR SMALL HA
|
||||
ç CYR SMALL TSE
|
||||
ŕ CYR SMALL CHE
|
||||
ů CYR SMALL SHA
|
||||
ü CYR SMALL SCHA
|
||||
ń CYR SMALL HARD SIGN
|
||||
ý CYR SMALL YERU
|
||||
ű CYR SMALL SOFT SIGN
|
||||
ř CYR SMALL E
|
||||
á CYR SMALL YU
|
||||
ó CYR SMALL YA
|
||||
 CYR CAPIT A
|
||||
× CYR CAPIT BE
|
||||
Ţ CYR CAPIT VE
|
||||
Ú CYR CAPIT GE
|
||||
Ä CYR CAPIT DE
|
||||
Ĺ CYR CAPIT IE
|
||||
? CYR CAPIT IO
|
||||
Ă CYR CAPIT ZHE
|
||||
ß CYR CAPIT ZE
|
||||
Ę CYR CAPIT I
|
||||
Ě CYR CAPIT KA
|
||||
Í CYR CAPIT EL
|
||||
Î CYR CAPIT EM
|
||||
Ď CYR CAPIT EN
|
||||
Đ CYR CAPIT O
|
||||
Ň CYR CAPIT PE
|
||||
Ô CYR CAPIT ER
|
||||
Ő CYR CAPIT ES
|
||||
Ć CYR CAPIT TE
|
||||
Č CYR CAPIT U
|
||||
Ö CYR CAPIT EF
|
||||
É CYR CAPIT HA
|
||||
Ç CYR CAPIT TSE
|
||||
Ŕ CYR CAPIT CHE
|
||||
Ů CYR CAPIT SHA
|
||||
Ü CYR CAPIT SCHA
|
||||
Ń CYR CAPIT HARD SIGN
|
||||
Ý CYR CAPIT YERU
|
||||
Ű CYR CAPIT SOFT SIGN
|
||||
Ř CYR CAPIT E
|
||||
Á CYR CAPIT YU
|
||||
Ó CYR CAPIT YA
|
||||
explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 116
|
||||
Warnings:
|
||||
Note 1003 select high_priority convert(test.t1.koi8_ru_f,_latin1'utf8_general_ci',_latin1'cp1251_general_ci') AS `CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci')`,test.t1.comment AS `comment` from test.t1
|
||||
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
|
||||
UPDATE t1 SET bin_f=koi8_ru_f;
|
||||
SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
|
||||
|
|
|
@ -88,3 +88,82 @@ select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
|
|||
s1 hex(s1) char_length(s1) octet_length(s1)
|
||||
Á D0B0 1 2
|
||||
drop table t1;
|
||||
create table t1 (s1 tinytext character set utf8);
|
||||
insert into t1 select repeat('a',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('Ñ',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('aÑ',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('Ña',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('ÑÑ',300);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
|
||||
D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
|
||||
61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F
|
||||
D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61
|
||||
D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
|
||||
select length(s1),char_length(s1) from t1;
|
||||
length(s1) char_length(s1)
|
||||
255 255
|
||||
254 127
|
||||
255 170
|
||||
255 170
|
||||
254 127
|
||||
drop table t1;
|
||||
create table t1 (s1 text character set utf8);
|
||||
insert into t1 select repeat('a',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('Ñ',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('aÑ',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('Ña',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
insert into t1 select repeat('ÑÑ',66000);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select length(s1),char_length(s1) from t1;
|
||||
length(s1) char_length(s1)
|
||||
65535 65535
|
||||
65534 32767
|
||||
65535 43690
|
||||
65535 43690
|
||||
65534 32767
|
||||
drop table t1;
|
||||
create table t1 (s1 char(10) character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
41
|
||||
drop table t1;
|
||||
create table t1 (s1 varchar(10) character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
41
|
||||
drop table t1;
|
||||
create table t1 (s1 text character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
Warnings:
|
||||
Warning 1264 Data truncated for column 's1' at row 1
|
||||
select hex(s1) from t1;
|
||||
hex(s1)
|
||||
41
|
||||
drop table t1;
|
||||
|
|
|
@ -51,6 +51,20 @@ t1 CREATE TABLE `t1` (
|
|||
`version` char(40) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
|
||||
charset(charset(_utf8'a')) charset(collation(_utf8'a'))
|
||||
utf8 utf8
|
||||
select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
|
||||
collation(charset(_utf8'a')) collation(collation(_utf8'a'))
|
||||
utf8_general_ci utf8_general_ci
|
||||
create table t1 select charset(_utf8'a'), collation(_utf8'a');
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`charset(_utf8'a')` char(64) character set utf8 NOT NULL default '',
|
||||
`collation(_utf8'a')` char(64) character set utf8 NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select TRUE,FALSE,NULL;
|
||||
TRUE FALSE NULL
|
||||
1 0 NULL
|
||||
|
|
|
@ -179,3 +179,26 @@ UNLOCK TABLES;
|
|||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
|
||||
DROP TABLE t1;
|
||||
create table ```a` (i int);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||
DROP TABLE IF EXISTS ```a`;
|
||||
CREATE TABLE ``a` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE ```a` DISABLE KEYS */;
|
||||
LOCK TABLES ```a` WRITE;
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE ```a` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
|
||||
drop table ```a`;
|
||||
|
|
|
@ -28,8 +28,6 @@ select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
|
|||
set names binary;
|
||||
select cast(_latin1'test' as char character set latin2);
|
||||
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
|
||||
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
|
||||
select convert(_koi8r'ÔĹÓÔ', "koi8r_general_ci", "cp1251_general_ci");
|
||||
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -147,11 +147,6 @@ UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
|
|||
SET CHARACTER SET koi8r;
|
||||
SELECT * FROM t1;
|
||||
|
||||
#
|
||||
# codecovarage for Item_func_conv_charset3
|
||||
#
|
||||
select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||
explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||
|
||||
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
|
||||
UPDATE t1 SET bin_f=koi8_ru_f;
|
||||
|
|
|
@ -61,3 +61,40 @@ create table t1 (s1 char(1) character set utf8);
|
|||
insert into t1 values (_koi8r'ÁÂ');
|
||||
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (s1 tinytext character set utf8);
|
||||
insert into t1 select repeat('a',300);
|
||||
insert into t1 select repeat('Ñ',300);
|
||||
insert into t1 select repeat('aÑ',300);
|
||||
insert into t1 select repeat('Ña',300);
|
||||
insert into t1 select repeat('ÑÑ',300);
|
||||
select hex(s1) from t1;
|
||||
select length(s1),char_length(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (s1 text character set utf8);
|
||||
insert into t1 select repeat('a',66000);
|
||||
insert into t1 select repeat('Ñ',66000);
|
||||
insert into t1 select repeat('aÑ',66000);
|
||||
insert into t1 select repeat('Ña',66000);
|
||||
insert into t1 select repeat('ÑÑ',66000);
|
||||
select length(s1),char_length(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #2368 Multibyte charsets do not check that incoming data is well-formed
|
||||
#
|
||||
create table t1 (s1 char(10) character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
select hex(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (s1 varchar(10) character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
select hex(s1) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (s1 text character set utf8);
|
||||
insert into t1 values (0x41FF);
|
||||
select hex(s1) from t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -23,4 +23,10 @@ create table t1 (version char(40)) select database(), user(), version() as 'vers
|
|||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
|
||||
select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
|
||||
create table t1 select charset(_utf8'a'), collation(_utf8'a');
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
select TRUE,FALSE,NULL;
|
||||
|
|
|
@ -63,3 +63,11 @@ INSERT INTO t1 VALUES (1), (2);
|
|||
--exec $MYSQL_DUMP --skip-comments --compatible=mysql40 test t1
|
||||
--exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #2592 'mysqldum doesn't quote "tricky" names correctly'
|
||||
#
|
||||
|
||||
create table ```a` (i int);
|
||||
--exec $MYSQL_DUMP --skip-comments test
|
||||
drop table ```a`;
|
||||
|
|
32
sql/field.cc
32
sql/field.cc
|
@ -4485,19 +4485,9 @@ void Field_blob::store_length(uint32 number)
|
|||
{
|
||||
switch (packlength) {
|
||||
case 1:
|
||||
if (number > 255)
|
||||
{
|
||||
number=255;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||
}
|
||||
ptr[0]= (uchar) number;
|
||||
break;
|
||||
case 2:
|
||||
if (number > (uint16) ~0)
|
||||
{
|
||||
number= (uint16) ~0;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||
}
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (table->db_low_byte_first)
|
||||
{
|
||||
|
@ -4508,11 +4498,6 @@ void Field_blob::store_length(uint32 number)
|
|||
shortstore(ptr,(unsigned short) number);
|
||||
break;
|
||||
case 3:
|
||||
if (number > (uint32) (1L << 24))
|
||||
{
|
||||
number= (uint32) (1L << 24)-1L;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||
}
|
||||
int3store(ptr,number);
|
||||
break;
|
||||
case 4:
|
||||
|
@ -4573,6 +4558,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
bool was_conversion;
|
||||
char buff[80];
|
||||
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
||||
uint copy_length;
|
||||
uint32 not_used;
|
||||
|
||||
/* Convert character set if nesessary */
|
||||
|
@ -4583,12 +4569,22 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
from= tmpstr.ptr();
|
||||
length= tmpstr.length();
|
||||
}
|
||||
Field_blob::store_length(length);
|
||||
if (was_conversion || table->copy_blobs || length <= MAX_FIELD_WIDTH)
|
||||
|
||||
copy_length= max_data_length();
|
||||
if (copy_length > length)
|
||||
copy_length= length;
|
||||
copy_length= field_charset->cset->wellformedlen(field_charset,
|
||||
from,from+copy_length,
|
||||
field_length);
|
||||
if (copy_length < length)
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||
|
||||
Field_blob::store_length(copy_length);
|
||||
if (was_conversion || table->copy_blobs || copy_length <= MAX_FIELD_WIDTH)
|
||||
{ // Must make a copy
|
||||
if (from != value.ptr()) // For valgrind
|
||||
{
|
||||
value.copy(from,length,charset());
|
||||
value.copy(from,copy_length,charset());
|
||||
from=value.ptr();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -949,6 +949,15 @@ public:
|
|||
void sort_string(char *buff,uint length);
|
||||
uint32 pack_length() const
|
||||
{ return (uint32) (packlength+table->blob_ptr_size); }
|
||||
uint32 max_data_length() const
|
||||
{
|
||||
switch (packlength) {
|
||||
case 1: return 255;
|
||||
case 2: return (uint32) 0xFFFFL;
|
||||
case 3: return (uint32) 0xFFFFFF;
|
||||
default: return (uint32) 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
void reset(void) { bzero(ptr, packlength+sizeof(char*)); }
|
||||
void reset_fields() { bzero((char*) &value,sizeof(value)); }
|
||||
void store_length(uint32 number);
|
||||
|
|
|
@ -568,6 +568,8 @@ void Item_param::set_time(TIME *tm, timestamp_type type)
|
|||
|
||||
ltime.second_part= tm->second_part;
|
||||
|
||||
ltime.neg= tm->neg;
|
||||
|
||||
ltime.time_type= type;
|
||||
|
||||
item_is_time= true;
|
||||
|
|
|
@ -1552,7 +1552,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
if ((error=(uchar) init(&initid, &f_args, thd->net.last_error)))
|
||||
{
|
||||
my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0),
|
||||
u_d->name,thd->net.last_error);
|
||||
u_d->name.str, thd->net.last_error);
|
||||
free_udf(u_d);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
@ -1565,7 +1565,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
if (error)
|
||||
{
|
||||
my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0),
|
||||
u_d->name, ER(ER_UNKNOWN_ERROR));
|
||||
u_d->name.str, ER(ER_UNKNOWN_ERROR));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
|
|
@ -2124,42 +2124,6 @@ void Item_func_conv_charset::print(String *str)
|
|||
str->append(')');
|
||||
}
|
||||
|
||||
String *Item_func_conv_charset3::val_str(String *str)
|
||||
{
|
||||
char cs1[30], cs2[30];
|
||||
String to_cs_buff(cs1, sizeof(cs1), default_charset_info);
|
||||
String from_cs_buff(cs2, sizeof(cs2), default_charset_info);
|
||||
String *arg= args[0]->val_str(str);
|
||||
String *to_cs= args[1]->val_str(&to_cs_buff);
|
||||
String *from_cs= args[2]->val_str(&from_cs_buff);
|
||||
CHARSET_INFO *from_charset;
|
||||
CHARSET_INFO *to_charset;
|
||||
|
||||
if (!arg || args[0]->null_value ||
|
||||
!to_cs || args[1]->null_value ||
|
||||
!from_cs || args[2]->null_value ||
|
||||
!(from_charset=get_charset_by_name(from_cs->ptr(), MYF(MY_WME))) ||
|
||||
!(to_charset=get_charset_by_name(to_cs->ptr(), MYF(MY_WME))))
|
||||
{
|
||||
null_value= 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (str_value.copy(arg->ptr(), arg->length(), from_charset, to_charset))
|
||||
{
|
||||
null_value= 1;
|
||||
return 0;
|
||||
}
|
||||
null_value= 0;
|
||||
return &str_value;
|
||||
}
|
||||
|
||||
|
||||
void Item_func_conv_charset3::fix_length_and_dec()
|
||||
{
|
||||
max_length = args[0]->max_length;
|
||||
}
|
||||
|
||||
String *Item_func_set_collation::val_str(String *str)
|
||||
{
|
||||
str=args[0]->val_str(str);
|
||||
|
@ -2226,7 +2190,7 @@ String *Item_func_charset::val_str(String *str)
|
|||
if ((null_value=(args[0]->null_value || !res->charset())))
|
||||
return 0;
|
||||
str->copy(res->charset()->csname,strlen(res->charset()->csname),
|
||||
&my_charset_latin1, default_charset());
|
||||
&my_charset_latin1, collation.collation);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -2237,7 +2201,7 @@ String *Item_func_collation::val_str(String *str)
|
|||
if ((null_value=(args[0]->null_value || !res->charset())))
|
||||
return 0;
|
||||
str->copy(res->charset()->name,strlen(res->charset()->name),
|
||||
&my_charset_latin1, default_charset());
|
||||
&my_charset_latin1, collation.collation);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
|
@ -619,16 +619,6 @@ public:
|
|||
void print(String *str) { print_op(str); }
|
||||
};
|
||||
|
||||
class Item_func_conv_charset3 :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_conv_charset3(Item *arg1,Item *arg2,Item *arg3)
|
||||
:Item_str_func(arg1,arg2,arg3) {}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "convert"; }
|
||||
};
|
||||
|
||||
class Item_func_charset :public Item_str_func
|
||||
{
|
||||
public:
|
||||
|
@ -637,8 +627,8 @@ public:
|
|||
const char *func_name() const { return "charset"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
max_length=40; // should be enough
|
||||
collation.set(system_charset_info);
|
||||
max_length= 64 * collation.collation->mbmaxlen; // should be enough
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -650,8 +640,8 @@ public:
|
|||
const char *func_name() const { return "collation"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
max_length=40; // should be enough
|
||||
collation.set(system_charset_info);
|
||||
max_length= 64 * collation.collation->mbmaxlen; // should be enough
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -313,6 +313,7 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */
|
||||
|
||||
/*
|
||||
Send eof (= end of result set) to the client
|
||||
|
@ -339,12 +340,11 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
|
|||
void
|
||||
send_eof(THD *thd, bool no_flush)
|
||||
{
|
||||
static char eof_buff[1]= { (char) 254 }; /* Marker for end of fields */
|
||||
NET *net= &thd->net;
|
||||
DBUG_ENTER("send_eof");
|
||||
if (net->vio != 0)
|
||||
{
|
||||
if (!no_flush && (thd->client_capabilities & CLIENT_PROTOCOL_41))
|
||||
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
|
||||
{
|
||||
uchar buff[5];
|
||||
uint tmp= min(thd->total_warn_count, 65535);
|
||||
|
@ -384,9 +384,8 @@ send_eof(THD *thd, bool no_flush)
|
|||
|
||||
bool send_old_password_request(THD *thd)
|
||||
{
|
||||
static char buff[1]= { (char) 254 };
|
||||
NET *net= &thd->net;
|
||||
return my_net_write(net, buff, 1) || net_flush(net);
|
||||
return my_net_write(net, eof_buff, 1) || net_flush(net);
|
||||
}
|
||||
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
@ -585,7 +584,7 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
|
|||
#endif
|
||||
}
|
||||
|
||||
send_eof(thd, 1);
|
||||
my_net_write(&thd->net, eof_buff, 1);
|
||||
DBUG_RETURN(prepare_for_send(list));
|
||||
|
||||
err:
|
||||
|
|
|
@ -695,7 +695,6 @@ struct show_var_st init_vars[]= {
|
|||
{"port", (char*) &mysqld_port, SHOW_INT},
|
||||
{"protocol_version", (char*) &protocol_version, SHOW_INT},
|
||||
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
|
||||
{sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS},
|
||||
{sys_query_alloc_block_size.name, (char*) &sys_query_alloc_block_size,
|
||||
SHOW_SYS},
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
|
|
|
@ -591,6 +591,8 @@ public:
|
|||
struct st_mysql_bind *client_params;
|
||||
char *extra_data;
|
||||
ulong extra_length;
|
||||
char *query_rest;
|
||||
uint32 query_rest_length;
|
||||
#endif
|
||||
NET net; // client connection descriptor
|
||||
MEM_ROOT warn_root; // For warnings and errors
|
||||
|
|
|
@ -193,6 +193,13 @@ static LEX_STRING get_token(LEX *lex,uint length)
|
|||
return tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
todo:
|
||||
There are no dangerous charsets in mysql for function
|
||||
get_quoted_token yet. But it should be fixed in the
|
||||
future to operate multichar strings (like ucs2)
|
||||
*/
|
||||
|
||||
static LEX_STRING get_quoted_token(LEX *lex,uint length, char quote)
|
||||
{
|
||||
LEX_STRING tmp;
|
||||
|
@ -667,32 +674,17 @@ int yylex(void *arg, void *yythd)
|
|||
|
||||
case MY_LEX_USER_VARIABLE_DELIMITER:
|
||||
{
|
||||
char delim= c; // Used char
|
||||
uint double_quotes= 0;
|
||||
char quote_char= c; // Used char
|
||||
lex->tok_start=lex->ptr; // Skip first `
|
||||
while ((c=yyGet()))
|
||||
{
|
||||
#ifdef USE_MB
|
||||
if (use_mb(cs))
|
||||
{
|
||||
while ((c=yyGet()) && c != delim && c != (uchar) NAMES_SEP_CHAR)
|
||||
{
|
||||
if (my_mbcharlen(cs, c) > 1)
|
||||
{
|
||||
int l;
|
||||
if ((l = my_ismbchar(cs,
|
||||
(const char *)lex->ptr-1,
|
||||
(const char *)lex->end_of_query)) == 0)
|
||||
break;
|
||||
lex->ptr += l-1;
|
||||
}
|
||||
}
|
||||
yylval->lex_str=get_token(lex,yyLength());
|
||||
}
|
||||
else
|
||||
if (my_mbcharlen(cs, c) == 1)
|
||||
#endif
|
||||
{
|
||||
uint double_quotes= 0;
|
||||
char quote_char= c;
|
||||
while ((c=yyGet()))
|
||||
{
|
||||
if (c == (uchar) NAMES_SEP_CHAR)
|
||||
break; /* Old .frm format can't handle this char */
|
||||
if (c == quote_char)
|
||||
{
|
||||
if (yyPeek() != quote_char)
|
||||
|
@ -701,16 +693,25 @@ int yylex(void *arg, void *yythd)
|
|||
double_quotes++;
|
||||
continue;
|
||||
}
|
||||
if (c == (uchar) NAMES_SEP_CHAR)
|
||||
break;
|
||||
}
|
||||
if (double_quotes)
|
||||
yylval->lex_str=get_quoted_token(lex,yyLength() - double_quotes,
|
||||
quote_char);
|
||||
#ifdef USE_MB
|
||||
else
|
||||
yylval->lex_str=get_token(lex,yyLength());
|
||||
{
|
||||
int l;
|
||||
if ((l = my_ismbchar(cs,
|
||||
(const char *)lex->ptr-1,
|
||||
(const char *)lex->end_of_query)) == 0)
|
||||
break;
|
||||
lex->ptr += l-1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (c == delim)
|
||||
if (double_quotes)
|
||||
yylval->lex_str=get_quoted_token(lex,yyLength() - double_quotes,
|
||||
quote_char);
|
||||
else
|
||||
yylval->lex_str=get_token(lex,yyLength());
|
||||
if (c == quote_char)
|
||||
yySkip(); // Skip end `
|
||||
lex->next_state= MY_LEX_START;
|
||||
return(IDENT_QUOTED);
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
extern "C" int gethostname(char *name, int namelen);
|
||||
#endif
|
||||
|
||||
char *memdup_mysql(struct st_mysql *mysql, const char*data, int length);
|
||||
static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
|
||||
static void decrease_user_connections(USER_CONN *uc);
|
||||
static bool check_db_used(THD *thd,TABLE_LIST *tables);
|
||||
|
@ -1397,11 +1398,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
char *packet= thd->lex->found_colon;
|
||||
/*
|
||||
Multiple queries exits, execute them individually
|
||||
in embedded server - just store them to be executed later
|
||||
*/
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (thd->lock || thd->open_tables || thd->derived_tables)
|
||||
close_thread_tables(thd);
|
||||
|
||||
ulong length= thd->query_length-(ulong)(thd->lex->found_colon-thd->query);
|
||||
#endif
|
||||
ulong length= thd->query_length-(ulong)(packet-thd->query);
|
||||
|
||||
/* Remove garbage at start of query */
|
||||
while (my_isspace(thd->charset(), *packet) && length > 0)
|
||||
|
@ -1414,7 +1417,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_id= query_id++;
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
mysql_parse(thd, packet, length);
|
||||
#else
|
||||
thd->query_rest= (char*)memdup_mysql(thd->mysql, packet, length);
|
||||
thd->query_rest_length= length;
|
||||
break;
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
}
|
||||
|
||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||
|
@ -3845,7 +3854,23 @@ mysql_parse(THD *thd, char *inBuf, uint length)
|
|||
if (query_cache_send_result_to_client(thd, inBuf, length) <= 0)
|
||||
{
|
||||
LEX *lex=lex_start(thd, (uchar*) inBuf, length);
|
||||
if (!yyparse((void *)thd) && ! thd->is_fatal_error)
|
||||
if (!yyparse((void *)thd) && ! thd->is_fatal_error &&
|
||||
/*
|
||||
If this is not a multiple query, ensure that it has been
|
||||
successfully parsed until the last character. This is to prevent
|
||||
against a wrong (too big) length passed to mysql_real_query(),
|
||||
mysql_prepare()... which can generate garbage characters at the
|
||||
end. If the query was initially multiple, found_colon will be false
|
||||
only when we are in the last query; this last query had already
|
||||
been end-spaces-stripped by alloc_query() in dispatch_command(); as
|
||||
end spaces are the only thing we accept at the end of a query, and
|
||||
they have been stripped already, here we can require that nothing
|
||||
remains after parsing.
|
||||
*/
|
||||
(thd->lex->found_colon ||
|
||||
(char*)(thd->lex->ptr) == (thd->query+thd->query_length+1) ||
|
||||
/* yyerror() will show the garbage chars to the user */
|
||||
(yyerror("syntax error"), 0)))
|
||||
{
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (mqh_used && thd->user_connect &&
|
||||
|
|
|
@ -926,7 +926,15 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length)
|
|||
lex->safe_to_cache_query= 0;
|
||||
lex->param_count= 0;
|
||||
|
||||
if (yyparse((void *)thd) || thd->is_fatal_error || send_prepare_results(stmt))
|
||||
if (yyparse((void *)thd) || thd->is_fatal_error ||
|
||||
/*
|
||||
Check for wrong (too big) length passed to mysql_prepare() resulting in
|
||||
garbage at the end of the query. There is a similar check in mysql_parse().
|
||||
*/
|
||||
(!thd->lex->found_colon &&
|
||||
(char*)(thd->lex->ptr) != (thd->query+thd->query_length+1) &&
|
||||
/* yyerror() will show the garbage chars to the user */
|
||||
(yyerror("syntax error"), 1)) || send_prepare_results(stmt))
|
||||
goto yyparse_err;
|
||||
|
||||
lex_end(lex);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <my_sys.h>
|
||||
#include <m_string.h>
|
||||
#include <m_ctype.h>
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_FCONVERT
|
||||
#include <floatingpoint.h>
|
||||
#endif
|
||||
|
|
|
@ -2574,8 +2574,6 @@ simple_expr:
|
|||
}
|
||||
| CONVERT_SYM '(' expr USING charset_name ')'
|
||||
{ $$= new Item_func_conv_charset($3,$5); }
|
||||
| CONVERT_SYM '(' expr ',' expr ',' expr ')'
|
||||
{ $$= new Item_func_conv_charset3($3,$7,$5); }
|
||||
| DEFAULT '(' simple_ident ')'
|
||||
{ $$= new Item_default_value($3); }
|
||||
| VALUES '(' simple_ident ')'
|
||||
|
|
|
@ -274,18 +274,21 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
|
|||
return pos ? e+2-b0 : b-b0;
|
||||
}
|
||||
|
||||
uint my_wellformedlen_mb(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *b, const char *e, uint pos)
|
||||
uint my_wellformedlen_mb(CHARSET_INFO *cs,
|
||||
const char *b, const char *e, uint pos)
|
||||
{
|
||||
uint mblen;
|
||||
const char *b0=b;
|
||||
my_wc_t wc;
|
||||
int mblen;
|
||||
const char *b0= b;
|
||||
|
||||
while (pos && b<e)
|
||||
while (pos)
|
||||
{
|
||||
b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
|
||||
if ((mblen= cs->cset->mb_wc(cs, &wc, b, e)) <0)
|
||||
break;
|
||||
b+= mblen;
|
||||
pos--;
|
||||
}
|
||||
return b-b0;
|
||||
return b - b0;
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue