mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Conflict resolution
include/my_sys.h: Auto merged sql/handler.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/mysqld.cc: Manual merge
This commit is contained in:
commit
5742bdf609
127 changed files with 3446 additions and 1179 deletions
|
@ -3,7 +3,7 @@
|
|||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
extra_flags="$pentium_cflags $debug_cflags -USAFEMALLOC -DHAVE_purify"
|
||||
extra_flags="$pentium_cflags $debug_cflags -USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify"
|
||||
c_warnings="$c_warnings $debug_extra_warnings"
|
||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||
extra_configs="$pentium_configs $debug_configs"
|
||||
|
|
|
@ -868,9 +868,9 @@ AC_SUBST(orbit_idl)
|
|||
|
||||
AC_DEFUN([MYSQL_CHECK_ISAM], [
|
||||
AC_ARG_WITH([isam], [
|
||||
--without-isam Disable the ISAM table type],
|
||||
--with-isam Enable the ISAM table type],
|
||||
[with_isam="$withval"],
|
||||
[with_isam=yes])
|
||||
[with_isam=no])
|
||||
|
||||
isam_libs=
|
||||
if test X"$with_isam" = X"yes"
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "mysql.h"
|
||||
#include <m_string.h>
|
||||
#include <m_ctype.h>
|
||||
#include <dbug.h>
|
||||
|
||||
#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE)
|
||||
#undef HAVE_GETPASS
|
||||
|
|
|
@ -1085,7 +1085,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
|||
out=line;
|
||||
}
|
||||
}
|
||||
else if (*ml_comment && !*in_string && inchar == '*' && *(pos+1) == '/')
|
||||
else if (*ml_comment && inchar == '*' && *(pos + 1) == '/')
|
||||
{
|
||||
pos++;
|
||||
*ml_comment= 0;
|
||||
|
@ -1093,11 +1093,12 @@ static bool add_line(String &buffer,char *line,char *in_string,
|
|||
else
|
||||
{ // Add found char to buffer
|
||||
if (inchar == *in_string)
|
||||
*in_string=0;
|
||||
else if (!*in_string && (inchar == '\'' || inchar == '"' || inchar == '`'))
|
||||
*in_string=(char) inchar;
|
||||
if (!(*ml_comment))
|
||||
*out++ = (char) inchar;
|
||||
*in_string= 0;
|
||||
else if (!*ml_comment && !*in_string &&
|
||||
(inchar == '\'' || inchar == '"' || inchar == '`'))
|
||||
*in_string= (char) inchar;
|
||||
if (!*ml_comment)
|
||||
*out++= (char) inchar;
|
||||
}
|
||||
}
|
||||
if (out != line || !buffer.is_empty())
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
**********************************************************************/
|
||||
|
||||
#define MTEST_VERSION "1.28"
|
||||
#define MTEST_VERSION "1.29"
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysql_embed.h>
|
||||
|
@ -64,8 +64,9 @@
|
|||
#include <violite.h>
|
||||
|
||||
#define MAX_QUERY 65536
|
||||
#define MAX_COLUMNS 256
|
||||
#define PAD_SIZE 128
|
||||
#define MAX_CONS 1024
|
||||
#define MAX_CONS 128
|
||||
#define MAX_INCLUDE_DEPTH 16
|
||||
#define LAZY_GUESS_BUF_SIZE 8192
|
||||
#define INIT_Q_LINES 1024
|
||||
|
@ -192,7 +193,7 @@ Q_SYNC_WITH_MASTER,
|
|||
Q_SYNC_SLAVE_WITH_MASTER,
|
||||
Q_ERROR,
|
||||
Q_SEND, Q_REAP,
|
||||
Q_DIRTY_CLOSE, Q_REPLACE,
|
||||
Q_DIRTY_CLOSE, Q_REPLACE, Q_REPLACE_COLUMN,
|
||||
Q_PING, Q_EVAL,
|
||||
Q_RPL_PROBE, Q_ENABLE_RPL_PARSE,
|
||||
Q_DISABLE_RPL_PARSE, Q_EVAL_RESULT,
|
||||
|
@ -246,6 +247,7 @@ const char *command_names[]=
|
|||
"reap",
|
||||
"dirty_close",
|
||||
"replace_result",
|
||||
"replace_column",
|
||||
"ping",
|
||||
"eval",
|
||||
"rpl_probe",
|
||||
|
@ -290,7 +292,7 @@ VAR* var_get(const char *var_name, const char** var_name_end, my_bool raw,
|
|||
int eval_expr(VAR* v, const char *p, const char** p_end);
|
||||
static int read_server_arguments(const char *name);
|
||||
|
||||
/* Definitions for replace */
|
||||
/* Definitions for replace result */
|
||||
|
||||
typedef struct st_pointer_array { /* when using array-strings */
|
||||
TYPELIB typelib; /* Pointer to strings */
|
||||
|
@ -318,6 +320,13 @@ static char *out_buff;
|
|||
static uint out_length;
|
||||
static int eval_result = 0;
|
||||
|
||||
/* For column replace */
|
||||
char *replace_column[MAX_COLUMNS];
|
||||
uint max_replace_column= 0;
|
||||
|
||||
static void get_replace_column(struct st_query *q);
|
||||
static void free_replace_column();
|
||||
|
||||
/* Disable functions that only exist in MySQL 4.0 */
|
||||
#if MYSQL_VERSION_ID < 40000 || defined(EMBEDDED_LIBRARY)
|
||||
void mysql_enable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
|
||||
|
@ -338,7 +347,6 @@ static const char *embedded_server_groups[] = {
|
|||
NullS
|
||||
};
|
||||
|
||||
|
||||
static void do_eval(DYNAMIC_STRING* query_eval, const char* query)
|
||||
{
|
||||
const char* p;
|
||||
|
@ -433,6 +441,7 @@ static void free_used_memory()
|
|||
delete_dynamic(&q_lines);
|
||||
dynstr_free(&ds_res);
|
||||
free_replace();
|
||||
free_replace_column();
|
||||
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
|
||||
free_defaults(default_argv);
|
||||
mysql_server_end();
|
||||
|
@ -2048,27 +2057,35 @@ static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
|
|||
dynstr_append_mem(ds, val, len);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Append all results to the dynamic string separated with '\t'
|
||||
Values may be converted with 'replace_column'
|
||||
*/
|
||||
|
||||
static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
int num_fields= mysql_num_fields(res);
|
||||
uint num_fields= mysql_num_fields(res);
|
||||
unsigned long *lengths;
|
||||
while ((row = mysql_fetch_row(res)))
|
||||
{
|
||||
int i;
|
||||
uint i;
|
||||
lengths = mysql_fetch_lengths(res);
|
||||
for (i = 0; i < num_fields; i++)
|
||||
{
|
||||
const char *val= row[i];
|
||||
ulonglong len= lengths[i];
|
||||
|
||||
if (i < max_replace_column && replace_column[i])
|
||||
{
|
||||
val= replace_column[i];
|
||||
len= strlen(val);
|
||||
}
|
||||
if (!val)
|
||||
{
|
||||
val = "NULL";
|
||||
len = 4;
|
||||
val= "NULL";
|
||||
len= 4;
|
||||
}
|
||||
if (i)
|
||||
dynstr_append_mem(ds, "\t", 1);
|
||||
|
@ -2076,6 +2093,7 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
|
|||
}
|
||||
dynstr_append_mem(ds, "\n", 1);
|
||||
}
|
||||
free_replace_column();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2539,6 +2557,9 @@ int main(int argc, char **argv)
|
|||
case Q_REPLACE:
|
||||
get_replace(q);
|
||||
break;
|
||||
case Q_REPLACE_COLUMN:
|
||||
get_replace_column(q);
|
||||
break;
|
||||
case Q_SAVE_MASTER_POS: do_save_master_pos(); break;
|
||||
case Q_SYNC_WITH_MASTER: do_sync_with_master(q); break;
|
||||
case Q_SYNC_SLAVE_WITH_MASTER:
|
||||
|
@ -3357,3 +3378,60 @@ static void free_replace_buffer(void)
|
|||
{
|
||||
my_free(out_buff,MYF(MY_WME));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Replace results for a column
|
||||
*****************************************************************************/
|
||||
|
||||
static void free_replace_column()
|
||||
{
|
||||
uint i;
|
||||
for (i=0 ; i < max_replace_column ; i++)
|
||||
{
|
||||
if (replace_column[i])
|
||||
{
|
||||
my_free(replace_column[i], 0);
|
||||
replace_column[i]= 0;
|
||||
}
|
||||
}
|
||||
max_replace_column= 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Get arguments for replace_columns. The syntax is:
|
||||
replace-column column_number to_string [column_number to_string ...]
|
||||
Where each argument may be quoted with ' or "
|
||||
A argument may also be a variable, in which case the value of the
|
||||
variable is replaced.
|
||||
*/
|
||||
|
||||
static void get_replace_column(struct st_query *q)
|
||||
{
|
||||
char *from=q->first_argument;
|
||||
char *buff,*start;
|
||||
DBUG_ENTER("get_replace_columns");
|
||||
|
||||
free_replace_column();
|
||||
if (!*from)
|
||||
die("Missing argument in %s\n", q->query);
|
||||
|
||||
/* Allocate a buffer for results */
|
||||
start=buff=my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE));
|
||||
while (*from)
|
||||
{
|
||||
char *to;
|
||||
uint column_number;
|
||||
|
||||
to= get_string(&buff, &from, q);
|
||||
if (!(column_number= atoi(to)) || column_number > MAX_COLUMNS)
|
||||
die("Wrong column number to replace_columns in %s\n", q->query);
|
||||
if (!*from)
|
||||
die("Wrong number of arguments to replace in %s\n", q->query);
|
||||
to= get_string(&buff, &from, q);
|
||||
my_free(replace_column[column_number-1], MY_ALLOW_ZERO_PTR);
|
||||
replace_column[column_number-1]= my_strdup(to, MYF(MY_WME | MY_FAE));
|
||||
set_if_bigger(max_replace_column, column_number);
|
||||
}
|
||||
my_free(start, MYF(0));
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ extern int handle_options (int *argc, char ***argv,
|
|||
char *));
|
||||
extern void my_print_help(const struct my_option *options);
|
||||
extern void my_print_variables(const struct my_option *options);
|
||||
extern void my_getopt_register_get_addr(gptr* (*func_addr)(char *, uint,
|
||||
extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
|
||||
const struct my_option *));
|
||||
|
||||
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp);
|
||||
|
|
|
@ -503,6 +503,12 @@ my_off_t my_b_append_tell(IO_CACHE* info);
|
|||
#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \
|
||||
*(info)->current_pos)
|
||||
|
||||
/* key_cache_variables */
|
||||
typedef struct st_keycache
|
||||
{
|
||||
ulonglong size;
|
||||
} KEY_CACHE;
|
||||
|
||||
#include <my_alloc.h>
|
||||
|
||||
/* Prototypes for mysys and my_func functions */
|
||||
|
|
|
@ -566,6 +566,7 @@ unsigned long STDCALL mysql_param_count(MYSQL_STMT * stmt);
|
|||
my_bool STDCALL mysql_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
|
||||
my_bool STDCALL mysql_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
|
||||
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
|
||||
my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt);
|
||||
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
|
||||
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
|
||||
const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
|
||||
|
|
|
@ -44,6 +44,7 @@ enum enum_server_command
|
|||
COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP,
|
||||
COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
|
||||
COM_PREPARE, COM_EXECUTE, COM_LONG_DATA, COM_CLOSE_STMT,
|
||||
COM_RESET_STMT,
|
||||
COM_END /* Must be last */
|
||||
};
|
||||
|
||||
|
|
|
@ -286,4 +286,5 @@
|
|||
#define ER_REVOKE_GRANTS 1267
|
||||
#define ER_CANT_AGGREGATE_3COLLATIONS 1268
|
||||
#define ER_CANT_AGGREGATE_NCOLLATIONS 1269
|
||||
#define ER_ERROR_MESSAGES 270
|
||||
#define ER_VARIABLE_IS_NOT_STRUCT 1270
|
||||
#define ER_ERROR_MESSAGES 271
|
||||
|
|
|
@ -36,8 +36,8 @@ ER_CON_COUNT_ERROR, "08004", "",
|
|||
ER_BAD_HOST_ERROR, "08S01", "",
|
||||
ER_HANDSHAKE_ERROR, "08S01", "",
|
||||
ER_DBACCESS_DENIED_ERROR, "42000", "",
|
||||
ER_ACCESS_DENIED_ERROR, "42000", "28000",
|
||||
ER_NO_DB_ERROR, "42000", "",
|
||||
ER_ACCESS_DENIED_ERROR, "28000", "",
|
||||
ER_NO_DB_ERROR, "3D000", "",
|
||||
ER_UNKNOWN_COM_ERROR, "08S01", "",
|
||||
ER_BAD_NULL_ERROR, "23000", "",
|
||||
ER_BAD_DB_ERROR, "42000", "",
|
||||
|
@ -68,7 +68,7 @@ ER_BLOB_USED_AS_KEY, "42000", "S1009",
|
|||
ER_TOO_BIG_FIELDLENGTH, "42000", "S1009",
|
||||
ER_WRONG_AUTO_KEY, "42000", "S1009",
|
||||
ER_FORCING_CLOSE, "08S01", "",
|
||||
ER_IPSOCK_ERROR, "088S01", "",
|
||||
ER_IPSOCK_ERROR, "08S01", "",
|
||||
ER_NO_SUCH_INDEX, "42S12", "S1009",
|
||||
ER_WRONG_FIELD_TERMINATORS, "42000", "S1009",
|
||||
ER_BLOBS_AND_NO_TERMINATED, "42000", "S1009",
|
||||
|
|
|
@ -3316,6 +3316,7 @@ mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong row)
|
|||
}
|
||||
else
|
||||
DBUG_PRINT("exit", ("stmt doesn't contain any resultset"));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3421,6 +3422,28 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
|
|||
return stmt_close(stmt, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
Reset the statement buffers in server
|
||||
*/
|
||||
|
||||
my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
|
||||
{
|
||||
char buff[MYSQL_STMT_HEADER];
|
||||
MYSQL *mysql;
|
||||
DBUG_ENTER("mysql_stmt_reset");
|
||||
DBUG_ASSERT(stmt != 0);
|
||||
|
||||
mysql= stmt->mysql->last_used_con;
|
||||
int4store(buff, stmt->stmt_id); /* Send stmt id to server */
|
||||
if (advanced_command(mysql, COM_RESET_STMT,buff,MYSQL_STMT_HEADER,0,0,1))
|
||||
{
|
||||
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
|
||||
mysql->net.sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/*
|
||||
Return statement error code
|
||||
*/
|
||||
|
|
|
@ -98,6 +98,7 @@ EXPORTS
|
|||
mysql_stat
|
||||
mysql_stmt_affected_rows
|
||||
mysql_stmt_close
|
||||
mysql_stmt_reset
|
||||
mysql_stmt_data_seek
|
||||
mysql_stmt_errno
|
||||
mysql_stmt_error
|
||||
|
|
|
@ -281,3 +281,42 @@ ALTER TABLE t1 DISABLE KEYS;
|
|||
INSERT DELAYED INTO t1 VALUES(1),(2),(3);
|
||||
ALTER TABLE t1 ENABLE KEYS;
|
||||
drop table t1;
|
||||
set names koi8r;
|
||||
create table t1 (a char(10) character set koi8r);
|
||||
insert into t1 values ('ÔÅÓÔ');
|
||||
select a,hex(a) from t1;
|
||||
a hex(a)
|
||||
ÔÅÓÔ D4C5D3D4
|
||||
alter table t1 change a a char(10) character set cp1251;
|
||||
select a,hex(a) from t1;
|
||||
a hex(a)
|
||||
ÔÅÓÔ F2E5F1F2
|
||||
alter table t1 change a a char(10) binary;
|
||||
select a,hex(a) from t1;
|
||||
a hex(a)
|
||||
òåñò F2E5F1F2
|
||||
alter table t1 change a a char(10) character set cp1251;
|
||||
select a,hex(a) from t1;
|
||||
a hex(a)
|
||||
ÔÅÓÔ F2E5F1F2
|
||||
alter table t1 change a a char(10) character set koi8r;
|
||||
select a,hex(a) from t1;
|
||||
a hex(a)
|
||||
ÔÅÓÔ D4C5D3D4
|
||||
alter table t1 change a a varchar(10) character set cp1251;
|
||||
select a,hex(a) from t1;
|
||||
a hex(a)
|
||||
ÔÅÓÔ F2E5F1F2
|
||||
alter table t1 change a a char(10) character set koi8r;
|
||||
select a,hex(a) from t1;
|
||||
a hex(a)
|
||||
ÔÅÓÔ D4C5D3D4
|
||||
alter table t1 change a a text character set cp1251;
|
||||
select a,hex(a) from t1;
|
||||
a hex(a)
|
||||
ÔÅÓÔ F2E5F1F2
|
||||
alter table t1 change a a char(10) character set koi8r;
|
||||
select a,hex(a) from t1;
|
||||
a hex(a)
|
||||
ÔÅÓÔ D4C5D3D4
|
||||
drop table t1;
|
||||
|
|
|
@ -111,11 +111,16 @@ insert into t1 set i = null;
|
|||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
insert into t1 set i = 254;
|
||||
ERROR 23000: Duplicate entry '254' for key 1
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
insert into t1 set i = null;
|
||||
ERROR 23000: Duplicate entry '255' for key 1
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (i tinyint unsigned not null auto_increment, key (i));
|
||||
insert into t1 set i = 254;
|
||||
|
|
|
@ -71,3 +71,24 @@ orange
|
|||
yellow
|
||||
green
|
||||
drop table t1;
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'coalesce'
|
||||
CREATE TABLE t1 SELECT COALESCE('a' COLLATE latin1_swedish_ci,'b' COLLATE latin1_bin);
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce'
|
||||
CREATE TABLE t1 SELECT
|
||||
COALESCE(1), COALESCE(1.0),COALESCE('a'),
|
||||
COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
|
||||
COALESCE('a' COLLATE latin1_bin,'b');
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`COALESCE(1)` int(1) NOT NULL default '0',
|
||||
`COALESCE(1.0)` double(3,1) NOT NULL default '0.0',
|
||||
`COALESCE('a')` char(1) NOT NULL default '',
|
||||
`COALESCE(1,1.0)` double(3,1) NOT NULL default '0.0',
|
||||
`COALESCE(1,'1')` char(1) NOT NULL default '',
|
||||
`COALESCE(1.1,'1')` char(3) NOT NULL default '',
|
||||
`COALESCE('a' COLLATE latin1_bin,'b')` char(1) character set latin1 collate latin1_bin NOT NULL default ''
|
||||
) TYPE=MyISAM CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -44,10 +44,10 @@ t1 CREATE TABLE `t1` (
|
|||
drop table t1;
|
||||
select cast("2001-1-1" as date) = "2001-01-01";
|
||||
cast("2001-1-1" as date) = "2001-01-01"
|
||||
0
|
||||
1
|
||||
select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
|
||||
cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"
|
||||
0
|
||||
1
|
||||
select cast("1:2:3" as TIME) = "1:02:03";
|
||||
cast("1:2:3" as TIME) = "1:02:03"
|
||||
0
|
||||
|
|
|
@ -50,7 +50,7 @@ create table t1 (t1.index int);
|
|||
drop table t1;
|
||||
drop database if exists test_$1;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'test_$1'. Database doesn't exist
|
||||
Note 1008 Can't drop database 'test_$1'; database doesn't exist
|
||||
create database test_$1;
|
||||
create table test_$1.$test1 (a$1 int, $b int, c$ int);
|
||||
insert into test_$1.$test1 values (1,2,3);
|
||||
|
@ -252,7 +252,7 @@ id name
|
|||
drop table t2, t3;
|
||||
drop database if exists test_$1;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'test_$1'. Database doesn't exist
|
||||
Note 1008 Can't drop database 'test_$1'; database doesn't exist
|
||||
create database test_$1;
|
||||
create table test_$1.t3 like t1;
|
||||
create temporary table t3 like test_$1.t3;
|
||||
|
|
|
@ -173,9 +173,9 @@ INSERT INTO t2 values (1),(2),(3);
|
|||
INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
|
||||
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 index a a 5 NULL 6 Using index; Using temporary
|
||||
1 SIMPLE t2 index a a 4 NULL 5 Using index; Distinct
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using where; Distinct
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 2 Using temporary
|
||||
1 SIMPLE t2 ref a a 4 test.t1.a 2 Using index
|
||||
1 SIMPLE t3 ref a a 5 test.t1.b 2 Using where; Using index
|
||||
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
|
||||
a
|
||||
1
|
||||
|
|
|
@ -13,7 +13,7 @@ n
|
|||
1
|
||||
drop database if exists mysqltest;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'mysqltest'. Database doesn't exist
|
||||
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
|
||||
create database mysqltest;
|
||||
drop database if exists mysqltest;
|
||||
create database mysqltest;
|
||||
|
@ -27,7 +27,7 @@ create database mysqltest;
|
|||
drop database mysqltest;
|
||||
drop database if exists mysqltest;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'mysqltest'. Database doesn't exist
|
||||
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
|
||||
flush tables with read lock;
|
||||
create database mysqltest;
|
||||
Got one of the listed errors
|
||||
|
@ -48,4 +48,4 @@ Database
|
|||
mysql
|
||||
test
|
||||
drop database mysqltest;
|
||||
ERROR HY000: Can't drop database 'mysqltest'. Database doesn't exist
|
||||
ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null);
|
||||
insert into t1 values (1,1,"a","a");
|
||||
insert into t1 values (2,2,"b","a");
|
||||
|
@ -155,25 +153,28 @@ show warnings;
|
|||
Level Code Message
|
||||
Warning 1258 1 line(s) was(were) cut by group_concat()
|
||||
set group_concat_max_len = 1024;
|
||||
drop table if exists T_URL;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'T_URL'
|
||||
create table T_URL ( URL_ID int(11), URL varchar(80));
|
||||
drop table if exists T_REQUEST;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'T_REQUEST'
|
||||
create table T_REQUEST ( REQ_ID int(11), URL_ID int(11));
|
||||
insert into T_URL values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
|
||||
insert into T_REQUEST values (1,4), (5,4), (5,5);
|
||||
select REQ_ID, Group_Concat(URL) as URL from T_URL, T_REQUEST where
|
||||
T_REQUEST.URL_ID = T_URL.URL_ID group by REQ_ID;
|
||||
REQ_ID URL
|
||||
1 www.host.com
|
||||
5 www.host.com,www.google.com,www.help.com
|
||||
drop table T_URL;
|
||||
drop table T_REQUEST;
|
||||
select group_concat(sum(a)) from t1 group by grp;
|
||||
ERROR HY000: Invalid use of group function
|
||||
select grp,group_concat(c order by 2) from t1 group by grp;
|
||||
ERROR 42S22: Unknown column '2' in 'group statement'
|
||||
drop table t1;
|
||||
create table t1 ( URL_ID int(11), URL varchar(80));
|
||||
create table t2 ( REQ_ID int(11), URL_ID int(11));
|
||||
insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
|
||||
insert into t2 values (1,4), (5,4), (5,5);
|
||||
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
|
||||
t2.URL_ID = t1.URL_ID group by REQ_ID;
|
||||
REQ_ID URL
|
||||
1 X
|
||||
5 X,X,X
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
create table t1 (id int, name varchar(16));
|
||||
insert into t1 values (1,'longername'),(1,'evenlongername');
|
||||
select ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'without distinct: how it should be' from t1;
|
||||
without distinct: how it should be
|
||||
1:longername,1:evenlongername
|
||||
select distinct ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'with distinct: cutoff at length of shortname' from t1;
|
||||
with distinct: cutoff at length of shortname
|
||||
1:longername,1:evenlongername
|
||||
drop table t1;
|
||||
|
|
|
@ -111,3 +111,35 @@ id
|
|||
5
|
||||
9
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a char(1) character set latin1 collate latin1_general_ci,
|
||||
b char(1) character set latin1 collate latin1_swedish_ci,
|
||||
c char(1) character set latin1 collate latin1_danish_ci
|
||||
);
|
||||
insert into t1 values ('A','B','C');
|
||||
insert into t1 values ('a','c','c');
|
||||
select * from t1 where a in (b);
|
||||
ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation ' IN '
|
||||
select * from t1 where a in (b,c);
|
||||
ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT), (latin1_swedish_ci,IMPLICIT), (latin1_danish_ci,IMPLICIT) for operation ' IN '
|
||||
select * from t1 where 'a' in (a,b,c);
|
||||
ERROR HY000: Illegal mix of collations for operation ' IN '
|
||||
select * from t1 where 'a' in (a);
|
||||
a b c
|
||||
A B C
|
||||
a c c
|
||||
select * from t1 where a in ('a');
|
||||
a b c
|
||||
A B C
|
||||
a c c
|
||||
select * from t1 where 'a' collate latin1_general_ci in (a,b,c);
|
||||
a b c
|
||||
A B C
|
||||
a c c
|
||||
select * from t1 where 'a' collate latin1_bin in (a,b,c);
|
||||
a b c
|
||||
a c c
|
||||
select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
||||
a b c
|
||||
a c c
|
||||
drop table t1;
|
||||
|
|
200
mysql-test/r/func_sapdb.result
Normal file
200
mysql-test/r/func_sapdb.result
Normal file
|
@ -0,0 +1,200 @@
|
|||
drop table if exists t1, test;
|
||||
select extract(DAY_MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
extract(DAY_MICROSECOND FROM "1999-01-02 10:11:12.000123")
|
||||
2101112000123
|
||||
select extract(HOUR_MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
extract(HOUR_MICROSECOND FROM "1999-01-02 10:11:12.000123")
|
||||
101112000123
|
||||
select extract(MINUTE_MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
extract(MINUTE_MICROSECOND FROM "1999-01-02 10:11:12.000123")
|
||||
1112000123
|
||||
select extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123")
|
||||
12000123
|
||||
select extract(MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
extract(MICROSECOND FROM "1999-01-02 10:11:12.000123")
|
||||
123
|
||||
select date_format("1997-12-31 23:59:59.000002", "%f");
|
||||
date_format("1997-12-31 23:59:59.000002", "%f")
|
||||
000002
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
|
||||
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND)
|
||||
2025-05-23 04:40:39.000001
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
|
||||
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND)
|
||||
1999-02-21 17:40:39.000001
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
|
||||
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND)
|
||||
1998-01-07 22:41:39.000001
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
|
||||
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND)
|
||||
1998-01-01 02:46:40.000001
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
|
||||
date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND)
|
||||
1998-01-01 00:00:00.000001
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
|
||||
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND)
|
||||
1997-12-30 22:58:58.999999
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
|
||||
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND)
|
||||
1997-12-31 22:58:58.999999
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
|
||||
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND)
|
||||
1997-12-31 23:58:58.999999
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
|
||||
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND)
|
||||
1997-12-31 23:59:58.999999
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
|
||||
date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND)
|
||||
1997-12-31 23:59:59.999999
|
||||
select adddate("1997-12-31 23:59:59.000001", 10);
|
||||
adddate("1997-12-31 23:59:59.000001", 10)
|
||||
1998-01-10 23:59:59.000001
|
||||
select subdate("1997-12-31 23:59:59.000001", 10);
|
||||
subdate("1997-12-31 23:59:59.000001", 10)
|
||||
1997-12-21 23:59:59.000001
|
||||
select datediff("1997-12-31 23:59:59.000001","1997-12-30");
|
||||
datediff("1997-12-31 23:59:59.000001","1997-12-30")
|
||||
1
|
||||
select datediff("1997-11-31 23:59:59.000001","1997-12-31");
|
||||
datediff("1997-11-31 23:59:59.000001","1997-12-31")
|
||||
-30
|
||||
select datediff("1997-11-31 23:59:59.000001",null);
|
||||
datediff("1997-11-31 23:59:59.000001",null)
|
||||
NULL
|
||||
select weekofyear("1997-11-31 23:59:59.000001");
|
||||
weekofyear("1997-11-31 23:59:59.000001")
|
||||
49
|
||||
select makedate(1997,1);
|
||||
makedate(1997,1)
|
||||
1997-01-01
|
||||
select makedate(1997,0);
|
||||
makedate(1997,0)
|
||||
NULL
|
||||
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
|
||||
addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002")
|
||||
1998-01-02 01:01:01.000001
|
||||
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
|
||||
subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002")
|
||||
1997-12-30 22:58:57.999999
|
||||
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
|
||||
addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999")
|
||||
NULL
|
||||
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
|
||||
subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999")
|
||||
NULL
|
||||
select subtime("01:00:00.999999", "02:00:00.999998");
|
||||
subtime("01:00:00.999999", "02:00:00.999998")
|
||||
-00:59:59.999999
|
||||
select subtime("02:01:01.999999", "01:01:01.999999");
|
||||
subtime("02:01:01.999999", "01:01:01.999999")
|
||||
01:00:00.000000
|
||||
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
|
||||
timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002")
|
||||
8807:59:59.999999
|
||||
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
|
||||
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002")
|
||||
46:58:57.999999
|
||||
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
|
||||
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002")
|
||||
-23:59:59.999999
|
||||
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
|
||||
timediff("1997-12-31 23:59:59.000001","23:59:59.000001")
|
||||
NULL
|
||||
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
|
||||
timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001")
|
||||
-00:00:00.000001
|
||||
select maketime(10,11,12);
|
||||
maketime(10,11,12)
|
||||
10:11:12
|
||||
select maketime(25,11,12);
|
||||
maketime(25,11,12)
|
||||
25:11:12
|
||||
select maketime(-25,11,12);
|
||||
maketime(-25,11,12)
|
||||
-25:11:12
|
||||
select timestamp("2001-12-01", "01:01:01.999999");
|
||||
timestamp("2001-12-01", "01:01:01.999999")
|
||||
2001-12-01 01:01:01.999999
|
||||
select timestamp("2001-13-01", "01:01:01.000001");
|
||||
timestamp("2001-13-01", "01:01:01.000001")
|
||||
NULL
|
||||
select timestamp("2001-12-01", "25:01:01");
|
||||
timestamp("2001-12-01", "25:01:01")
|
||||
2001-12-02 01:01:01
|
||||
select timestamp("2001-12-01 01:01:01.000100");
|
||||
timestamp("2001-12-01 01:01:01.000100")
|
||||
2001-12-01 01:01:01.000100
|
||||
select timestamp("2001-12-01");
|
||||
timestamp("2001-12-01")
|
||||
2001-12-01 00:00:00
|
||||
select day("1997-12-31 23:59:59.000001");
|
||||
day("1997-12-31 23:59:59.000001")
|
||||
31
|
||||
select date("1997-12-31 23:59:59.000001");
|
||||
date("1997-12-31 23:59:59.000001")
|
||||
1997-12-31
|
||||
select date("1997-13-31 23:59:59.000001");
|
||||
date("1997-13-31 23:59:59.000001")
|
||||
NULL
|
||||
select time("1997-12-31 23:59:59.000001");
|
||||
time("1997-12-31 23:59:59.000001")
|
||||
23:59:59.000001
|
||||
select time("1997-12-31 25:59:59.000001");
|
||||
time("1997-12-31 25:59:59.000001")
|
||||
NULL
|
||||
select microsecond("1997-12-31 23:59:59.000001");
|
||||
microsecond("1997-12-31 23:59:59.000001")
|
||||
1
|
||||
create table t1
|
||||
select makedate(1997,1) as f1,
|
||||
addtime(cast("1997-12-31 23:59:59.000001" as datetime), "1 1:1:1.000002") as f2,
|
||||
addtime(cast("23:59:59.999999" as time) , "1 1:1:1.000002") as f3,
|
||||
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
|
||||
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
|
||||
maketime(10,11,12) as f6,
|
||||
timestamp(cast("2001-12-01" as date), "01:01:01") as f7,
|
||||
date("1997-12-31 23:59:59.000001") as f8,
|
||||
time("1997-12-31 23:59:59.000001") as f9;
|
||||
describe t1;
|
||||
Field Type Null Key Default Extra
|
||||
f1 date 0000-00-00
|
||||
f2 datetime 0000-00-00 00:00:00
|
||||
f3 time 00:00:00
|
||||
f4 time 00:00:00
|
||||
f5 time 00:00:00
|
||||
f6 time 00:00:00
|
||||
f7 datetime 0000-00-00 00:00:00
|
||||
f8 date 0000-00-00
|
||||
f9 time 00:00:00
|
||||
select * from t1;
|
||||
f1 f2 f3 f4 f5 f6 f7 f8 f9
|
||||
1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -23:59:59 10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59
|
||||
create table test(t1 datetime, t2 time, t3 time, t4 datetime);
|
||||
insert into test values
|
||||
('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
|
||||
('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"),
|
||||
('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'),
|
||||
('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null),
|
||||
('2001-01-01 01:01:01', null, '-1 01:01:01', null),
|
||||
(null, null, null, null),
|
||||
('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01');
|
||||
SELECT ADDTIME(t1,t2) As ttt, ADDTIME(t2, t3) As qqq from test;
|
||||
ttt qqq
|
||||
2001-01-01 02:02:02 NULL
|
||||
2001-01-01 00:00:00 -25:01:00
|
||||
1997-12-31 00:00:00 -25:01:00
|
||||
2001-01-01 02:02:02 -24:00:00
|
||||
NULL NULL
|
||||
NULL NULL
|
||||
2001-01-01 02:02:02 26:02:02
|
||||
SELECT TIMEDIFF(t1,t4) As ttt, TIMEDIFF(t2, t3) As qqq from test;
|
||||
ttt qqq
|
||||
-744:00:00 NULL
|
||||
26305:01:02 22:58:58
|
||||
-26305:01:02 -22:58:58
|
||||
NULL 26:02:02
|
||||
NULL NULL
|
||||
NULL NULL
|
||||
00:00:00 -24:00:00
|
||||
drop table t1, test;
|
|
@ -1,4 +1,5 @@
|
|||
drop table if exists t1;
|
||||
set names latin1;
|
||||
select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
|
||||
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
|
||||
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
|
||||
|
@ -249,6 +250,59 @@ INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
|
|||
SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password");
|
||||
1
|
||||
DROP TABLE t1;
|
||||
select 1=_latin1'1';
|
||||
1=_latin1'1'
|
||||
1
|
||||
select _latin1'1'=1;
|
||||
_latin1'1'=1
|
||||
1
|
||||
select _latin2'1'=1;
|
||||
_latin2'1'=1
|
||||
1
|
||||
select 1=_latin2'1';
|
||||
1=_latin2'1'
|
||||
1
|
||||
select _latin1'1'=_latin2'1';
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '='
|
||||
select row('a','b','c') = row('a','b','c');
|
||||
row('a','b','c') = row('a','b','c')
|
||||
1
|
||||
select row('A','b','c') = row('a','b','c');
|
||||
row('A','b','c') = row('a','b','c')
|
||||
1
|
||||
select row('A' COLLATE latin1_bin,'b','c') = row('a','b','c');
|
||||
row('A' COLLATE latin1_bin,'b','c') = row('a','b','c')
|
||||
0
|
||||
select row('A','b','c') = row('a' COLLATE latin1_bin,'b','c');
|
||||
row('A','b','c') = row('a' COLLATE latin1_bin,'b','c')
|
||||
0
|
||||
select row('A' COLLATE latin1_general_ci,'b','c') = row('a' COLLATE latin1_bin,'b','c');
|
||||
ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation '='
|
||||
select concat(_latin1'a',_latin2'a');
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat'
|
||||
select concat(_latin1'a',_latin2'a',_latin5'a');
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin5_turkish_ci,COERCIBLE) for operation 'concat'
|
||||
select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a');
|
||||
ERROR HY000: Illegal mix of collations for operation 'concat'
|
||||
select FIELD('b','A','B');
|
||||
FIELD('b','A','B')
|
||||
2
|
||||
select FIELD('B','A','B');
|
||||
FIELD('B','A','B')
|
||||
2
|
||||
select FIELD('b' COLLATE latin1_bin,'A','B');
|
||||
FIELD('b' COLLATE latin1_bin,'A','B')
|
||||
0
|
||||
select FIELD('b','A' COLLATE latin1_bin,'B');
|
||||
FIELD('b','A' COLLATE latin1_bin,'B')
|
||||
0
|
||||
select FIELD(_latin2'b','A','B');
|
||||
ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'field'
|
||||
select FIELD('b',_latin2'A','B');
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'field'
|
||||
select FIELD('b',_latin2'A','B',1);
|
||||
FIELD('b',_latin2'A','B',1)
|
||||
1
|
||||
select POSITION(_latin1'B' IN _latin1'abcd');
|
||||
POSITION(_latin1'B' IN _latin1'abcd')
|
||||
2
|
||||
|
@ -309,15 +363,15 @@ select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin);
|
|||
_latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin)
|
||||
0
|
||||
select _latin2'B' in (_latin1'a',_latin1'b');
|
||||
ERROR HY000: Illegal mix of collations for operation ' IN '
|
||||
ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
|
||||
select _latin1'B' in (_latin2'a',_latin1'b');
|
||||
ERROR HY000: Illegal mix of collations for operation ' IN '
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
|
||||
select _latin1'B' in (_latin1'a',_latin2'b');
|
||||
ERROR HY000: Illegal mix of collations for operation ' IN '
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE) for operation ' IN '
|
||||
select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b');
|
||||
ERROR HY000: Illegal mix of collations for operation ' IN '
|
||||
ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_bin,EXPLICIT), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
|
||||
select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin);
|
||||
ERROR HY000: Illegal mix of collations for operation ' IN '
|
||||
ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_swedish_ci,COERCIBLE), (latin1_bin,EXPLICIT) for operation ' IN '
|
||||
select collation(bin(130)), coercibility(bin(130));
|
||||
collation(bin(130)) coercibility(bin(130))
|
||||
latin1_swedish_ci 3
|
||||
|
@ -478,3 +532,24 @@ t1 CREATE TABLE `t1` (
|
|||
`replace(_latin2'abcd',_latin2'b',_latin2'B')` char(4) character set latin2 NOT NULL default ''
|
||||
) TYPE=MyISAM CHARSET=latin1
|
||||
drop table t1;
|
||||
select SUBSTR('abcdefg',3,2);
|
||||
SUBSTR('abcdefg',3,2)
|
||||
cd
|
||||
select SUBSTRING('abcdefg',3,2);
|
||||
SUBSTRING('abcdefg',3,2)
|
||||
cd
|
||||
select SUBSTR('abcdefg',-3,2) FROM DUAL;
|
||||
SUBSTR('abcdefg',-3,2)
|
||||
ef
|
||||
select SUBSTR('abcdefg',-1,5) FROM DUAL;
|
||||
SUBSTR('abcdefg',-1,5)
|
||||
g
|
||||
select SUBSTR('abcdefg',0,0) FROM DUAL;
|
||||
SUBSTR('abcdefg',0,0)
|
||||
|
||||
select SUBSTR('abcdefg',-1,-1) FROM DUAL;
|
||||
SUBSTR('abcdefg',-1,-1)
|
||||
|
||||
select SUBSTR('abcdefg',1,-1) FROM DUAL;
|
||||
SUBSTR('abcdefg',1,-1)
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ select "user4";
|
|||
user4
|
||||
user4
|
||||
select a from t1;
|
||||
ERROR 42000: No Database Selected
|
||||
ERROR 3D000: No Database Selected
|
||||
select * from mysqltest.t1,test.t1;
|
||||
a b c a
|
||||
1 1 1 test.t1
|
||||
|
|
|
@ -148,3 +148,22 @@ alter table t1 type=MyISAM;
|
|||
handler t2 read first;
|
||||
ERROR 42S02: Unknown table 't2' in HANDLER
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6);
|
||||
delete from t1 limit 2;
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
a
|
||||
3
|
||||
handler t1 read first limit 1,1;
|
||||
a
|
||||
4
|
||||
handler t1 read first limit 2,2;
|
||||
a
|
||||
5
|
||||
6
|
||||
delete from t1 limit 3;
|
||||
handler t1 read first;
|
||||
a
|
||||
6
|
||||
drop table t1;
|
||||
|
|
43
mysql-test/r/key_cache.result
Normal file
43
mysql-test/r/key_cache.result
Normal file
|
@ -0,0 +1,43 @@
|
|||
SET @save_key_buffer=@@key_buffer_size;
|
||||
SELECT @@key_buffer_size, @@small.key_buffer_size;
|
||||
@@key_buffer_size @@small.key_buffer_size
|
||||
2097152 131072
|
||||
SET @@global.key_buffer_size=16*1024*1024;
|
||||
SET @@global.default.key_buffer_size=16*1024*1024;
|
||||
SET @@global.default.key_buffer_size=16*1024*1024;
|
||||
SET @@global.small.key_buffer_size=1*1024*1024;
|
||||
SET @@global.medium.key_buffer_size=4*1024*1024;
|
||||
SET @@global.medium.key_buffer_size=0;
|
||||
SET @@global.medium.key_buffer_size=0;
|
||||
SHOW VARIABLES like "key_buffer_size";
|
||||
Variable_name Value
|
||||
key_buffer_size 16777216
|
||||
SELECT @@key_buffer_size;
|
||||
@@key_buffer_size
|
||||
16777216
|
||||
SELECT @@global.key_buffer_size;
|
||||
@@global.key_buffer_size
|
||||
16777216
|
||||
SELECT @@global.default.key_buffer_size;
|
||||
@@global.default.key_buffer_size
|
||||
16777216
|
||||
SELECT @@global.default.`key_buffer_size`;
|
||||
@@global.default.key_buffer_size
|
||||
16777216
|
||||
SELECT @@global.`default`.`key_buffer_size`;
|
||||
@@global.default.key_buffer_size
|
||||
16777216
|
||||
SELECT @@`default`.key_buffer_size;
|
||||
@@default.key_buffer_size
|
||||
16777216
|
||||
SELECT @@small.key_buffer_size;
|
||||
@@small.key_buffer_size
|
||||
1048576
|
||||
SELECT @@medium.key_buffer_size;
|
||||
@@medium.key_buffer_size
|
||||
4194304
|
||||
SET @@global.key_buffer_size=@save_key_buffer;
|
||||
SELECT @@default.key_buffer_size;
|
||||
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'default.key_buffer_size' at line 1
|
||||
SELECT @@skr.table_type="test";
|
||||
ERROR HY000: Variable 'table_type' is not a variable component (Can't be used as XXXX.variable_name)
|
|
@ -1,4 +1,5 @@
|
|||
drop table if exists t1,t2,t3,t4,t5,t6;
|
||||
drop database if exists mysqltest;
|
||||
create table t1 (a int not null primary key auto_increment, message char(20));
|
||||
create table t2 (a int not null primary key auto_increment, message char(20));
|
||||
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1");
|
||||
|
@ -174,15 +175,26 @@ t3 CREATE TABLE `t3` (
|
|||
`a` int(11) NOT NULL default '0',
|
||||
`b` char(20) default NULL,
|
||||
KEY `a` (`a`)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(`t1`,`t2`)
|
||||
create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2);
|
||||
select * from t4;
|
||||
ERROR HY000: Can't open file: 't4.MRG'. (errno: 143)
|
||||
create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2);
|
||||
ERROR HY000: Incorrect table definition; All MERGE tables must be in the same database
|
||||
drop table if exists t5,t4,t3,t1,t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't5'
|
||||
alter table t4 add column c int;
|
||||
ERROR HY000: Can't open file: 't4.MRG'. (errno: 143)
|
||||
create database mysqltest;
|
||||
create table mysqltest.t6 (a int not null primary key auto_increment, message char(20));
|
||||
create table t5 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,mysqltest.t6);
|
||||
show create table t5;
|
||||
Table Create Table
|
||||
t5 CREATE TABLE `t5` (
|
||||
`a` int(11) NOT NULL default '0',
|
||||
`b` char(20) default NULL,
|
||||
KEY `a` (`a`)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`)
|
||||
alter table t5 type=myisam;
|
||||
drop table t5, mysqltest.t6;
|
||||
drop database mysqltest;
|
||||
drop table t4,t3,t1,t2;
|
||||
create table t1 (c char(10)) type=myisam;
|
||||
create table t2 (c char(10)) type=myisam;
|
||||
create table t3 (c char(10)) union=(t1,t2) type=merge;
|
||||
|
@ -251,14 +263,14 @@ t3 CREATE TABLE `t3` (
|
|||
`incr` int(11) NOT NULL default '0',
|
||||
`othr` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`incr`)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(`t1`,`t2`)
|
||||
alter table t3 drop primary key;
|
||||
show create table t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`incr` int(11) NOT NULL default '0',
|
||||
`othr` int(11) NOT NULL default '0'
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(`t1`,`t2`)
|
||||
drop table t3,t2,t1;
|
||||
create table t1 (a int not null, key(a)) type=merge;
|
||||
select * from t1;
|
||||
|
@ -294,21 +306,21 @@ t4 CREATE TABLE `t4` (
|
|||
`a` int(11) NOT NULL default '0',
|
||||
`b` int(11) NOT NULL default '0',
|
||||
KEY `a` (`a`,`b`)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(`t1`,`t2`)
|
||||
show create table t5;
|
||||
Table Create Table
|
||||
t5 CREATE TABLE `t5` (
|
||||
`a` int(11) NOT NULL default '0',
|
||||
`b` int(11) NOT NULL auto_increment,
|
||||
PRIMARY KEY (`a`,`b`)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 INSERT_METHOD=FIRST UNION=(t1,t2)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`)
|
||||
show create table t6;
|
||||
Table Create Table
|
||||
t6 CREATE TABLE `t6` (
|
||||
`a` int(11) NOT NULL default '0',
|
||||
`b` int(11) NOT NULL auto_increment,
|
||||
PRIMARY KEY (`a`,`b`)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 INSERT_METHOD=LAST UNION=(t1,t2)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
|
||||
insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL);
|
||||
insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL);
|
||||
select * from t3 order by b,a limit 3;
|
||||
|
@ -373,7 +385,7 @@ t4 CREATE TABLE `t4` (
|
|||
`a` int(11) NOT NULL default '0',
|
||||
`b` int(11) NOT NULL default '0',
|
||||
KEY `a` (`a`,`b`)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2,t3)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(`t1`,`t2`,`t3`)
|
||||
select * from t4 order by a,b;
|
||||
a b
|
||||
1 1
|
||||
|
@ -399,7 +411,7 @@ t4 CREATE TABLE `t4` (
|
|||
`a` int(11) NOT NULL default '0',
|
||||
`b` int(11) NOT NULL default '0',
|
||||
KEY `a` (`a`,`b`)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 INSERT_METHOD=FIRST UNION=(t1,t2,t3)
|
||||
) TYPE=MRG_MyISAM CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`)
|
||||
insert into t4 values (4,1),(4,2);
|
||||
select * from t1 order by a,b;
|
||||
a b
|
||||
|
@ -528,7 +540,11 @@ a b
|
|||
6 1
|
||||
6 2
|
||||
6 3
|
||||
drop table if exists t6, t5, t4, t3, t2, t1;
|
||||
insert into t1 values (99,NULL);
|
||||
select * from t4 where a+0 > 90;
|
||||
a b
|
||||
99 1
|
||||
drop table t6, t5, t4, t3, t2, t1;
|
||||
CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1), (2,1);
|
||||
CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM;
|
||||
|
@ -540,7 +556,7 @@ max(b)
|
|||
select max(b) from t1 where a = 2;
|
||||
max(b)
|
||||
1
|
||||
drop table if exists t3,t1,t2;
|
||||
drop table t3,t1,t2;
|
||||
create table t1 (a int not null);
|
||||
create table t2 (a int not null);
|
||||
insert into t1 values (1);
|
||||
|
@ -559,7 +575,7 @@ select * from t6;
|
|||
a
|
||||
1
|
||||
2
|
||||
drop table if exists t6, t3, t1, t2, t4, t5;
|
||||
drop table t6, t3, t1, t2, t4, t5;
|
||||
CREATE TABLE t1 (
|
||||
fileset_id tinyint(3) unsigned NOT NULL default '0',
|
||||
file_code varchar(32) NOT NULL default '',
|
||||
|
|
|
@ -21,7 +21,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index
|
||||
explain select * from t1 where (a is null or a = 7) and b=7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a,b b 4 const 2 Using where
|
||||
1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index
|
||||
explain select * from t1 where (a is null or a = 7) and b=7 order by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index; Using filesort
|
||||
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index
|
||||
|
@ -56,13 +59,15 @@ NULL 9
|
|||
NULL 9
|
||||
select * from t1 where (a is null or a = 7) and b=7;
|
||||
a b
|
||||
NULL 7
|
||||
7 7
|
||||
NULL 7
|
||||
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
|
||||
a b
|
||||
NULL 7
|
||||
NULL 9
|
||||
NULL 9
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
|
||||
explain select * from t1 where a is null and b = 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
@ -84,7 +89,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 SIMPLE t1 range a,b a 5 NULL 5 Using where
|
||||
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL a,b NULL NULL NULL 12 Using where
|
||||
1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using where
|
||||
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a,b a 5 const 3 Using where
|
||||
|
@ -125,8 +130,8 @@ NULL 9 0
|
|||
NULL 9 0
|
||||
select * from t1 where (a is null or a = 7) and b=7 and c=0;
|
||||
a b c
|
||||
NULL 7 0
|
||||
7 7 0
|
||||
NULL 7 0
|
||||
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
|
||||
a b c
|
||||
NULL 7 0
|
||||
|
@ -136,6 +141,103 @@ select * from t1 where b like "6%";
|
|||
a b c
|
||||
6 6 0
|
||||
drop table t1;
|
||||
rename table t2 to t1;
|
||||
alter table t1 modify b int null;
|
||||
insert into t1 values (7,null), (8,null), (8,7);
|
||||
explain select * from t1 where a = 7 and (b=7 or b is null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using where; Using index
|
||||
select * from t1 where a = 7 and (b=7 or b is null);
|
||||
a b
|
||||
7 7
|
||||
7 NULL
|
||||
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a,b a 10 NULL 4 Using where; Using index
|
||||
select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
||||
a b
|
||||
NULL 7
|
||||
7 NULL
|
||||
7 7
|
||||
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index
|
||||
select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
|
||||
a b
|
||||
7 NULL
|
||||
7 7
|
||||
NULL 7
|
||||
NULL 9
|
||||
NULL 9
|
||||
create table t2 (a int);
|
||||
insert into t2 values (7),(8);
|
||||
explain select * from t2 straight_join t1 where t1.a=t2.a and b is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE t1 ref a,b a 10 test.t2.a,const 2 Using where; Using index
|
||||
drop index b on t1;
|
||||
explain select * from t2,t1 where t1.a=t2.a and b is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE t1 ref a a 10 test.t2.a,const 2 Using where; Using index
|
||||
select * from t2,t1 where t1.a=t2.a and b is null;
|
||||
a a b
|
||||
7 7 NULL
|
||||
8 8 NULL
|
||||
explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index
|
||||
select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
|
||||
a a b
|
||||
7 7 7
|
||||
7 7 NULL
|
||||
8 8 7
|
||||
8 8 NULL
|
||||
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 4 Using where; Using index
|
||||
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
|
||||
a a b
|
||||
7 7 7
|
||||
7 NULL 7
|
||||
8 8 7
|
||||
8 NULL 7
|
||||
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index
|
||||
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
|
||||
a a b
|
||||
7 7 NULL
|
||||
7 7 7
|
||||
7 NULL 7
|
||||
8 8 NULL
|
||||
8 8 7
|
||||
8 NULL 7
|
||||
insert into t2 values (null),(6);
|
||||
delete from t1 where a=8;
|
||||
explain select * from t2,t1 where t1.a=t2.a or t1.a is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4
|
||||
1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index
|
||||
explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4
|
||||
1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index
|
||||
select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
|
||||
a a b
|
||||
7 7 NULL
|
||||
7 7 7
|
||||
7 NULL 7
|
||||
8 NULL 7
|
||||
NULL NULL 7
|
||||
NULL NULL 9
|
||||
NULL NULL 9
|
||||
6 6 6
|
||||
6 NULL 7
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
uniq_id int(10) unsigned default NULL,
|
||||
|
|
|
@ -10,22 +10,22 @@ select * from t1;
|
|||
f1
|
||||
5
|
||||
delete from t1;
|
||||
Access denied for user: 'ssl_user1@localhost' to database 'test'
|
||||
ERROR 42000: Access denied for user: 'ssl_user1@localhost' to database 'test'
|
||||
select * from t1;
|
||||
f1
|
||||
5
|
||||
delete from t1;
|
||||
Access denied for user: 'ssl_user2@localhost' to database 'test'
|
||||
ERROR 42000: Access denied for user: 'ssl_user2@localhost' to database 'test'
|
||||
select * from t1;
|
||||
f1
|
||||
5
|
||||
delete from t1;
|
||||
Access denied for user: 'ssl_user3@localhost' to database 'test'
|
||||
ERROR 42000: Access denied for user: 'ssl_user3@localhost' to database 'test'
|
||||
select * from t1;
|
||||
f1
|
||||
5
|
||||
delete from t1;
|
||||
Access denied for user: 'ssl_user4@localhost' to database 'test'
|
||||
ERROR 42000: Access denied for user: 'ssl_user4@localhost' to database 'test'
|
||||
delete from mysql.user where user='ssl_user%';
|
||||
delete from mysql.db where user='ssl_user%';
|
||||
flush privileges;
|
||||
|
|
|
@ -21,7 +21,7 @@ n m
|
|||
drop database mysqltest;
|
||||
drop database if exists mysqltest2;
|
||||
drop database mysqltest;
|
||||
ERROR HY000: Can't drop database 'mysqltest'. Database doesn't exist
|
||||
ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist
|
||||
drop database mysqltest2;
|
||||
set sql_log_bin = 0;
|
||||
create database mysqltest2;
|
||||
|
@ -48,8 +48,8 @@ mysql
|
|||
test
|
||||
load data from master;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'mysqltest'. Database doesn't exist
|
||||
Note 1008 Can't drop database 'mysqltest2'. Database doesn't exist
|
||||
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
|
||||
Note 1008 Can't drop database 'mysqltest2'; database doesn't exist
|
||||
show databases;
|
||||
Database
|
||||
mysql
|
||||
|
|
|
@ -41,11 +41,16 @@ insert into t2 values(NULL);
|
|||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
purge master logs to 'master-bin.000002';
|
||||
show master logs;
|
||||
Log_name
|
||||
master-bin.000002
|
||||
master-bin.000003
|
||||
purge binary logs to 'master-bin.000002';
|
||||
show binary logs;
|
||||
Log_name
|
||||
master-bin.000002
|
||||
master-bin.000003
|
||||
purge logs before now();
|
||||
purge master logs before now();
|
||||
show binary logs;
|
||||
Log_name
|
||||
master-bin.000003
|
||||
|
|
|
@ -37,7 +37,7 @@ delete from t1 where b="test" limit 1;
|
|||
delete from t1 where a+0=1 limit 2;
|
||||
SET MAX_JOIN_SIZE=2;
|
||||
SELECT @@MAX_JOIN_SIZE, @@SQL_BIG_SELECTS;
|
||||
@@max_join_size @@sql_big_selects
|
||||
@@MAX_JOIN_SIZE @@SQL_BIG_SELECTS
|
||||
2 0
|
||||
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
|
||||
SELECT * from t1;
|
||||
|
|
|
@ -829,7 +829,7 @@ a t1.a in (select t2.a from t2)
|
|||
explain SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index a a 5 NULL 3 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 const 2 Using where; Using index
|
||||
drop table t1,t2;
|
||||
create table t1 (a float);
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1);
|
||||
|
@ -1153,6 +1153,19 @@ INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
|
|||
SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
|
||||
REF_ID
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (a int, b int);
|
||||
insert into t1 values (1,0), (2,0), (3,0);
|
||||
insert into t2 values (1,1), (2,1), (3,1), (2,2);
|
||||
update ignore t1 set b=(select b from t2 where t1.a=t2.a);
|
||||
Warnings:
|
||||
Error 1240 Subselect returns more than 1 record
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 NULL
|
||||
3 1
|
||||
drop table t1, t2;
|
||||
create table t1(City VARCHAR(30),Location geometry);
|
||||
insert into t1 values("Paris",GeomFromText('POINT(2.33 48.87)'));
|
||||
select City from t1 where (select intersects(GeomFromText(AsText(Location)),GeomFromText('Polygon((2 50, 2.5 50, 2.5 47, 2 47, 2 50))'))=0);
|
||||
|
@ -1200,3 +1213,15 @@ SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1
|
|||
'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1')
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (a int, b int);
|
||||
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
|
||||
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
|
||||
insert into t3 values (3,3), (2,2), (1,1);
|
||||
select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
|
||||
a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
|
||||
3 1
|
||||
2 2
|
||||
1 2
|
||||
drop table t1,t2,t3;
|
||||
|
|
|
@ -46,7 +46,7 @@ rename table t7 to t9;
|
|||
drop table t1;
|
||||
Got one of the listed errors
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'test_mysqltest'. Database doesn't exist
|
||||
Note 1008 Can't drop database 'test_mysqltest'; database doesn't exist
|
||||
Got one of the listed errors
|
||||
Got one of the listed errors
|
||||
Got one of the listed errors
|
||||
|
|
|
@ -77,7 +77,7 @@ select last_insert_id(345);
|
|||
last_insert_id(345)
|
||||
345
|
||||
select @@IDENTITY,last_insert_id(), @@identity;
|
||||
@@identity last_insert_id() @@identity
|
||||
@@IDENTITY last_insert_id() @@identity
|
||||
345 345 345
|
||||
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
|
||||
set global concurrent_insert=ON;
|
||||
|
|
|
@ -32,7 +32,7 @@ Level Code Message
|
|||
Note 1051 Unknown table 'not_exists_table'
|
||||
drop database if exists not_exists_db;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'not_exists_db'. Database doesn't exist
|
||||
Note 1008 Can't drop database 'not_exists_db'; database doesn't exist
|
||||
show count(*) warnings;
|
||||
@@session.warning_count
|
||||
1
|
||||
|
|
|
@ -144,3 +144,30 @@ ALTER TABLE t1 DISABLE KEYS;
|
|||
INSERT DELAYED INTO t1 VALUES(1),(2),(3);
|
||||
ALTER TABLE t1 ENABLE KEYS;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test that data get converted when character set is changed
|
||||
# Test that data doesn't get converted when src or dst is BINARY/BLOB
|
||||
#
|
||||
set names koi8r;
|
||||
create table t1 (a char(10) character set koi8r);
|
||||
insert into t1 values ('ÔÅÓÔ');
|
||||
select a,hex(a) from t1;
|
||||
alter table t1 change a a char(10) character set cp1251;
|
||||
select a,hex(a) from t1;
|
||||
alter table t1 change a a char(10) binary;
|
||||
select a,hex(a) from t1;
|
||||
alter table t1 change a a char(10) character set cp1251;
|
||||
select a,hex(a) from t1;
|
||||
alter table t1 change a a char(10) character set koi8r;
|
||||
select a,hex(a) from t1;
|
||||
alter table t1 change a a varchar(10) character set cp1251;
|
||||
select a,hex(a) from t1;
|
||||
alter table t1 change a a char(10) character set koi8r;
|
||||
select a,hex(a) from t1;
|
||||
alter table t1 change a a text character set cp1251;
|
||||
select a,hex(a) from t1;
|
||||
alter table t1 change a a char(10) character set koi8r;
|
||||
select a,hex(a) from t1;
|
||||
|
||||
drop table t1;
|
||||
|
|
|
@ -80,6 +80,9 @@ insert into t1 set i = 254;
|
|||
insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
--error 1062
|
||||
insert into t1 set i = 254;
|
||||
select last_insert_id();
|
||||
--error 1062
|
||||
insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
drop table t1;
|
||||
|
@ -100,5 +103,6 @@ select last_insert_id();
|
|||
--error 1062
|
||||
insert into t1 values (NULL, 10);
|
||||
select last_insert_id();
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
|
|
@ -41,3 +41,25 @@ create table t1 (row int not null, col int not null, val varchar(255) not null);
|
|||
insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small');
|
||||
select max(case col when 1 then val else null end) as color from t1 group by row;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# COALESCE is a CASE abbrevation:
|
||||
#
|
||||
# COALESCE(v1,v2) == CASE WHEN v1 IS NOT NULL THEN v1 ELSE v2 END
|
||||
#
|
||||
# COALESCE(V1, V2, . . . ,Vn ) =
|
||||
# CASE WHEN V1 IS NOT NULL THEN V1 ELSE COALESCE (V2, . . . ,Vn) END
|
||||
#
|
||||
# Check COALESCE argument types aggregation
|
||||
|
||||
SET NAMES latin1;
|
||||
--error 1265
|
||||
CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
|
||||
--error 1265
|
||||
CREATE TABLE t1 SELECT COALESCE('a' COLLATE latin1_swedish_ci,'b' COLLATE latin1_bin);
|
||||
CREATE TABLE t1 SELECT
|
||||
COALESCE(1), COALESCE(1.0),COALESCE('a'),
|
||||
COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
|
||||
COALESCE('a' COLLATE latin1_bin,'b');
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#
|
||||
# simple test of group_concat function
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null);
|
||||
insert into t1 values (1,1,"a","a");
|
||||
insert into t1 values (2,2,"b","a");
|
||||
|
@ -70,19 +72,6 @@ select grp,group_concat(c) from t1 group by grp;
|
|||
show warnings;
|
||||
set group_concat_max_len = 1024;
|
||||
|
||||
# Test variable length
|
||||
|
||||
drop table if exists T_URL;
|
||||
create table T_URL ( URL_ID int(11), URL varchar(80));
|
||||
drop table if exists T_REQUEST;
|
||||
create table T_REQUEST ( REQ_ID int(11), URL_ID int(11));
|
||||
insert into T_URL values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
|
||||
insert into T_REQUEST values (1,4), (5,4), (5,5);
|
||||
select REQ_ID, Group_Concat(URL) as URL from T_URL, T_REQUEST where
|
||||
T_REQUEST.URL_ID = T_URL.URL_ID group by REQ_ID;
|
||||
drop table T_URL;
|
||||
drop table T_REQUEST;
|
||||
|
||||
# Test errors
|
||||
|
||||
--error 1111
|
||||
|
@ -91,3 +80,22 @@ select group_concat(sum(a)) from t1 group by grp;
|
|||
select grp,group_concat(c order by 2) from t1 group by grp;
|
||||
|
||||
drop table t1;
|
||||
|
||||
# Test variable length
|
||||
|
||||
create table t1 ( URL_ID int(11), URL varchar(80));
|
||||
create table t2 ( REQ_ID int(11), URL_ID int(11));
|
||||
insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
|
||||
insert into t2 values (1,4), (5,4), (5,5);
|
||||
# Make this order independent
|
||||
--replace_result www.help.com X www.host.com X www.google.com X
|
||||
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
|
||||
t2.URL_ID = t1.URL_ID group by REQ_ID;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
create table t1 (id int, name varchar(16));
|
||||
insert into t1 values (1,'longername'),(1,'evenlongername');
|
||||
select ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'without distinct: how it should be' from t1;
|
||||
select distinct ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'with distinct: cutoff at length of shortname' from t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -54,3 +54,22 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
|
|||
select * from t1 where id in (2,5,9);
|
||||
drop table t1;
|
||||
|
||||
create table t1 (
|
||||
a char(1) character set latin1 collate latin1_general_ci,
|
||||
b char(1) character set latin1 collate latin1_swedish_ci,
|
||||
c char(1) character set latin1 collate latin1_danish_ci
|
||||
);
|
||||
insert into t1 values ('A','B','C');
|
||||
insert into t1 values ('a','c','c');
|
||||
--error 1265
|
||||
select * from t1 where a in (b);
|
||||
--error 1268
|
||||
select * from t1 where a in (b,c);
|
||||
--error 1269
|
||||
select * from t1 where 'a' in (a,b,c);
|
||||
select * from t1 where 'a' in (a);
|
||||
select * from t1 where a in ('a');
|
||||
select * from t1 where 'a' collate latin1_general_ci in (a,b,c);
|
||||
select * from t1 where 'a' collate latin1_bin in (a,b,c);
|
||||
select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
||||
drop table t1;
|
||||
|
|
99
mysql-test/t/func_sapdb.test
Normal file
99
mysql-test/t/func_sapdb.test
Normal file
|
@ -0,0 +1,99 @@
|
|||
--disable_warnings
|
||||
drop table if exists t1, test;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
#
|
||||
# time functions
|
||||
#
|
||||
select extract(DAY_MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
select extract(HOUR_MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
select extract(MINUTE_MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
select extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
select extract(MICROSECOND FROM "1999-01-02 10:11:12.000123");
|
||||
select date_format("1997-12-31 23:59:59.000002", "%f");
|
||||
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
|
||||
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
|
||||
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
|
||||
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
|
||||
|
||||
#Date functions
|
||||
select adddate("1997-12-31 23:59:59.000001", 10);
|
||||
select subdate("1997-12-31 23:59:59.000001", 10);
|
||||
|
||||
select datediff("1997-12-31 23:59:59.000001","1997-12-30");
|
||||
select datediff("1997-11-31 23:59:59.000001","1997-12-31");
|
||||
select datediff("1997-11-31 23:59:59.000001",null);
|
||||
|
||||
select weekofyear("1997-11-31 23:59:59.000001");
|
||||
|
||||
select makedate(1997,1);
|
||||
select makedate(1997,0);
|
||||
|
||||
#Time functions
|
||||
|
||||
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
|
||||
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
|
||||
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
|
||||
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
|
||||
select subtime("01:00:00.999999", "02:00:00.999998");
|
||||
select subtime("02:01:01.999999", "01:01:01.999999");
|
||||
|
||||
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
|
||||
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
|
||||
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
|
||||
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
|
||||
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
|
||||
|
||||
select maketime(10,11,12);
|
||||
select maketime(25,11,12);
|
||||
select maketime(-25,11,12);
|
||||
|
||||
#Extraction functions
|
||||
select timestamp("2001-12-01", "01:01:01.999999");
|
||||
select timestamp("2001-13-01", "01:01:01.000001");
|
||||
select timestamp("2001-12-01", "25:01:01");
|
||||
select timestamp("2001-12-01 01:01:01.000100");
|
||||
select timestamp("2001-12-01");
|
||||
select day("1997-12-31 23:59:59.000001");
|
||||
select date("1997-12-31 23:59:59.000001");
|
||||
select date("1997-13-31 23:59:59.000001");
|
||||
select time("1997-12-31 23:59:59.000001");
|
||||
select time("1997-12-31 25:59:59.000001");
|
||||
select microsecond("1997-12-31 23:59:59.000001");
|
||||
|
||||
create table t1
|
||||
select makedate(1997,1) as f1,
|
||||
addtime(cast("1997-12-31 23:59:59.000001" as datetime), "1 1:1:1.000002") as f2,
|
||||
addtime(cast("23:59:59.999999" as time) , "1 1:1:1.000002") as f3,
|
||||
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
|
||||
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
|
||||
maketime(10,11,12) as f6,
|
||||
timestamp(cast("2001-12-01" as date), "01:01:01") as f7,
|
||||
date("1997-12-31 23:59:59.000001") as f8,
|
||||
time("1997-12-31 23:59:59.000001") as f9;
|
||||
describe t1;
|
||||
select * from t1;
|
||||
|
||||
create table test(t1 datetime, t2 time, t3 time, t4 datetime);
|
||||
insert into test values
|
||||
('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
|
||||
('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"),
|
||||
('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'),
|
||||
('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null),
|
||||
('2001-01-01 01:01:01', null, '-1 01:01:01', null),
|
||||
(null, null, null, null),
|
||||
('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01');
|
||||
|
||||
SELECT ADDTIME(t1,t2) As ttt, ADDTIME(t2, t3) As qqq from test;
|
||||
SELECT TIMEDIFF(t1,t4) As ttt, TIMEDIFF(t2, t3) As qqq from test;
|
||||
|
||||
drop table t1, test;
|
|
@ -8,6 +8,8 @@
|
|||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
set names latin1;
|
||||
|
||||
select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
|
||||
select 'hello' 'monty';
|
||||
select length('\n\t\r\b\0\_\%\\');
|
||||
|
@ -136,6 +138,42 @@ DROP TABLE t1;
|
|||
#
|
||||
# Test collation and coercibility
|
||||
#
|
||||
|
||||
select 1=_latin1'1';
|
||||
select _latin1'1'=1;
|
||||
select _latin2'1'=1;
|
||||
select 1=_latin2'1';
|
||||
--error 1265
|
||||
select _latin1'1'=_latin2'1';
|
||||
select row('a','b','c') = row('a','b','c');
|
||||
select row('A','b','c') = row('a','b','c');
|
||||
select row('A' COLLATE latin1_bin,'b','c') = row('a','b','c');
|
||||
select row('A','b','c') = row('a' COLLATE latin1_bin,'b','c');
|
||||
--error 1265
|
||||
select row('A' COLLATE latin1_general_ci,'b','c') = row('a' COLLATE latin1_bin,'b','c');
|
||||
|
||||
--error 1265
|
||||
select concat(_latin1'a',_latin2'a');
|
||||
--error 1268
|
||||
select concat(_latin1'a',_latin2'a',_latin5'a');
|
||||
--error 1269
|
||||
select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a');
|
||||
|
||||
|
||||
#
|
||||
# Test FIELD() and collations
|
||||
#
|
||||
select FIELD('b','A','B');
|
||||
select FIELD('B','A','B');
|
||||
select FIELD('b' COLLATE latin1_bin,'A','B');
|
||||
select FIELD('b','A' COLLATE latin1_bin,'B');
|
||||
--error 1268
|
||||
select FIELD(_latin2'b','A','B');
|
||||
--error 1268
|
||||
select FIELD('b',_latin2'A','B');
|
||||
select FIELD('b',_latin2'A','B',1);
|
||||
|
||||
|
||||
select POSITION(_latin1'B' IN _latin1'abcd');
|
||||
select POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin);
|
||||
select POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd');
|
||||
|
@ -179,15 +217,15 @@ select _latin1'B' in (_latin1'a',_latin1'b');
|
|||
select _latin1'B' collate latin1_bin in (_latin1'a',_latin1'b');
|
||||
select _latin1'B' in (_latin1'a' collate latin1_bin,_latin1'b');
|
||||
select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin);
|
||||
--error 1269
|
||||
--error 1268
|
||||
select _latin2'B' in (_latin1'a',_latin1'b');
|
||||
--error 1269
|
||||
--error 1268
|
||||
select _latin1'B' in (_latin2'a',_latin1'b');
|
||||
--error 1269
|
||||
--error 1268
|
||||
select _latin1'B' in (_latin1'a',_latin2'b');
|
||||
--error 1269
|
||||
--error 1268
|
||||
select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b');
|
||||
--error 1269
|
||||
--error 1268
|
||||
select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin);
|
||||
|
||||
select collation(bin(130)), coercibility(bin(130));
|
||||
|
@ -256,3 +294,14 @@ select
|
|||
;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# test for SUBSTR
|
||||
#
|
||||
select SUBSTR('abcdefg',3,2);
|
||||
select SUBSTRING('abcdefg',3,2);
|
||||
select SUBSTR('abcdefg',-3,2) FROM DUAL;
|
||||
select SUBSTR('abcdefg',-1,5) FROM DUAL;
|
||||
select SUBSTR('abcdefg',0,0) FROM DUAL;
|
||||
select SUBSTR('abcdefg',-1,-1) FROM DUAL;
|
||||
select SUBSTR('abcdefg',1,-1) FROM DUAL;
|
||||
|
|
|
@ -85,3 +85,17 @@ alter table t1 type=MyISAM;
|
|||
handler t2 read first;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# test case for the bug #787
|
||||
#
|
||||
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6);
|
||||
delete from t1 limit 2;
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
handler t1 read first limit 1,1;
|
||||
handler t1 read first limit 2,2;
|
||||
delete from t1 limit 3;
|
||||
handler t1 read first;
|
||||
drop table t1;
|
||||
|
|
|
@ -22,7 +22,7 @@ drop table t1;
|
|||
|
||||
#
|
||||
# A bit bigger test
|
||||
# The 'replace_result' statements are needed because the cardinality calculated
|
||||
# The 'replace_column' statements are needed because the cardinality calculated
|
||||
# by innodb is not always the same between runs
|
||||
#
|
||||
|
||||
|
@ -51,7 +51,7 @@ select * from t1 where parent_id=102;
|
|||
select level,id from t1 where level=1;
|
||||
select level,id,parent_id from t1 where level=1;
|
||||
optimize table t1;
|
||||
--replace_result 87 # 50 # 48 # 43 # 25 # 24 # 6 # 3 #
|
||||
--replace_column 7 #
|
||||
show keys from t1;
|
||||
drop table t1;
|
||||
|
||||
|
|
1
mysql-test/t/key_cache-master.opt
Normal file
1
mysql-test/t/key_cache-master.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--key_buffer_size=2M --small.key_buffer_size=256K --small.key_buffer_size=128K
|
42
mysql-test/t/key_cache.test
Normal file
42
mysql-test/t/key_cache.test
Normal file
|
@ -0,0 +1,42 @@
|
|||
#
|
||||
# Test of key cache
|
||||
#
|
||||
|
||||
SET @save_key_buffer=@@key_buffer_size;
|
||||
|
||||
SELECT @@key_buffer_size, @@small.key_buffer_size;
|
||||
|
||||
# Change default key cache size
|
||||
SET @@global.key_buffer_size=16*1024*1024;
|
||||
SET @@global.default.key_buffer_size=16*1024*1024;
|
||||
SET @@global.default.key_buffer_size=16*1024*1024;
|
||||
|
||||
SET @@global.small.key_buffer_size=1*1024*1024;
|
||||
SET @@global.medium.key_buffer_size=4*1024*1024;
|
||||
# Drop buffer
|
||||
SET @@global.medium.key_buffer_size=0;
|
||||
# Test double drop
|
||||
SET @@global.medium.key_buffer_size=0;
|
||||
|
||||
# Print key buffer with different syntaxes
|
||||
SHOW VARIABLES like "key_buffer_size";
|
||||
SELECT @@key_buffer_size;
|
||||
SELECT @@global.key_buffer_size;
|
||||
SELECT @@global.default.key_buffer_size;
|
||||
SELECT @@global.default.`key_buffer_size`;
|
||||
SELECT @@global.`default`.`key_buffer_size`;
|
||||
SELECT @@`default`.key_buffer_size;
|
||||
|
||||
SELECT @@small.key_buffer_size;
|
||||
SELECT @@medium.key_buffer_size;
|
||||
|
||||
SET @@global.key_buffer_size=@save_key_buffer;
|
||||
|
||||
#
|
||||
# Errors
|
||||
#
|
||||
|
||||
--error 1064
|
||||
SELECT @@default.key_buffer_size;
|
||||
--error 1270
|
||||
SELECT @@skr.table_type="test";
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t5,t6;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int not null primary key auto_increment, message char(20));
|
||||
|
@ -48,12 +49,22 @@ show create table t3;
|
|||
create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2);
|
||||
--error 1016
|
||||
select * from t4;
|
||||
--error 1212
|
||||
create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2);
|
||||
--error 1016
|
||||
alter table t4 add column c int;
|
||||
|
||||
#
|
||||
# Test tables in different databases
|
||||
#
|
||||
create database mysqltest;
|
||||
create table mysqltest.t6 (a int not null primary key auto_increment, message char(20));
|
||||
create table t5 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,mysqltest.t6);
|
||||
show create table t5;
|
||||
alter table t5 type=myisam;
|
||||
drop table t5, mysqltest.t6;
|
||||
drop database mysqltest;
|
||||
|
||||
# Because of windows, it's important that we drop the merge tables first!
|
||||
# This should give a warning on table t5
|
||||
drop table if exists t5,t4,t3,t1,t2;
|
||||
drop table t4,t3,t1,t2;
|
||||
|
||||
create table t1 (c char(10)) type=myisam;
|
||||
create table t2 (c char(10)) type=myisam;
|
||||
|
@ -177,7 +188,9 @@ select * from t1 order by a,b;
|
|||
select * from t2 order by a,b;
|
||||
select * from t5 order by a,b;
|
||||
select * from t6 order by a,b;
|
||||
drop table if exists t6, t5, t4, t3, t2, t1;
|
||||
insert into t1 values (99,NULL);
|
||||
select * from t4 where a+0 > 90;
|
||||
drop table t6, t5, t4, t3, t2, t1;
|
||||
|
||||
CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1), (2,1);
|
||||
|
@ -186,7 +199,7 @@ INSERT INTO t2 VALUES (1,2), (2,2);
|
|||
CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2);
|
||||
select max(b) from t3 where a = 2;
|
||||
select max(b) from t1 where a = 2;
|
||||
drop table if exists t3,t1,t2;
|
||||
drop table t3,t1,t2;
|
||||
|
||||
#
|
||||
# temporary merge tables
|
||||
|
@ -203,7 +216,7 @@ insert into t4 values (1);
|
|||
insert into t5 values (2);
|
||||
create temporary table t6 (a int not null) TYPE=MERGE UNION=(t4,t5);
|
||||
select * from t6;
|
||||
drop table if exists t6, t3, t1, t2, t4, t5;
|
||||
drop table t6, t3, t1, t2, t4, t5;
|
||||
|
||||
#
|
||||
# testing merge::records_in_range and optimizer
|
||||
|
|
|
@ -14,6 +14,7 @@ explain select * from t1 where a=2 and b = 2;
|
|||
explain select * from t1 where a<=>b limit 2;
|
||||
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
|
||||
explain select * from t1 where (a is null or a = 7) and b=7;
|
||||
explain select * from t1 where (a is null or a = 7) and b=7 order by a;
|
||||
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
|
||||
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
|
||||
explain select * from t1 where a > 1 and a < 3 limit 1;
|
||||
|
@ -25,6 +26,8 @@ select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
|
|||
select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
|
||||
select * from t1 where (a is null or a = 7) and b=7;
|
||||
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
|
||||
explain select * from t1 where a is null and b = 2;
|
||||
explain select * from t1 where a is null and b = 2 and c=0;
|
||||
|
@ -47,8 +50,38 @@ select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
|
|||
select * from t1 where (a is null or a = 7) and b=7 and c=0;
|
||||
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
|
||||
select * from t1 where b like "6%";
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test ref_or_null optimization
|
||||
#
|
||||
drop table t1;
|
||||
rename table t2 to t1;
|
||||
alter table t1 modify b int null;
|
||||
insert into t1 values (7,null), (8,null), (8,7);
|
||||
explain select * from t1 where a = 7 and (b=7 or b is null);
|
||||
select * from t1 where a = 7 and (b=7 or b is null);
|
||||
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
||||
select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
||||
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
|
||||
select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
|
||||
create table t2 (a int);
|
||||
insert into t2 values (7),(8);
|
||||
explain select * from t2 straight_join t1 where t1.a=t2.a and b is null;
|
||||
drop index b on t1;
|
||||
explain select * from t2,t1 where t1.a=t2.a and b is null;
|
||||
select * from t2,t1 where t1.a=t2.a and b is null;
|
||||
explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
|
||||
select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
|
||||
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
|
||||
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
|
||||
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
|
||||
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
|
||||
insert into t2 values (null),(6);
|
||||
delete from t1 where a=8;
|
||||
explain select * from t2,t1 where t1.a=t2.a or t1.a is null;
|
||||
explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
|
||||
select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# The following failed for Matt Loschert
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
# Use mysql-test-run with --with-openssl option.
|
||||
-- source include/have_openssl_1.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(f1 int);
|
||||
insert into t1 values (5);
|
||||
|
||||
|
|
|
@ -90,9 +90,12 @@ connection master;
|
|||
sync_slave_with_master;
|
||||
connection master;
|
||||
purge master logs to 'master-bin.000002';
|
||||
show master logs;
|
||||
# we just tests if synonyms are accepted
|
||||
purge binary logs to 'master-bin.000002';
|
||||
show binary logs;
|
||||
--sleep 1;
|
||||
purge logs before now();
|
||||
purge master logs before now();
|
||||
show binary logs;
|
||||
insert into t2 values (65);
|
||||
sync_slave_with_master;
|
||||
|
|
|
@ -739,6 +739,19 @@ INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
|
|||
SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# uninterruptable update
|
||||
#
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (a int, b int);
|
||||
|
||||
insert into t1 values (1,0), (2,0), (3,0);
|
||||
insert into t2 values (1,1), (2,1), (3,1), (2,2);
|
||||
|
||||
update ignore t1 set b=(select b from t2 where t1.a=t2.a);
|
||||
select * from t1;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# correct behavoiur for function from reduced subselect
|
||||
|
@ -768,6 +781,7 @@ drop table if exists t1;
|
|||
#
|
||||
# key field overflow test
|
||||
#
|
||||
--disable_warnings
|
||||
CREATE TABLE t1
|
||||
(
|
||||
FOLDERID VARCHAR(32)BINARY NOT NULL
|
||||
|
@ -785,6 +799,7 @@ FOLDERID VARCHAR(32)BINARY NOT NULL
|
|||
|
||||
, PRIMARY KEY ( FOLDERID )
|
||||
) TYPE=InnoDB;
|
||||
--enable_warnings
|
||||
CREATE INDEX FFOLDERID_IDX ON t1 (FOLDERID);
|
||||
CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID);
|
||||
INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
|
||||
|
@ -792,3 +807,14 @@ INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "
|
|||
INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
|
||||
SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1');
|
||||
drop table t1;
|
||||
#
|
||||
# alloc_group_fields() working
|
||||
#
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (a int, b int);
|
||||
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
|
||||
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
|
||||
insert into t3 values (3,3), (2,2), (1,1);
|
||||
select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
|
||||
drop table t1,t2,t3;s
|
||||
|
|
|
@ -28,6 +28,7 @@ my_string my_load_path(my_string to, const char *path,
|
|||
const char *own_path_prefix)
|
||||
{
|
||||
char buff[FN_REFLEN];
|
||||
int is_cur;
|
||||
DBUG_ENTER("my_load_path");
|
||||
DBUG_PRINT("enter",("path: %s prefix: %s",path,
|
||||
own_path_prefix ? own_path_prefix : ""));
|
||||
|
@ -35,14 +36,16 @@ my_string my_load_path(my_string to, const char *path,
|
|||
if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) ||
|
||||
test_if_hard_path(path))
|
||||
VOID(strmov(buff,path));
|
||||
else if ((path[0] == FN_CURLIB && path[1] == FN_LIBCHAR) ||
|
||||
else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) ||
|
||||
(is_prefix((gptr) path,FN_PARENTDIR)) ||
|
||||
! own_path_prefix)
|
||||
{
|
||||
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)),MYF(0)))
|
||||
VOID(strcat(buff,path));
|
||||
if (is_cur)
|
||||
is_cur=2; /* Remove current dir */
|
||||
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0)))
|
||||
VOID(strcat(buff,path+is_cur));
|
||||
else
|
||||
VOID(strmov(buff,path));
|
||||
VOID(strmov(buff,path)); /* Return org file name */
|
||||
}
|
||||
else
|
||||
VOID(strxmov(buff,own_path_prefix,path,NullS));
|
||||
|
|
|
@ -32,7 +32,7 @@ static longlong getopt_ll(char *arg, const struct my_option *optp, int *err);
|
|||
static ulonglong getopt_ull(char *arg, const struct my_option *optp,
|
||||
int *err);
|
||||
static void init_variables(const struct my_option *options);
|
||||
static int setval(const struct my_option *opts, char *argument,
|
||||
static int setval(const struct my_option *opts, gptr *value, char *argument,
|
||||
my_bool set_maximum_value);
|
||||
static char *check_struct_option(char *cur_arg, char *key_name);
|
||||
|
||||
|
@ -68,9 +68,9 @@ my_bool my_getopt_print_errors= 1;
|
|||
one. Call function 'get_one_option()' once for each option.
|
||||
*/
|
||||
|
||||
static gptr* (*getopt_get_addr)(char *, uint, const struct my_option *);
|
||||
static gptr* (*getopt_get_addr)(const char *, uint, const struct my_option *);
|
||||
|
||||
void my_getopt_register_get_addr(gptr* (*func_addr)(char *, uint,
|
||||
void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
|
||||
const struct my_option *))
|
||||
{
|
||||
getopt_get_addr= func_addr;
|
||||
|
@ -395,7 +395,8 @@ int handle_options(int *argc, char ***argv,
|
|||
/* the other loop will break, because *optend + 1 == 0 */
|
||||
}
|
||||
}
|
||||
if ((error= setval(optp, argument, set_maximum_value)))
|
||||
if ((error= setval(optp, optp->value, argument,
|
||||
set_maximum_value)))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: Error while setting value '%s' to '%s'\n",
|
||||
|
@ -417,7 +418,7 @@ int handle_options(int *argc, char ***argv,
|
|||
(*argc)--; /* option handled (short), decrease argument count */
|
||||
continue;
|
||||
}
|
||||
if ((error= setval(optp, argument, set_maximum_value)))
|
||||
if ((error= setval(optp, value, argument, set_maximum_value)))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: Error while setting value '%s' to '%s'\n",
|
||||
|
@ -473,13 +474,13 @@ static char *check_struct_option(char *cur_arg, char *key_name)
|
|||
if (end - ptr > 1)
|
||||
{
|
||||
uint len= ptr - cur_arg;
|
||||
strnmov(key_name, cur_arg, len);
|
||||
key_name[len]= '\0';
|
||||
set_if_smaller(len, FN_REFLEN-1);
|
||||
strmake(key_name, cur_arg, len);
|
||||
return ++ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
key_name= 0;
|
||||
key_name[0]= 0;
|
||||
return cur_arg;
|
||||
}
|
||||
}
|
||||
|
@ -491,15 +492,15 @@ static char *check_struct_option(char *cur_arg, char *key_name)
|
|||
Will set the option value to given value
|
||||
*/
|
||||
|
||||
static int setval(const struct my_option *opts, char *argument,
|
||||
static int setval(const struct my_option *opts, gptr *value, char *argument,
|
||||
my_bool set_maximum_value)
|
||||
{
|
||||
int err= 0;
|
||||
|
||||
if (opts->value && argument)
|
||||
if (value && argument)
|
||||
{
|
||||
gptr *result_pos= ((set_maximum_value) ?
|
||||
opts->u_max_value : opts->value);
|
||||
opts->u_max_value : value);
|
||||
|
||||
if (!result_pos)
|
||||
return EXIT_NO_PTR_TO_VARIABLE;
|
||||
|
@ -692,43 +693,45 @@ static void init_variables(const struct my_option *options)
|
|||
{
|
||||
for (; options->name; options++)
|
||||
{
|
||||
if (options->value)
|
||||
gptr *value= (options->var_type & GET_ASK_ADDR ?
|
||||
(*getopt_get_addr)("", 0, options) : options->value);
|
||||
if (value)
|
||||
{
|
||||
switch ((options->var_type & GET_TYPE_MASK)) {
|
||||
case GET_BOOL:
|
||||
if (options->u_max_value)
|
||||
*((my_bool*) options->u_max_value)= (my_bool) options->max_value;
|
||||
*((my_bool*) options->value)= (my_bool) options->def_value;
|
||||
*((my_bool*) value)= (my_bool) options->def_value;
|
||||
break;
|
||||
case GET_INT:
|
||||
if (options->u_max_value)
|
||||
*((int*) options->u_max_value)= (int) options->max_value;
|
||||
*((int*) options->value)= (int) options->def_value;
|
||||
*((int*) value)= (int) options->def_value;
|
||||
break;
|
||||
case GET_UINT:
|
||||
if (options->u_max_value)
|
||||
*((uint*) options->u_max_value)= (uint) options->max_value;
|
||||
*((uint*) options->value)= (uint) options->def_value;
|
||||
*((uint*) value)= (uint) options->def_value;
|
||||
break;
|
||||
case GET_LONG:
|
||||
if (options->u_max_value)
|
||||
*((long*) options->u_max_value)= (long) options->max_value;
|
||||
*((long*) options->value)= (long) options->def_value;
|
||||
*((long*) value)= (long) options->def_value;
|
||||
break;
|
||||
case GET_ULONG:
|
||||
if (options->u_max_value)
|
||||
*((ulong*) options->u_max_value)= (ulong) options->max_value;
|
||||
*((ulong*) options->value)= (ulong) options->def_value;
|
||||
*((ulong*) value)= (ulong) options->def_value;
|
||||
break;
|
||||
case GET_LL:
|
||||
if (options->u_max_value)
|
||||
*((longlong*) options->u_max_value)= (longlong) options->max_value;
|
||||
*((longlong*) options->value)= (longlong) options->def_value;
|
||||
*((longlong*) value)= (longlong) options->def_value;
|
||||
break;
|
||||
case GET_ULL:
|
||||
if (options->u_max_value)
|
||||
*((ulonglong*) options->u_max_value)= (ulonglong) options->max_value;
|
||||
*((ulonglong*) options->value)= (ulonglong) options->def_value;
|
||||
*((ulonglong*) value)= (ulonglong) options->def_value;
|
||||
break;
|
||||
default: /* dummy default to avoid compiler warnings */
|
||||
break;
|
||||
|
@ -831,7 +834,9 @@ void my_print_variables(const struct my_option *options)
|
|||
printf("--------------------------------- -----------------------------\n");
|
||||
for (optp= options; optp->id; optp++)
|
||||
{
|
||||
if (optp->value)
|
||||
gptr *value= (optp->var_type & GET_ASK_ADDR ?
|
||||
(*getopt_get_addr)("", 0, optp) : optp->value);
|
||||
if (value)
|
||||
{
|
||||
printf("%s", optp->name);
|
||||
length= strlen(optp->name);
|
||||
|
@ -840,29 +845,29 @@ void my_print_variables(const struct my_option *options)
|
|||
switch ((optp->var_type & GET_TYPE_MASK)) {
|
||||
case GET_STR:
|
||||
case GET_STR_ALLOC: /* fall through */
|
||||
printf("%s\n", *((char**) optp->value) ? *((char**) optp->value) :
|
||||
printf("%s\n", *((char**) value) ? *((char**) value) :
|
||||
"(No default value)");
|
||||
break;
|
||||
case GET_BOOL:
|
||||
printf("%s\n", *((my_bool*) optp->value) ? "TRUE" : "FALSE");
|
||||
printf("%s\n", *((my_bool*) value) ? "TRUE" : "FALSE");
|
||||
break;
|
||||
case GET_INT:
|
||||
printf("%d\n", *((int*) optp->value));
|
||||
printf("%d\n", *((int*) value));
|
||||
break;
|
||||
case GET_UINT:
|
||||
printf("%d\n", *((uint*) optp->value));
|
||||
printf("%d\n", *((uint*) value));
|
||||
break;
|
||||
case GET_LONG:
|
||||
printf("%lu\n", *((long*) optp->value));
|
||||
printf("%lu\n", *((long*) value));
|
||||
break;
|
||||
case GET_ULONG:
|
||||
printf("%lu\n", *((ulong*) optp->value));
|
||||
printf("%lu\n", *((ulong*) value));
|
||||
break;
|
||||
case GET_LL:
|
||||
printf("%s\n", llstr(*((longlong*) optp->value), buff));
|
||||
printf("%s\n", llstr(*((longlong*) value), buff));
|
||||
break;
|
||||
case GET_ULL:
|
||||
longlong2str(*((ulonglong*) optp->value), buff, 10);
|
||||
longlong2str(*((ulonglong*) value), buff, 10);
|
||||
printf("%s\n", buff);
|
||||
break;
|
||||
default: /* dummy default to avoid compiler warnings */
|
||||
|
|
|
@ -123,20 +123,22 @@ int my_realpath(char *to, const char *filename,
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Realpath didn't work; Use original name */
|
||||
/*
|
||||
Realpath didn't work; Use my_load_path() which is a poor substitute
|
||||
original name but will at least be able to resolve paths that starts
|
||||
with '.'.
|
||||
*/
|
||||
DBUG_PRINT("error",("realpath failed with errno: %d", errno));
|
||||
my_errno=errno;
|
||||
if (MyFlags & MY_WME)
|
||||
my_error(EE_REALPATH, MYF(0), filename, my_errno);
|
||||
if (to != filename)
|
||||
strmov(to,filename);
|
||||
my_load_path(to, filename, NullS);
|
||||
result= -1;
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(result);
|
||||
#else
|
||||
if (to != filename)
|
||||
strmov(to,filename);
|
||||
my_load_path(to, filename, NullS);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ gen_lex_hash.o: gen_lex_hash.cc lex.h
|
|||
sql_yacc.cc: sql_yacc.yy
|
||||
sql_yacc.h: sql_yacc.yy
|
||||
|
||||
sql_yacc.o: sql_yacc.cc sql_yacc.h
|
||||
sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS)
|
||||
@echo "Note: The following compile may take a long time."
|
||||
@echo "If it fails, re-run configure with --with-low-memory"
|
||||
$(CXXCOMPILE) $(LM_CFLAGS) -c $<
|
||||
|
|
|
@ -3152,11 +3152,13 @@ bool Field_time::get_time(TIME *ltime)
|
|||
ltime->neg= 1;
|
||||
tmp=-tmp;
|
||||
}
|
||||
ltime->day= 0;
|
||||
ltime->hour= (int) (tmp/10000);
|
||||
tmp-=ltime->hour*10000;
|
||||
ltime->minute= (int) tmp/100;
|
||||
ltime->second= (int) tmp % 100;
|
||||
ltime->second_part=0;
|
||||
ltime->time_type= TIMESTAMP_TIME;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -489,6 +489,8 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
|
|||
if (!to->eq_def(from))
|
||||
return do_field_string;
|
||||
}
|
||||
else if (to->charset() != from->charset())
|
||||
return do_field_string;
|
||||
else if (to->real_type() == FIELD_TYPE_VAR_STRING && to_length !=
|
||||
from_length)
|
||||
return do_varstring;
|
||||
|
|
|
@ -303,14 +303,40 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
|
|||
return to;
|
||||
}
|
||||
|
||||
|
||||
/* Find out database name and table name from a filename */
|
||||
|
||||
static void split_file_name(const char *file_name,
|
||||
LEX_STRING *db, LEX_STRING *name)
|
||||
{
|
||||
uint name_length, dir_length, prefix_length;
|
||||
char buff[FN_REFLEN];
|
||||
|
||||
db->length= 0;
|
||||
name_length= (uint) (strmake(buff, file_name, sizeof(buff)-1) - buff);
|
||||
dir_length= dirname_length(buff);
|
||||
if (dir_length > 1)
|
||||
{
|
||||
/* Get database */
|
||||
buff[dir_length-1]= 0; // Remove end '/'
|
||||
prefix_length= dirname_length(buff);
|
||||
db->str= (char*) file_name+ prefix_length;
|
||||
db->length= dir_length - prefix_length -1;
|
||||
}
|
||||
name->str= (char*) file_name+ dir_length;
|
||||
name->length= (uint) (fn_ext(name->str) - name->str);
|
||||
}
|
||||
|
||||
|
||||
void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
|
||||
{
|
||||
// [phi] auto_increment stuff is missing (but currently not needed)
|
||||
DBUG_ENTER("ha_myisammrg::update_create_info");
|
||||
|
||||
if (!(create_info->used_fields & HA_CREATE_USED_UNION))
|
||||
{
|
||||
MYRG_TABLE *open_table;
|
||||
THD *thd=current_thd;
|
||||
|
||||
create_info->merge_list.next= &create_info->merge_list.first;
|
||||
create_info->merge_list.elements=0;
|
||||
|
||||
|
@ -318,14 +344,17 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
|
|||
open_table != file->end_table ;
|
||||
open_table++)
|
||||
{
|
||||
char *name=open_table->table->filename;
|
||||
char buff[FN_REFLEN];
|
||||
TABLE_LIST *ptr;
|
||||
LEX_STRING db, name;
|
||||
|
||||
if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
|
||||
goto err;
|
||||
fn_format(buff,name,"","",3);
|
||||
if (!(ptr->real_name=thd->strdup(buff)))
|
||||
split_file_name(open_table->table->filename, &db, &name);
|
||||
if (!(ptr->real_name= thd->strmake(name.str, name.length)))
|
||||
goto err;
|
||||
if (db.length && !(ptr->db= thd->strmake(db.str, db.length)))
|
||||
goto err;
|
||||
|
||||
create_info->merge_list.elements++;
|
||||
(*create_info->merge_list.next) = (byte*) ptr;
|
||||
create_info->merge_list.next= (byte**) &ptr->next;
|
||||
|
@ -344,37 +373,34 @@ err:
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
int ha_myisammrg::create(const char *name, register TABLE *form,
|
||||
HA_CREATE_INFO *create_info)
|
||||
{
|
||||
char buff[FN_REFLEN],**table_names,**pos;
|
||||
TABLE_LIST *tables= (TABLE_LIST*) create_info->merge_list.first;
|
||||
THD *thd= current_thd;
|
||||
DBUG_ENTER("ha_myisammrg::create");
|
||||
|
||||
if (!(table_names= (char**) sql_alloc((create_info->merge_list.elements+1)*
|
||||
if (!(table_names= (char**) thd->alloc((create_info->merge_list.elements+1)*
|
||||
sizeof(char*))))
|
||||
DBUG_RETURN(1);
|
||||
for (pos=table_names ; tables ; tables=tables->next)
|
||||
{
|
||||
char *table_name;
|
||||
TABLE **tbl= 0;
|
||||
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
||||
{
|
||||
TABLE **tbl=find_temporary_table(current_thd,
|
||||
tables->db, tables->real_name);
|
||||
tbl= find_temporary_table(thd, tables->db, tables->real_name);
|
||||
if (!tbl)
|
||||
{
|
||||
table_name=sql_alloc(1+
|
||||
my_snprintf(buff,FN_REFLEN,"%s/%s/%s",mysql_real_data_home,
|
||||
tables->db, tables->real_name));
|
||||
if (!table_name)
|
||||
uint length= my_snprintf(buff,FN_REFLEN,"%s%s/%s",
|
||||
mysql_real_data_home,
|
||||
tables->db, tables->real_name);
|
||||
if (!(table_name= thd->strmake(buff, length)))
|
||||
DBUG_RETURN(1);
|
||||
strcpy(table_name, buff);
|
||||
}
|
||||
else
|
||||
table_name=(*tbl)->path;
|
||||
}
|
||||
else
|
||||
table_name=tables->real_name;
|
||||
*pos++= table_name;
|
||||
}
|
||||
*pos=0;
|
||||
|
@ -384,9 +410,13 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
|
|||
(my_bool) 0));
|
||||
}
|
||||
|
||||
|
||||
void ha_myisammrg::append_create_info(String *packet)
|
||||
{
|
||||
char buff[FN_REFLEN];
|
||||
const char *current_db;
|
||||
uint db_length;
|
||||
THD *thd= current_thd;
|
||||
|
||||
if (file->merge_insert_method != MERGE_INSERT_DISABLED)
|
||||
{
|
||||
packet->append(" INSERT_METHOD=",15);
|
||||
|
@ -395,15 +425,26 @@ void ha_myisammrg::append_create_info(String *packet)
|
|||
packet->append(" UNION=(",8);
|
||||
MYRG_TABLE *open_table,*first;
|
||||
|
||||
current_db= table->table_cache_key;
|
||||
db_length= strlen(current_db);
|
||||
|
||||
for (first=open_table=file->open_tables ;
|
||||
open_table != file->end_table ;
|
||||
open_table++)
|
||||
{
|
||||
char *name= open_table->table->filename;
|
||||
fn_format(buff,name,"","",3);
|
||||
LEX_STRING db, name;
|
||||
split_file_name(open_table->table->filename, &db, &name);
|
||||
if (open_table != first)
|
||||
packet->append(',');
|
||||
packet->append(buff,(uint) strlen(buff));
|
||||
/* Report database for mapped table if it isn't in current database */
|
||||
if (db.length &&
|
||||
(db_length != db.length ||
|
||||
strncmp(current_db, db.str, db.length)))
|
||||
{
|
||||
append_identifier(thd, packet, db.str, db.length);
|
||||
packet->append('.');
|
||||
}
|
||||
append_identifier(thd, packet, name.str, name.length);
|
||||
}
|
||||
packet->append(')');
|
||||
}
|
||||
|
|
|
@ -714,6 +714,8 @@ void handler::update_auto_increment()
|
|||
nr=get_auto_increment();
|
||||
if (!table->next_number_field->store(nr))
|
||||
thd->insert_id((ulonglong) nr);
|
||||
else
|
||||
thd->insert_id(table->next_number_field->val_int());
|
||||
auto_increment_column_changed=1;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,13 @@ Item::Item():
|
|||
next= thd->free_list; // Put in free list
|
||||
thd->free_list= this;
|
||||
loop_id= 0;
|
||||
if (thd->lex.current_select->parsing_place == SELECT_LEX_NODE::SELECT_LIST)
|
||||
/*
|
||||
Item constructor can be called during execution other tnen SQL_COM
|
||||
command => we should check thd->lex.current_select on zero (thd->lex
|
||||
can be uninitialised)
|
||||
*/
|
||||
if (thd->lex.current_select &&
|
||||
thd->lex.current_select->parsing_place == SELECT_LEX_NODE::SELECT_LIST)
|
||||
thd->lex.current_select->select_items++;
|
||||
}
|
||||
|
||||
|
|
|
@ -185,9 +185,6 @@ public:
|
|||
collation.collation= collation_arg->collation;
|
||||
collation.derivation= collation_arg->derivation;
|
||||
}
|
||||
bool binary() const
|
||||
{ return charset()->state & MY_CS_BINSORT ? 1 : 0 ; }
|
||||
|
||||
virtual void set_outer_resolving() {}
|
||||
|
||||
// Row emulation
|
||||
|
|
|
@ -32,18 +32,6 @@ static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fnam
|
|||
fname);
|
||||
}
|
||||
|
||||
static void my_coll_agg3_error(DTCollation &c1,
|
||||
DTCollation &c2,
|
||||
DTCollation &c3,
|
||||
const char *fname)
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_3COLLATIONS,MYF(0),
|
||||
c1.collation->name,c1.derivation_name(),
|
||||
c2.collation->name,c2.derivation_name(),
|
||||
c3.collation->name,c3.derivation_name(),
|
||||
fname);
|
||||
}
|
||||
|
||||
Item_bool_func2* Item_bool_func2::eq_creator(Item *a, Item *b)
|
||||
{
|
||||
return new Item_func_eq(a, b);
|
||||
|
@ -109,15 +97,6 @@ static bool convert_constant_item(Field *field, Item **item)
|
|||
}
|
||||
|
||||
|
||||
bool Item_bool_func2::fix_fields(THD *thd, struct st_table_list *tables,
|
||||
Item ** ref)
|
||||
{
|
||||
if (Item_int_func::fix_fields(thd, tables, ref))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Item_bool_func2::fix_length_and_dec()
|
||||
{
|
||||
max_length= 1; // Function returns 0 or 1
|
||||
|
@ -191,8 +170,6 @@ void Item_bool_func2::fix_length_and_dec()
|
|||
{
|
||||
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
|
||||
INT_RESULT); // Works for all types.
|
||||
cmp_collation.set(&my_charset_bin,
|
||||
DERIVATION_NONE); // For test in fix_fields
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -206,23 +183,11 @@ void Item_bool_func2::fix_length_and_dec()
|
|||
{
|
||||
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
|
||||
INT_RESULT); // Works for all types.
|
||||
cmp_collation.set(&my_charset_bin,
|
||||
DERIVATION_NONE); // For test in fix_fields
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
set_cmp_func();
|
||||
/*
|
||||
We must set cmp_charset here as we may be called from for an automatic
|
||||
generated item, like in natural join
|
||||
*/
|
||||
if (cmp_collation.set(args[0]->collation, args[1]->collation))
|
||||
{
|
||||
/* set_cmp_charset() failed */
|
||||
my_coll_agg_error(args[0]->collation, args[1]->collation, func_name());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -252,6 +217,18 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
|
|||
comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
|
||||
}
|
||||
}
|
||||
else if (type == STRING_RESULT)
|
||||
{
|
||||
/*
|
||||
We must set cmp_charset here as we may be called from for an automatic
|
||||
generated item, like in natural join
|
||||
*/
|
||||
if (cmp_collation.set((*a)->collation, (*b)->collation))
|
||||
{
|
||||
my_coll_agg_error((*a)->collation, (*b)->collation, owner->func_name());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -264,7 +241,7 @@ int Arg_comparator::compare_string()
|
|||
if ((res2= (*b)->val_str(&owner->tmp_value2)))
|
||||
{
|
||||
owner->null_value= 0;
|
||||
return sortcmp(res1,res2,owner->cmp_collation.collation);
|
||||
return sortcmp(res1,res2,cmp_collation.collation);
|
||||
}
|
||||
}
|
||||
owner->null_value= 1;
|
||||
|
@ -278,7 +255,7 @@ int Arg_comparator::compare_e_string()
|
|||
res2= (*b)->val_str(&owner->tmp_value2);
|
||||
if (!res1 || !res2)
|
||||
return test(res1 == res2);
|
||||
return test(sortcmp(res1, res2, owner->cmp_collation.collation) == 0);
|
||||
return test(sortcmp(res1, res2, cmp_collation.collation) == 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -380,12 +357,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
|
|||
return 1;
|
||||
if (args[0]->maybe_null)
|
||||
maybe_null=1;
|
||||
/*
|
||||
TODO: Check if following is right
|
||||
(set_charset set type of result, not how compare should be used)
|
||||
*/
|
||||
if (args[0]->binary())
|
||||
set_charset(&my_charset_bin);
|
||||
|
||||
with_sum_func= args[0]->with_sum_func;
|
||||
used_tables_cache= args[0]->used_tables();
|
||||
const_item_cache= args[0]->const_item();
|
||||
|
@ -507,7 +479,7 @@ longlong Item_func_strcmp::val_int()
|
|||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
int value= sortcmp(a,b,cmp_collation.collation);
|
||||
int value= sortcmp(a,b,cmp.cmp_collation.collation);
|
||||
null_value=0;
|
||||
return !value ? 0 : (value < 0 ? (longlong) -1 : (longlong) 1);
|
||||
}
|
||||
|
@ -588,18 +560,9 @@ void Item_func_between::fix_length_and_dec()
|
|||
item_cmp_type(args[1]->result_type(),
|
||||
args[2]->result_type()));
|
||||
|
||||
if (cmp_type == STRING_RESULT)
|
||||
{
|
||||
cmp_collation.set(args[0]->collation);
|
||||
if (!cmp_collation.aggregate(args[1]->collation))
|
||||
cmp_collation.aggregate(args[2]->collation);
|
||||
if (cmp_collation.derivation == DERIVATION_NONE)
|
||||
{
|
||||
my_coll_agg3_error(args[0]->collation, args[1]->collation,
|
||||
args[2]->collation, func_name());
|
||||
if (cmp_type == STRING_RESULT &&
|
||||
agg_arg_collations_for_comparison(cmp_collation, args, 3))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Make a special case of compare with date/time and longlong fields.
|
||||
|
@ -707,8 +670,8 @@ Item_func_ifnull::fix_length_and_dec()
|
|||
args[1]->result_type())) !=
|
||||
REAL_RESULT)
|
||||
decimals= 0;
|
||||
if (collation.set(args[0]->collation,args[1]->collation))
|
||||
my_coll_agg_error(args[0]->collation, args[1]->collation, func_name());
|
||||
if (cached_result_type == STRING_RESULT)
|
||||
agg_arg_collations(collation, args, arg_count);
|
||||
}
|
||||
|
||||
|
||||
|
@ -784,12 +747,9 @@ Item_func_if::fix_length_and_dec()
|
|||
else if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT)
|
||||
{
|
||||
cached_result_type = STRING_RESULT;
|
||||
if (collation.set(args[1]->collation, args[2]->collation))
|
||||
{
|
||||
my_coll_agg_error(args[0]->collation, args[1]->collation, func_name());
|
||||
if (agg_arg_collations(collation, args+1, 2))
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
set_charset(&my_charset_bin); // Number
|
||||
|
@ -933,7 +893,7 @@ Item *Item_func_case::find_item(String *str)
|
|||
if ((tmp=args[i]->val_str(str))) // If not null
|
||||
{
|
||||
/* QQ: COERCIBILITY */
|
||||
if (first_expr_is_binary || args[i]->binary())
|
||||
if (first_expr_is_binary || (args[i]->charset()->state & MY_CS_BINSORT))
|
||||
{
|
||||
if (sortcmp(tmp,first_expr_str,&my_charset_bin)==0)
|
||||
return args[i+1];
|
||||
|
@ -1044,7 +1004,7 @@ Item_func_case::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
used_tables_cache|=(first_expr)->used_tables();
|
||||
const_item_cache&= (first_expr)->const_item();
|
||||
with_sum_func= with_sum_func || (first_expr)->with_sum_func;
|
||||
first_expr_is_binary= first_expr->binary();
|
||||
first_expr_is_binary= first_expr->charset()->state & MY_CS_BINSORT;
|
||||
}
|
||||
if (else_expr)
|
||||
{
|
||||
|
@ -1189,7 +1149,13 @@ void Item_func_coalesce::fix_length_and_dec()
|
|||
{
|
||||
set_if_bigger(max_length,args[i]->max_length);
|
||||
set_if_bigger(decimals,args[i]->decimals);
|
||||
cached_result_type=item_store_type(cached_result_type,
|
||||
args[i]->result_type());
|
||||
}
|
||||
if (cached_result_type == STRING_RESULT)
|
||||
agg_arg_collations(collation, args, arg_count);
|
||||
else if (cached_result_type != REAL_RESULT)
|
||||
decimals= 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1454,7 +1420,7 @@ int cmp_item_row::compare(cmp_item *c)
|
|||
bool Item_func_in::nulls_in_row()
|
||||
{
|
||||
Item **arg,**arg_end;
|
||||
for (arg= args, arg_end= args+arg_count; arg != arg_end ; arg++)
|
||||
for (arg= args+1, arg_end= args+arg_count; arg != arg_end ; arg++)
|
||||
{
|
||||
if ((*arg)->null_inside())
|
||||
return 1;
|
||||
|
@ -1471,42 +1437,43 @@ static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y)
|
|||
|
||||
void Item_func_in::fix_length_and_dec()
|
||||
{
|
||||
Item **arg, **arg_end;
|
||||
uint const_itm= 1;
|
||||
|
||||
if ((args[0]->result_type() == STRING_RESULT) &&
|
||||
(agg_arg_collations_for_comparison(cmp_collation, args, arg_count)))
|
||||
return;
|
||||
|
||||
for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
|
||||
const_itm&= arg[0]->const_item();
|
||||
|
||||
/*
|
||||
Row item with NULLs inside can return NULL or FALSE =>
|
||||
they can't be processed as static
|
||||
*/
|
||||
if (const_item() && !nulls_in_row())
|
||||
if (const_itm && !nulls_in_row())
|
||||
{
|
||||
switch (item->result_type()) {
|
||||
switch (args[0]->result_type()) {
|
||||
case STRING_RESULT:
|
||||
uint i;
|
||||
cmp_collation.set(item->collation);
|
||||
for (i=0 ; i<arg_count; i++)
|
||||
if (cmp_collation.aggregate(args[i]->collation))
|
||||
break;
|
||||
if (cmp_collation.derivation == DERIVATION_NONE)
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_NCOLLATIONS,MYF(0),func_name());
|
||||
return;
|
||||
}
|
||||
array=new in_string(arg_count,(qsort2_cmp) srtcmp_in,
|
||||
array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in,
|
||||
cmp_collation.collation);
|
||||
break;
|
||||
case INT_RESULT:
|
||||
array= new in_longlong(arg_count);
|
||||
array= new in_longlong(arg_count-1);
|
||||
break;
|
||||
case REAL_RESULT:
|
||||
array= new in_double(arg_count);
|
||||
array= new in_double(arg_count-1);
|
||||
break;
|
||||
case ROW_RESULT:
|
||||
array= new in_row(arg_count, item);
|
||||
array= new in_row(arg_count-1, args[0]);
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
return;
|
||||
}
|
||||
uint j=0;
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
for (uint i=1 ; i < arg_count ; i++)
|
||||
{
|
||||
array->set(j,args[i]);
|
||||
if (!args[i]->null_value) // Skip NULL values
|
||||
|
@ -1519,19 +1486,19 @@ void Item_func_in::fix_length_and_dec()
|
|||
}
|
||||
else
|
||||
{
|
||||
in_item= cmp_item::get_comparator(item);
|
||||
in_item= cmp_item::get_comparator(args[0]);
|
||||
if (args[0]->result_type() == STRING_RESULT)
|
||||
in_item->cmp_charset= cmp_collation.collation;
|
||||
}
|
||||
maybe_null= item->maybe_null;
|
||||
maybe_null= args[0]->maybe_null;
|
||||
max_length= 1;
|
||||
used_tables_cache|=item->used_tables();
|
||||
const_item_cache&=item->const_item();
|
||||
const_item_cache&=args[0]->const_item();
|
||||
}
|
||||
|
||||
|
||||
void Item_func_in::print(String *str)
|
||||
{
|
||||
str->append('(');
|
||||
item->print(str);
|
||||
Item_func::print(str);
|
||||
str->append(')');
|
||||
}
|
||||
|
@ -1541,15 +1508,15 @@ longlong Item_func_in::val_int()
|
|||
{
|
||||
if (array)
|
||||
{
|
||||
int tmp=array->find(item);
|
||||
null_value=item->null_value || (!tmp && have_null);
|
||||
int tmp=array->find(args[0]);
|
||||
null_value=args[0]->null_value || (!tmp && have_null);
|
||||
return tmp;
|
||||
}
|
||||
in_item->store_value(item);
|
||||
if ((null_value=item->null_value))
|
||||
in_item->store_value(args[0]);
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0;
|
||||
have_null= 0;
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
for (uint i=1 ; i < arg_count ; i++)
|
||||
{
|
||||
if (!in_item->cmp(args[i]) && !args[i]->null_value)
|
||||
return 1; // Would maybe be nice with i ?
|
||||
|
@ -1560,29 +1527,6 @@ longlong Item_func_in::val_int()
|
|||
}
|
||||
|
||||
|
||||
void Item_func_in::update_used_tables()
|
||||
{
|
||||
Item_func::update_used_tables();
|
||||
item->update_used_tables();
|
||||
used_tables_cache|=item->used_tables();
|
||||
const_item_cache&=item->const_item();
|
||||
}
|
||||
|
||||
void Item_func_in::split_sum_func(Item **ref_pointer_array, List<Item> &fields)
|
||||
{
|
||||
if (item->with_sum_func && item->type() != SUM_FUNC_ITEM)
|
||||
item->split_sum_func(ref_pointer_array, fields);
|
||||
else if (item->used_tables() || item->type() == SUM_FUNC_ITEM)
|
||||
{
|
||||
uint el= fields.elements;
|
||||
fields.push_front(item);
|
||||
ref_pointer_array[el]= item;
|
||||
item= new Item_ref(ref_pointer_array + el, 0, item->name);
|
||||
}
|
||||
Item_func::split_sum_func(ref_pointer_array, fields);
|
||||
}
|
||||
|
||||
|
||||
longlong Item_func_bit_or::val_int()
|
||||
{
|
||||
ulonglong arg1= (ulonglong) args[0]->val_int();
|
||||
|
@ -1898,7 +1842,7 @@ longlong Item_func_like::val_int()
|
|||
null_value=0;
|
||||
if (canDoTurboBM)
|
||||
return turboBM_matches(res->ptr(), res->length()) ? 1 : 0;
|
||||
return my_wildcmp(cmp_collation.collation,
|
||||
return my_wildcmp(cmp.cmp_collation.collation,
|
||||
res->ptr(),res->ptr()+res->length(),
|
||||
res2->ptr(),res2->ptr()+res2->length(),
|
||||
escape,wild_one,wild_many) ? 0 : 1;
|
||||
|
@ -1988,11 +1932,8 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
max_length= 1;
|
||||
decimals= 0;
|
||||
|
||||
if (cmp_collation.set(args[0]->collation, args[1]->collation))
|
||||
{
|
||||
my_coll_agg_error(args[0]->collation, args[1]->collation, func_name());
|
||||
if (agg_arg_collations(cmp_collation, args, 2))
|
||||
return 1;
|
||||
}
|
||||
|
||||
used_tables_cache=args[0]->used_tables() | args[1]->used_tables();
|
||||
const_item_cache=args[0]->const_item() && args[1]->const_item();
|
||||
|
@ -2108,7 +2049,7 @@ void Item_func_like::turboBM_compute_suffixes(int *suff)
|
|||
|
||||
*splm1 = pattern_len;
|
||||
|
||||
if (cmp_collation.collation == &my_charset_bin)
|
||||
if (cmp.cmp_collation.collation == &my_charset_bin)
|
||||
{
|
||||
int i;
|
||||
for (i = pattern_len - 2; i >= 0; i--)
|
||||
|
@ -2211,7 +2152,7 @@ void Item_func_like::turboBM_compute_bad_character_shifts()
|
|||
for (i = bmBc; i < end; i++)
|
||||
*i = pattern_len;
|
||||
|
||||
if (cmp_collation.collation == &my_charset_bin)
|
||||
if (cmp.cmp_collation.collation == &my_charset_bin)
|
||||
{
|
||||
for (j = 0; j < plm1; j++)
|
||||
bmBc[(uint) (uchar) pattern[j]] = plm1 - j;
|
||||
|
@ -2242,7 +2183,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
|
|||
const int tlmpl= text_len - pattern_len;
|
||||
|
||||
/* Searching */
|
||||
if (cmp_collation.collation == &my_charset_bin)
|
||||
if (cmp.cmp_collation.collation == &my_charset_bin)
|
||||
{
|
||||
while (j <= tlmpl)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,8 @@ class Arg_comparator: public Sql_alloc
|
|||
Arg_comparator *comparators; // used only for compare_row()
|
||||
|
||||
public:
|
||||
DTCollation cmp_collation;
|
||||
|
||||
Arg_comparator() {};
|
||||
Arg_comparator(Item **a1, Item **a2): a(a1), b(a2) {};
|
||||
|
||||
|
@ -112,13 +114,10 @@ class Item_bool_func2 :public Item_int_func
|
|||
protected:
|
||||
Arg_comparator cmp;
|
||||
String tmp_value1,tmp_value2;
|
||||
DTCollation cmp_collation;
|
||||
|
||||
public:
|
||||
Item_bool_func2(Item *a,Item *b):
|
||||
Item_int_func(a,b), cmp(tmp_arg, tmp_arg+1)
|
||||
{ cmp_collation.set(0,DERIVATION_NONE);}
|
||||
bool fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref);
|
||||
Item_int_func(a,b), cmp(tmp_arg, tmp_arg+1) {}
|
||||
void fix_length_and_dec();
|
||||
void set_cmp_func()
|
||||
{
|
||||
|
@ -129,8 +128,6 @@ public:
|
|||
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
|
||||
void print(String *str) { Item_func::print_op(str); }
|
||||
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
|
||||
virtual bool binary() const
|
||||
{ return test(cmp_collation.collation->state & MY_CS_BINSORT); }
|
||||
|
||||
static Item_bool_func2* eq_creator(Item *a, Item *b);
|
||||
static Item_bool_func2* ne_creator(Item *a, Item *b);
|
||||
|
@ -603,42 +600,26 @@ public:
|
|||
|
||||
class Item_func_in :public Item_int_func
|
||||
{
|
||||
Item *item;
|
||||
in_vector *array;
|
||||
cmp_item *in_item;
|
||||
bool have_null;
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
Item_func_in(Item *a,List<Item> &list)
|
||||
:Item_int_func(list), item(a), array(0), in_item(0), have_null(0)
|
||||
Item_func_in(List<Item> &list)
|
||||
:Item_int_func(list), array(0), in_item(0), have_null(0)
|
||||
{
|
||||
allowed_arg_cols= item->cols();
|
||||
allowed_arg_cols= args[0]->cols();
|
||||
}
|
||||
longlong val_int();
|
||||
bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref)
|
||||
{
|
||||
// We do not check item->cols(), because allowed_arg_cols assigned from it
|
||||
bool res=(item->fix_fields(thd, tlist, &item) ||
|
||||
Item_func::fix_fields(thd, tlist, ref));
|
||||
with_sum_func= with_sum_func || item->with_sum_func;
|
||||
return res;
|
||||
}
|
||||
void fix_length_and_dec();
|
||||
~Item_func_in() { delete item; delete array; delete in_item; }
|
||||
~Item_func_in() { delete array; delete in_item; }
|
||||
optimize_type select_optimize() const
|
||||
{ return array ? OPTIMIZE_KEY : OPTIMIZE_NONE; }
|
||||
Item *key_item() const { return item; }
|
||||
Item *key_item() const { return args[0]; }
|
||||
void print(String *str);
|
||||
enum Functype functype() const { return IN_FUNC; }
|
||||
const char *func_name() const { return " IN "; }
|
||||
void update_used_tables();
|
||||
void split_sum_func(Item **ref_pointer_array, List<Item> &fields);
|
||||
bool nulls_in_row();
|
||||
void set_outer_resolving()
|
||||
{
|
||||
item->set_outer_resolving();
|
||||
Item_int_func::set_outer_resolving();
|
||||
}
|
||||
};
|
||||
|
||||
/* Functions used by where clause */
|
||||
|
|
|
@ -691,3 +691,38 @@ Item *create_func_uncompressed_length(Item* a)
|
|||
|
||||
#endif
|
||||
|
||||
Item *create_func_datediff(Item *a, Item *b)
|
||||
{
|
||||
return new Item_func_minus(new Item_func_to_days(a),
|
||||
new Item_func_to_days(b));
|
||||
}
|
||||
|
||||
Item *create_func_weekofyear(Item *a)
|
||||
{
|
||||
return new Item_func_week(a, new Item_int((char*) "0", 3, 1));
|
||||
}
|
||||
|
||||
Item *create_func_makedate(Item* a,Item* b)
|
||||
{
|
||||
return new Item_func_makedate(a, b);
|
||||
}
|
||||
|
||||
Item *create_func_addtime(Item* a,Item* b)
|
||||
{
|
||||
return new Item_func_add_time(a, b, 0, 0);
|
||||
}
|
||||
|
||||
Item *create_func_subtime(Item* a,Item* b)
|
||||
{
|
||||
return new Item_func_add_time(a, b, 0, 1);
|
||||
}
|
||||
|
||||
Item *create_func_timediff(Item* a,Item* b)
|
||||
{
|
||||
return new Item_func_timediff(a, b);
|
||||
}
|
||||
|
||||
Item *create_func_maketime(Item* a,Item* b,Item* c)
|
||||
{
|
||||
return new Item_func_maketime(a, b, c);
|
||||
}
|
||||
|
|
|
@ -146,3 +146,10 @@ Item *create_func_compress(Item *a);
|
|||
Item *create_func_uncompress(Item *a);
|
||||
Item *create_func_uncompressed_length(Item *a);
|
||||
|
||||
Item *create_func_datediff(Item *a, Item *b);
|
||||
Item *create_func_weekofyear(Item *a);
|
||||
Item *create_func_makedate(Item* a,Item* b);
|
||||
Item *create_func_addtime(Item* a,Item* b);
|
||||
Item *create_func_subtime(Item* a,Item* b);
|
||||
Item *create_func_timediff(Item* a,Item* b);
|
||||
Item *create_func_maketime(Item* a,Item* b,Item* c);
|
||||
|
|
210
sql/item_func.cc
210
sql/item_func.cc
|
@ -39,6 +39,61 @@ static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fnam
|
|||
fname);
|
||||
}
|
||||
|
||||
static void my_coll_agg_error(DTCollation &c1,
|
||||
DTCollation &c2,
|
||||
DTCollation &c3,
|
||||
const char *fname)
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_3COLLATIONS,MYF(0),
|
||||
c1.collation->name,c1.derivation_name(),
|
||||
c2.collation->name,c2.derivation_name(),
|
||||
c3.collation->name,c3.derivation_name(),
|
||||
fname);
|
||||
}
|
||||
|
||||
static void my_coll_agg_error(Item** args, uint ac, const char *fname)
|
||||
{
|
||||
if (2 == ac)
|
||||
my_coll_agg_error(args[0]->collation, args[1]->collation, fname);
|
||||
else if (3 == ac)
|
||||
my_coll_agg_error(args[0]->collation,
|
||||
args[1]->collation,
|
||||
args[2]->collation,
|
||||
fname);
|
||||
else
|
||||
my_error(ER_CANT_AGGREGATE_NCOLLATIONS,MYF(0),fname);
|
||||
}
|
||||
|
||||
bool Item_func::agg_arg_collations(DTCollation &c, Item **av, uint ac)
|
||||
{
|
||||
uint i;
|
||||
c.set(av[0]->collation);
|
||||
for (i= 1; i < ac; i++)
|
||||
{
|
||||
if (c.aggregate(av[i]->collation))
|
||||
{
|
||||
my_coll_agg_error(av, ac, func_name());
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool Item_func::agg_arg_collations_for_comparison(DTCollation &c,
|
||||
Item **av, uint ac)
|
||||
{
|
||||
if (agg_arg_collations(c, av, ac))
|
||||
return TRUE;
|
||||
|
||||
if (c.derivation == DERIVATION_NONE)
|
||||
{
|
||||
my_coll_agg_error(av, ac, func_name());
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* return TRUE if item is a constant */
|
||||
|
||||
bool
|
||||
|
@ -866,14 +921,9 @@ void Item_func_min_max::fix_length_and_dec()
|
|||
if (!args[i]->maybe_null)
|
||||
maybe_null=0;
|
||||
cmp_type=item_cmp_type(cmp_type,args[i]->result_type());
|
||||
if (i==0)
|
||||
collation.set(args[0]->collation);
|
||||
if (collation.aggregate(args[i]->collation))
|
||||
{
|
||||
my_coll_agg_error(collation, args[i]->collation, func_name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cmp_type == STRING_RESULT)
|
||||
agg_arg_collations_for_comparison(collation, args, arg_count);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1048,8 +1098,7 @@ longlong Item_func_coercibility::val_int()
|
|||
void Item_func_locate::fix_length_and_dec()
|
||||
{
|
||||
maybe_null=0; max_length=11;
|
||||
if (cmp_collation.set(args[0]->collation, args[1]->collation))
|
||||
my_coll_agg_error(args[0]->collation, args[1]->collation, func_name());
|
||||
agg_arg_collations_for_comparison(cmp_collation, args, 2);
|
||||
}
|
||||
|
||||
longlong Item_func_locate::val_int()
|
||||
|
@ -1118,33 +1167,48 @@ longlong Item_func_locate::val_int()
|
|||
|
||||
longlong Item_func_field::val_int()
|
||||
{
|
||||
if (cmp_type == STRING_RESULT)
|
||||
{
|
||||
String *field;
|
||||
if (!(field=item->val_str(&value)))
|
||||
if (!(field=args[0]->val_str(&value)))
|
||||
return 0; // -1 if null ?
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
for (uint i=1 ; i < arg_count ; i++)
|
||||
{
|
||||
String *tmp_value=args[i]->val_str(&tmp);
|
||||
if (tmp_value && field->length() == tmp_value->length() &&
|
||||
!memcmp(field->ptr(),tmp_value->ptr(),tmp_value->length()))
|
||||
return (longlong) (i+1);
|
||||
!sortcmp(field,tmp_value,cmp_collation.collation))
|
||||
return (longlong) (i);
|
||||
}
|
||||
}
|
||||
else if (cmp_type == INT_RESULT)
|
||||
{
|
||||
longlong val= args[0]->val_int();
|
||||
for (uint i=1; i < arg_count ; i++)
|
||||
{
|
||||
if (val == args[i]->val_int())
|
||||
return (longlong) (i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double val= args[0]->val();
|
||||
for (uint i=1; i < arg_count ; i++)
|
||||
{
|
||||
if (val == args[i]->val())
|
||||
return (longlong) (i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Item_func_field::split_sum_func(Item **ref_pointer_array,
|
||||
List<Item> &fields)
|
||||
void Item_func_field::fix_length_and_dec()
|
||||
{
|
||||
if (item->with_sum_func && item->type() != SUM_FUNC_ITEM)
|
||||
item->split_sum_func(ref_pointer_array, fields);
|
||||
else if (item->used_tables() || item->type() == SUM_FUNC_ITEM)
|
||||
{
|
||||
uint el= fields.elements;
|
||||
fields.push_front(item);
|
||||
ref_pointer_array[el]= item;
|
||||
item= new Item_ref(ref_pointer_array + el, 0, item->name);
|
||||
}
|
||||
Item_func::split_sum_func(ref_pointer_array, fields);
|
||||
maybe_null=0; max_length=3;
|
||||
cmp_type= args[0]->result_type();
|
||||
for (uint i=1; i < arg_count ; i++)
|
||||
cmp_type= item_cmp_type(cmp_type, args[i]->result_type());
|
||||
if (cmp_type == STRING_RESULT)
|
||||
agg_arg_collations_for_comparison(cmp_collation, args, arg_count);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1209,8 +1273,7 @@ void Item_func_find_in_set::fix_length_and_dec()
|
|||
}
|
||||
}
|
||||
}
|
||||
if (cmp_collation.set(args[0]->collation, args[1]->collation))
|
||||
my_coll_agg_error(args[0]->collation, args[1]->collation, func_name());
|
||||
agg_arg_collations_for_comparison(cmp_collation, args, 2);
|
||||
}
|
||||
|
||||
static const char separator=',';
|
||||
|
@ -1353,7 +1416,18 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||
Item *item= *arg;
|
||||
if (item->fix_fields(thd, tables, arg) || item->check_cols(1))
|
||||
return 1;
|
||||
if (item->binary())
|
||||
/*
|
||||
TODO: We should think about this. It is not always
|
||||
right way just to set an UDF result to return my_charset_bin
|
||||
if one argument has binary sorting order.
|
||||
The result collation should be calculated according to arguments
|
||||
derivations in some cases and should not in other cases.
|
||||
Moreover, some arguments can represent a numeric input
|
||||
which doesn't effect the result character set and collation.
|
||||
There is no a general rule for UDF. Everything depends on
|
||||
the particular user definted function.
|
||||
*/
|
||||
if (item->charset()->state & MY_CS_BINSORT)
|
||||
func->set_charset(&my_charset_bin);
|
||||
if (item->maybe_null)
|
||||
func->maybe_null=1;
|
||||
|
@ -2589,21 +2663,61 @@ longlong Item_func_bit_xor::val_int()
|
|||
System variables
|
||||
****************************************************************************/
|
||||
|
||||
Item *get_system_var(enum_var_type var_type, LEX_STRING name)
|
||||
/*
|
||||
Return value of an system variable base[.name] as a constant item
|
||||
|
||||
SYNOPSIS
|
||||
get_system_var()
|
||||
thd Thread handler
|
||||
var_type global / session
|
||||
name Name of base or system variable
|
||||
component Component.
|
||||
|
||||
NOTES
|
||||
If component.str = 0 then the variable name is in 'name'
|
||||
|
||||
RETURN
|
||||
0 error
|
||||
# constant item
|
||||
*/
|
||||
|
||||
|
||||
Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
|
||||
LEX_STRING component)
|
||||
{
|
||||
if (!my_strcasecmp(system_charset_info, name.str, "VERSION"))
|
||||
if (component.str == 0 &&
|
||||
!my_strcasecmp(system_charset_info, name.str, "VERSION"))
|
||||
return new Item_string("@@VERSION", server_version,
|
||||
(uint) strlen(server_version),
|
||||
system_charset_info);
|
||||
|
||||
THD *thd=current_thd;
|
||||
Item *item;
|
||||
sys_var *var;
|
||||
char buff[MAX_SYS_VAR_LENGTH+3+8], *pos;
|
||||
char buff[MAX_SYS_VAR_LENGTH*2+4+8], *pos;
|
||||
LEX_STRING *base_name, *component_name;
|
||||
|
||||
if (!(var= find_sys_var(name.str, name.length)))
|
||||
if (component.str)
|
||||
{
|
||||
base_name= &component;
|
||||
component_name= &name;
|
||||
}
|
||||
else
|
||||
{
|
||||
base_name= &name;
|
||||
component_name= &component; // Empty string
|
||||
}
|
||||
|
||||
if (!(var= find_sys_var(base_name->str, base_name->length)))
|
||||
return 0;
|
||||
if (!(item=var->item(thd, var_type)))
|
||||
if (component.str)
|
||||
{
|
||||
if (!var->is_struct())
|
||||
{
|
||||
net_printf(thd, ER_VARIABLE_IS_NOT_STRUCT, base_name->str);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (!(item=var->item(thd, var_type, component_name)))
|
||||
return 0; // Impossible
|
||||
thd->lex.uncacheable();
|
||||
buff[0]='@';
|
||||
|
@ -2613,23 +2727,37 @@ Item *get_system_var(enum_var_type var_type, LEX_STRING name)
|
|||
pos=strmov(pos,"session.");
|
||||
else if (var_type == OPT_GLOBAL)
|
||||
pos=strmov(pos,"global.");
|
||||
memcpy(pos, var->name, var->name_length+1);
|
||||
|
||||
set_if_smaller(component_name->length, MAX_SYS_VAR_LENGTH);
|
||||
set_if_smaller(base_name->length, MAX_SYS_VAR_LENGTH);
|
||||
|
||||
if (component_name->str)
|
||||
{
|
||||
memcpy(pos, component_name->str, component_name->length);
|
||||
pos+= component_name->length;
|
||||
*pos++= '.';
|
||||
}
|
||||
memcpy(pos, base_name->str, base_name->length);
|
||||
pos+= base_name->length;
|
||||
|
||||
// set_name() will allocate the name
|
||||
item->set_name(buff,(uint) (pos-buff)+var->name_length, system_charset_info);
|
||||
item->set_name(buff,(uint) (pos-buff), system_charset_info);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
Item *get_system_var(enum_var_type var_type, const char *var_name, uint length,
|
||||
const char *item_name)
|
||||
Item *get_system_var(THD *thd, enum_var_type var_type, const char *var_name,
|
||||
uint length, const char *item_name)
|
||||
{
|
||||
THD *thd=current_thd;
|
||||
Item *item;
|
||||
sys_var *var;
|
||||
LEX_STRING null_lex_string;
|
||||
|
||||
null_lex_string.str= 0;
|
||||
|
||||
var= find_sys_var(var_name, length);
|
||||
DBUG_ASSERT(var != 0);
|
||||
if (!(item=var->item(thd, var_type)))
|
||||
if (!(item=var->item(thd, var_type, &null_lex_string)))
|
||||
return 0; // Impossible
|
||||
thd->lex.uncacheable();
|
||||
item->set_name(item_name, 0, system_charset_info); // Will use original name
|
||||
|
|
|
@ -135,6 +135,9 @@ public:
|
|||
Field *tmp_table_field(TABLE *t_arg);
|
||||
void set_outer_resolving();
|
||||
Item *get_tmp_table_item(THD *thd);
|
||||
|
||||
bool agg_arg_collations(DTCollation &c, Item **items, uint nitems);
|
||||
bool agg_arg_collations_for_comparison(DTCollation &c, Item **items, uint nitems);
|
||||
};
|
||||
|
||||
|
||||
|
@ -622,37 +625,14 @@ public:
|
|||
|
||||
class Item_func_field :public Item_int_func
|
||||
{
|
||||
Item *item;
|
||||
String value,tmp;
|
||||
Item_result cmp_type;
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
Item_func_field(Item *a,List<Item> &list) :Item_int_func(list),item(a) {}
|
||||
~Item_func_field() { delete item; }
|
||||
Item_func_field(List<Item> &list) :Item_int_func(list) {}
|
||||
longlong val_int();
|
||||
bool fix_fields(THD *thd,struct st_table_list *tlist, Item **ref)
|
||||
{
|
||||
return (item->fix_fields(thd, tlist, &item) || item->check_cols(1) ||
|
||||
Item_func::fix_fields(thd, tlist, ref));
|
||||
}
|
||||
void split_sum_func(Item **ref_pointer_array, List<Item> &fields);
|
||||
void update_used_tables()
|
||||
{
|
||||
item->update_used_tables() ; Item_func::update_used_tables();
|
||||
used_tables_cache|= item->used_tables();
|
||||
const_item_cache&= item->const_item();
|
||||
}
|
||||
const char *func_name() const { return "field"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
maybe_null=0; max_length=3;
|
||||
used_tables_cache|= item->used_tables();
|
||||
const_item_cache&= item->const_item();
|
||||
with_sum_func= with_sum_func || item->with_sum_func;
|
||||
}
|
||||
void set_outer_resolving()
|
||||
{
|
||||
item->set_outer_resolving();
|
||||
Item_int_func::set_outer_resolving();
|
||||
}
|
||||
void fix_length_and_dec();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -44,18 +44,6 @@ static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fnam
|
|||
fname);
|
||||
}
|
||||
|
||||
static void my_coll_agg3_error(DTCollation &c1,
|
||||
DTCollation &c2,
|
||||
DTCollation &c3,
|
||||
const char *fname)
|
||||
{
|
||||
my_error(ER_CANT_AGGREGATE_3COLLATIONS,MYF(0),
|
||||
c1.collation->name,c1.derivation_name(),
|
||||
c2.collation->name,c2.derivation_name(),
|
||||
c3.collation->name,c3.derivation_name(),
|
||||
fname);
|
||||
}
|
||||
|
||||
uint nr_of_decimals(const char *str)
|
||||
{
|
||||
if ((str=strchr(str,'.')))
|
||||
|
@ -336,16 +324,11 @@ void Item_func_concat::fix_length_and_dec()
|
|||
bool first_coll= 1;
|
||||
max_length=0;
|
||||
|
||||
collation.set(args[0]->collation);
|
||||
if (agg_arg_collations(collation, args, arg_count))
|
||||
return;
|
||||
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
{
|
||||
max_length+=args[i]->max_length;
|
||||
if (collation.aggregate(args[i]->collation))
|
||||
{
|
||||
my_coll_agg_error(collation, args[i]->collation, func_name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (max_length > MAX_BLOB_WIDTH)
|
||||
{
|
||||
|
@ -748,7 +731,7 @@ String *Item_func_replace::val_str(String *str)
|
|||
res->set_charset(collation.collation);
|
||||
|
||||
#ifdef USE_MB
|
||||
binary_cmp = (args[0]->binary() || args[1]->binary() || !use_mb(res->charset()));
|
||||
binary_cmp = ((res->charset()->state & MY_CS_BINSORT) || !use_mb(res->charset()));
|
||||
#endif
|
||||
|
||||
if (res2->length() == 0)
|
||||
|
@ -840,13 +823,8 @@ void Item_func_replace::fix_length_and_dec()
|
|||
maybe_null=1;
|
||||
}
|
||||
|
||||
collation.set(args[0]->collation);
|
||||
if (!collation.aggregate(args[1]->collation))
|
||||
collation.aggregate(args[2]->collation);
|
||||
|
||||
if (collation.derivation == DERIVATION_NONE)
|
||||
my_coll_agg3_error(args[0]->collation, args[1]->collation,
|
||||
args[2]->collation, func_name());
|
||||
if (agg_arg_collations_for_comparison(collation, args, 3))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1001,13 +979,14 @@ void Item_func_right::fix_length_and_dec()
|
|||
String *Item_func_substr::val_str(String *str)
|
||||
{
|
||||
String *res = args[0]->val_str(str);
|
||||
int32 start = (int32) args[1]->val_int()-1;
|
||||
int32 start = (int32) args[1]->val_int();
|
||||
int32 length = arg_count == 3 ? (int32) args[2]->val_int() : INT_MAX32;
|
||||
int32 tmp_length;
|
||||
|
||||
if ((null_value=(args[0]->null_value || args[1]->null_value ||
|
||||
(arg_count == 3 && args[2]->null_value))))
|
||||
return 0; /* purecov: inspected */
|
||||
start= (int32)((start < 0) ? res->length() + start : start -1);
|
||||
start=res->charpos(start);
|
||||
length=res->charpos(length,start);
|
||||
if (start < 0 || (uint) start+1 > res->length() || length <= 0)
|
||||
|
@ -1050,9 +1029,9 @@ void Item_func_substr::fix_length_and_dec()
|
|||
void Item_func_substr_index::fix_length_and_dec()
|
||||
{
|
||||
max_length= args[0]->max_length;
|
||||
if (collation.set(args[0]->collation, args[1]->collation) ||
|
||||
(collation.derivation == DERIVATION_NONE))
|
||||
my_coll_agg_error(args[0]->collation, args[1]->collation, func_name());
|
||||
|
||||
if (agg_arg_collations_for_comparison(collation, args, 2))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1339,7 +1318,8 @@ void Item_func_trim::fix_length_and_dec()
|
|||
remove.set_ascii(" ",1);
|
||||
}
|
||||
else
|
||||
if (collation.set(args[1]->collation, args[0]->collation))
|
||||
if (collation.set(args[1]->collation, args[0]->collation) ||
|
||||
collation.derivation == DERIVATION_NONE)
|
||||
{
|
||||
my_coll_agg_error(args[1]->collation, args[0]->collation, func_name());
|
||||
}
|
||||
|
@ -1680,88 +1660,53 @@ void Item_func_elt::fix_length_and_dec()
|
|||
max_length=0;
|
||||
decimals=0;
|
||||
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
if (agg_arg_collations(collation, args+1, arg_count-1))
|
||||
return;
|
||||
|
||||
for (uint i=1 ; i < arg_count ; i++)
|
||||
{
|
||||
set_if_bigger(max_length,args[i]->max_length);
|
||||
set_if_bigger(decimals,args[i]->decimals);
|
||||
if (i == 0)
|
||||
collation.set(args[0]->collation);
|
||||
else
|
||||
{
|
||||
if (collation.aggregate(args[i]->collation))
|
||||
{
|
||||
my_coll_agg_error(collation, args[i]->collation, func_name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
maybe_null=1; // NULL if wrong first arg
|
||||
with_sum_func= with_sum_func || item->with_sum_func;
|
||||
used_tables_cache|=item->used_tables();
|
||||
const_item_cache&=item->const_item();
|
||||
}
|
||||
|
||||
|
||||
void Item_func_elt::split_sum_func(Item **ref_pointer_array,
|
||||
List<Item> &fields)
|
||||
{
|
||||
if (item->with_sum_func && item->type() != SUM_FUNC_ITEM)
|
||||
item->split_sum_func(ref_pointer_array, fields);
|
||||
else if (item->used_tables() || item->type() == SUM_FUNC_ITEM)
|
||||
{
|
||||
uint el= fields.elements;
|
||||
fields.push_front(item);
|
||||
ref_pointer_array[el]= item;
|
||||
item= new Item_ref(ref_pointer_array + el, 0, item->name);
|
||||
}
|
||||
Item_str_func::split_sum_func(ref_pointer_array, fields);
|
||||
}
|
||||
|
||||
|
||||
void Item_func_elt::update_used_tables()
|
||||
{
|
||||
Item_func::update_used_tables();
|
||||
item->update_used_tables();
|
||||
used_tables_cache|=item->used_tables();
|
||||
const_item_cache&=item->const_item();
|
||||
}
|
||||
|
||||
|
||||
double Item_func_elt::val()
|
||||
{
|
||||
uint tmp;
|
||||
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
|
||||
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
|
||||
{
|
||||
null_value=1;
|
||||
return 0.0;
|
||||
}
|
||||
null_value=0;
|
||||
return args[tmp-1]->val();
|
||||
return args[tmp]->val();
|
||||
}
|
||||
|
||||
longlong Item_func_elt::val_int()
|
||||
{
|
||||
uint tmp;
|
||||
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
|
||||
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
|
||||
{
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
null_value=0;
|
||||
return args[tmp-1]->val_int();
|
||||
return args[tmp]->val_int();
|
||||
}
|
||||
|
||||
String *Item_func_elt::val_str(String *str)
|
||||
{
|
||||
uint tmp;
|
||||
String *res;
|
||||
if ((tmp=(uint) item->val_int()) == 0 || tmp > arg_count)
|
||||
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
|
||||
{
|
||||
null_value=1;
|
||||
return NULL;
|
||||
}
|
||||
null_value=0;
|
||||
res= args[tmp-1]->val_str(str);
|
||||
res= args[tmp]->val_str(str);
|
||||
res->set_charset(charset());
|
||||
return res;
|
||||
}
|
||||
|
@ -1786,16 +1731,13 @@ void Item_func_make_set::split_sum_func(Item **ref_pointer_array,
|
|||
void Item_func_make_set::fix_length_and_dec()
|
||||
{
|
||||
max_length=arg_count-1;
|
||||
collation.set(args[0]->collation);
|
||||
|
||||
if (agg_arg_collations(collation, args, arg_count))
|
||||
return;
|
||||
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
{
|
||||
max_length+=args[i]->max_length;
|
||||
if (collation.aggregate(args[i]->collation))
|
||||
{
|
||||
my_coll_agg_error(collation, args[i]->collation, func_name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
used_tables_cache|=item->used_tables();
|
||||
const_item_cache&=item->const_item();
|
||||
with_sum_func= with_sum_func || item->with_sum_func;
|
||||
|
@ -2458,20 +2400,12 @@ String* Item_func_export_set::val_str(String* str)
|
|||
|
||||
void Item_func_export_set::fix_length_and_dec()
|
||||
{
|
||||
uint i;
|
||||
uint length=max(args[1]->max_length,args[2]->max_length);
|
||||
uint sep_length=(arg_count > 3 ? args[3]->max_length : 1);
|
||||
max_length=length*64+sep_length*63;
|
||||
|
||||
collation.set(args[1]->collation);
|
||||
for (i=2 ; i < 4 && i < arg_count ; i++)
|
||||
{
|
||||
if (collation.aggregate(args[i]->collation))
|
||||
{
|
||||
my_coll_agg_error(collation, args[i]->collation, func_name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (agg_arg_collations(collation, args+1, min(4,arg_count)-1))
|
||||
return;
|
||||
}
|
||||
|
||||
String* Item_func_inet_ntoa::val_str(String* str)
|
||||
|
|
|
@ -372,29 +372,13 @@ public:
|
|||
|
||||
class Item_func_elt :public Item_str_func
|
||||
{
|
||||
Item *item;
|
||||
|
||||
public:
|
||||
Item_func_elt(Item *a,List<Item> &list) :Item_str_func(list),item(a) {}
|
||||
~Item_func_elt() { delete item; }
|
||||
Item_func_elt(List<Item> &list) :Item_str_func(list) {}
|
||||
double val();
|
||||
longlong val_int();
|
||||
String *val_str(String *str);
|
||||
bool fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
|
||||
{
|
||||
return (item->fix_fields(thd, tlist, &item) ||
|
||||
item->check_cols(1) ||
|
||||
Item_func::fix_fields(thd, tlist, ref));
|
||||
}
|
||||
void split_sum_func(Item **ref_pointer_array, List<Item> &fields);
|
||||
void fix_length_and_dec();
|
||||
void update_used_tables();
|
||||
const char *func_name() const { return "elt"; }
|
||||
void set_outer_resolving()
|
||||
{
|
||||
item->set_outer_resolving();
|
||||
Item_str_func::set_outer_resolving();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1114,7 +1114,7 @@ void Item_sum_count_distinct::make_unique()
|
|||
bool Item_sum_count_distinct::setup(THD *thd)
|
||||
{
|
||||
List<Item> list;
|
||||
SELECT_LEX *select_lex= current_lex->current_select->select_lex();
|
||||
SELECT_LEX *select_lex= thd->lex.current_select->select_lex();
|
||||
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
|
||||
return 1;
|
||||
|
||||
|
@ -1599,7 +1599,7 @@ Item_func_group_concat::Item_func_group_concat(bool is_distinct,
|
|||
warning_available(0), key_length(0), rec_offset(0),
|
||||
tree_mode(0), distinct(is_distinct), warning_for_row(0),
|
||||
separator(is_separator), tree(&tree_base), table(0),
|
||||
order(0), tables_list(0), group_concat_max_len(0),
|
||||
order(0), tables_list(0),
|
||||
show_elements(0), arg_count_order(0), arg_count_field(0),
|
||||
arg_show_fields(0), count_cut_values(0)
|
||||
|
||||
|
@ -1607,8 +1607,11 @@ Item_func_group_concat::Item_func_group_concat(bool is_distinct,
|
|||
original= 0;
|
||||
quick_group= 0;
|
||||
mark_as_sum_func();
|
||||
SELECT_LEX *select_lex= current_lex->current_select->select_lex();
|
||||
item_thd= current_thd;
|
||||
SELECT_LEX *select_lex= item_thd->lex.current_select->select_lex();
|
||||
order= 0;
|
||||
group_concat_max_len= item_thd->variables.group_concat_max_len;
|
||||
|
||||
|
||||
arg_show_fields= arg_count_field= is_select->elements;
|
||||
arg_count_order= is_order ? is_order->elements : 0;
|
||||
|
@ -1773,7 +1776,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
}
|
||||
result_field= 0;
|
||||
null_value= 1;
|
||||
fix_length_and_dec();
|
||||
max_length= group_concat_max_len;
|
||||
thd->allow_sum_func= 1;
|
||||
if (!(tmp_table_param= new TMP_TABLE_PARAM))
|
||||
return 1;
|
||||
|
@ -1785,11 +1788,12 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
|
||||
bool Item_func_group_concat::setup(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("Item_func_group_concat::setup");
|
||||
List<Item> list;
|
||||
SELECT_LEX *select_lex= current_lex->current_select->select_lex();
|
||||
SELECT_LEX *select_lex= thd->lex.current_select->select_lex();
|
||||
|
||||
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
/*
|
||||
all not constant fields are push to list and create temp table
|
||||
*/
|
||||
|
@ -1798,7 +1802,7 @@ bool Item_func_group_concat::setup(THD *thd)
|
|||
{
|
||||
Item *item= args[i];
|
||||
if (list.push_back(item))
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
if (item->const_item())
|
||||
{
|
||||
(void) item->val_int();
|
||||
|
@ -1807,7 +1811,7 @@ bool Item_func_group_concat::setup(THD *thd)
|
|||
}
|
||||
}
|
||||
if (always_null)
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
|
||||
List<Item> all_fields(list);
|
||||
if (arg_count_order)
|
||||
|
@ -1818,13 +1822,18 @@ bool Item_func_group_concat::setup(THD *thd)
|
|||
}
|
||||
|
||||
count_field_types(tmp_table_param,all_fields,0);
|
||||
if (table)
|
||||
{
|
||||
free_tmp_table(thd, table);
|
||||
tmp_table_param->cleanup();
|
||||
}
|
||||
/*
|
||||
We have to create a temporary table for that we get descriptions of fields
|
||||
(types, sizes and so on).
|
||||
*/
|
||||
if (!(table=create_tmp_table(thd, tmp_table_param, all_fields, 0,
|
||||
0, 0, 0,select_lex->options | thd->options)))
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
table->file->extra(HA_EXTRA_NO_ROWS);
|
||||
table->no_rows= 1;
|
||||
|
||||
|
@ -1873,9 +1882,6 @@ bool Item_func_group_concat::setup(THD *thd)
|
|||
max_elements_in_tree= ((key_length) ?
|
||||
thd->variables.max_heap_table_size/key_length : 1);
|
||||
};
|
||||
item_thd= thd;
|
||||
|
||||
group_concat_max_len= thd->variables.group_concat_max_len;
|
||||
|
||||
/*
|
||||
Copy table and tree_mode if they belong to this item (if item have not
|
||||
|
@ -1886,7 +1892,7 @@ bool Item_func_group_concat::setup(THD *thd)
|
|||
original->table= table;
|
||||
original->tree_mode= tree_mode;
|
||||
}
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/* This is used by rollup to create a separate usable copy of the function */
|
||||
|
|
|
@ -713,7 +713,6 @@ class Item_func_group_concat : public Item_sum
|
|||
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
|
||||
const char *func_name() const { return "group_concat"; }
|
||||
enum Type type() const { return SUM_FUNC_ITEM; }
|
||||
void fix_length_and_dec() { max_length=group_concat_max_len; }
|
||||
virtual Item_result result_type () const { return STRING_RESULT; }
|
||||
bool reset();
|
||||
bool add();
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
** Todo: Move month and days to language files
|
||||
*/
|
||||
|
||||
#define MAX_DAY_NUMBER 3652424L
|
||||
|
||||
static String month_names[] =
|
||||
{
|
||||
String("January", &my_charset_latin1),
|
||||
|
@ -55,6 +57,82 @@ static String day_names[] =
|
|||
String("Sunday", &my_charset_latin1)
|
||||
};
|
||||
|
||||
enum date_time_format_types
|
||||
{
|
||||
TIME_ONLY= 0, TIME_MICROSECOND,
|
||||
DATE_ONLY, DATE_TIME, DATE_TIME_MICROSECOND
|
||||
};
|
||||
|
||||
typedef struct date_time_format
|
||||
{
|
||||
const char* format_str;
|
||||
uint length;
|
||||
};
|
||||
|
||||
static struct date_time_format date_time_formats[]=
|
||||
{
|
||||
{"%s%02d:%02d:%02d", 10},
|
||||
{"%s%02d:%02d:%02d.%06d", 17},
|
||||
{"%04d-%02d-%02d", 10},
|
||||
{"%04d-%02d-%02d %02d:%02d:%02d", 19},
|
||||
{"%04d-%02d-%02d %02d:%02d:%02d.%06d", 26}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
OPTIMIZATION TODO:
|
||||
- Replace the switch with a function that should be called for each
|
||||
date type.
|
||||
- Remove sprintf and opencode the conversion, like we do in
|
||||
Field_datetime.
|
||||
*/
|
||||
|
||||
String *make_datetime(String *str, TIME *ltime,
|
||||
enum date_time_format_types format)
|
||||
{
|
||||
char *buff;
|
||||
CHARSET_INFO *cs= &my_charset_bin;
|
||||
uint length= date_time_formats[format].length + 32;
|
||||
const char* format_str= date_time_formats[format].format_str;
|
||||
|
||||
if (str->alloc(length))
|
||||
return 0;
|
||||
|
||||
buff= (char*) str->ptr();
|
||||
switch (format) {
|
||||
case TIME_ONLY:
|
||||
length= cs->cset->snprintf(cs, buff, length, format_str, ltime->neg ? "-" : "",
|
||||
ltime->hour, ltime->minute, ltime->second);
|
||||
break;
|
||||
case TIME_MICROSECOND:
|
||||
length= cs->cset->snprintf(cs, buff, length, format_str, ltime->neg ? "-" : "",
|
||||
ltime->hour, ltime->minute, ltime->second,
|
||||
ltime->second_part);
|
||||
break;
|
||||
case DATE_ONLY:
|
||||
length= cs->cset->snprintf(cs, buff, length, format_str,
|
||||
ltime->year, ltime->month, ltime->day);
|
||||
break;
|
||||
case DATE_TIME:
|
||||
length= cs->cset->snprintf(cs, buff, length, format_str,
|
||||
ltime->year, ltime->month, ltime->day,
|
||||
ltime->hour, ltime->minute, ltime->second);
|
||||
break;
|
||||
case DATE_TIME_MICROSECOND:
|
||||
length= cs->cset->snprintf(cs, buff, length, format_str,
|
||||
ltime->year, ltime->month, ltime->day,
|
||||
ltime->hour, ltime->minute, ltime->second,
|
||||
ltime->second_part);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
str->length(length);
|
||||
str->set_charset(cs);
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
** Get a array of positive numbers from a string object.
|
||||
** Each number is separated by 1 non digit character
|
||||
|
@ -302,14 +380,14 @@ longlong Item_func_time_to_sec::val_int()
|
|||
static bool get_interval_value(Item *args,interval_type int_type,
|
||||
String *str_value, INTERVAL *t)
|
||||
{
|
||||
long array[4],value;
|
||||
long array[5],value;
|
||||
const char *str;
|
||||
uint32 length;
|
||||
LINT_INIT(value); LINT_INIT(str); LINT_INIT(length);
|
||||
CHARSET_INFO *cs=str_value->charset();
|
||||
|
||||
bzero((char*) t,sizeof(*t));
|
||||
if ((int) int_type <= INTERVAL_SECOND)
|
||||
if ((int) int_type <= INTERVAL_MICROSECOND)
|
||||
{
|
||||
value=(long) args->val_int();
|
||||
if (args->null_value)
|
||||
|
@ -352,6 +430,9 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
case INTERVAL_HOUR:
|
||||
t->hour=value;
|
||||
break;
|
||||
case INTERVAL_MICROSECOND:
|
||||
t->second_part=value;
|
||||
break;
|
||||
case INTERVAL_MINUTE:
|
||||
t->minute=value;
|
||||
break;
|
||||
|
@ -370,6 +451,15 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
t->day=array[0];
|
||||
t->hour=array[1];
|
||||
break;
|
||||
case INTERVAL_DAY_MICROSECOND:
|
||||
if (get_interval_info(str,length,cs,5,array))
|
||||
return (1);
|
||||
t->day=array[0];
|
||||
t->hour=array[1];
|
||||
t->minute=array[2];
|
||||
t->second=array[3];
|
||||
t->second_part=array[4];
|
||||
break;
|
||||
case INTERVAL_DAY_MINUTE:
|
||||
if (get_interval_info(str,length,cs,3,array))
|
||||
return (1);
|
||||
|
@ -385,6 +475,14 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
t->minute=array[2];
|
||||
t->second=array[3];
|
||||
break;
|
||||
case INTERVAL_HOUR_MICROSECOND:
|
||||
if (get_interval_info(str,length,cs,4,array))
|
||||
return (1);
|
||||
t->hour=array[0];
|
||||
t->minute=array[1];
|
||||
t->second=array[2];
|
||||
t->second_part=array[3];
|
||||
break;
|
||||
case INTERVAL_HOUR_MINUTE:
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
|
@ -398,12 +496,25 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
t->minute=array[1];
|
||||
t->second=array[2];
|
||||
break;
|
||||
case INTERVAL_MINUTE_MICROSECOND:
|
||||
if (get_interval_info(str,length,cs,3,array))
|
||||
return (1);
|
||||
t->minute=array[0];
|
||||
t->second=array[1];
|
||||
t->second_part=array[2];
|
||||
break;
|
||||
case INTERVAL_MINUTE_SECOND:
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->minute=array[0];
|
||||
t->second=array[1];
|
||||
break;
|
||||
case INTERVAL_SECOND_MICROSECOND:
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->second=array[0];
|
||||
t->second_part=array[1];
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -687,6 +798,9 @@ uint Item_func_date_format::format_length(const String *format)
|
|||
case 'T': /* time, 24-hour (hh:mm:ss) */
|
||||
size += 8;
|
||||
break;
|
||||
case 'f': /* microseconds */
|
||||
size += 6;
|
||||
break;
|
||||
case 'w': /* day (of the week), numeric */
|
||||
case '%':
|
||||
default:
|
||||
|
@ -798,8 +912,8 @@ String *Item_func_date_format::val_str(String *str)
|
|||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
length= my_sprintf(intbuff, (intbuff,"%d",l_time.day));
|
||||
str->append(intbuff, length);
|
||||
length= int10_to_str(l_time.day, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 1, '0');
|
||||
if (l_time.day >= 10 && l_time.day <= 19)
|
||||
str->append("th");
|
||||
else
|
||||
|
@ -821,41 +935,45 @@ String *Item_func_date_format::val_str(String *str)
|
|||
}
|
||||
break;
|
||||
case 'Y':
|
||||
sprintf(intbuff,"%04d",l_time.year);
|
||||
str->append(intbuff,4);
|
||||
length= int10_to_str(l_time.year, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 4, '0');
|
||||
break;
|
||||
case 'y':
|
||||
sprintf(intbuff,"%02d",l_time.year%100);
|
||||
str->append(intbuff,2);
|
||||
length= int10_to_str(l_time.year%100, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 2, '0');
|
||||
break;
|
||||
case 'm':
|
||||
sprintf(intbuff,"%02d",l_time.month);
|
||||
str->append(intbuff,2);
|
||||
length= int10_to_str(l_time.month, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 2, '0');
|
||||
break;
|
||||
case 'c':
|
||||
sprintf(intbuff,"%d",l_time.month);
|
||||
str->append(intbuff);
|
||||
length= int10_to_str(l_time.month, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 1, '0');
|
||||
break;
|
||||
case 'd':
|
||||
sprintf(intbuff,"%02d",l_time.day);
|
||||
str->append(intbuff,2);
|
||||
length= int10_to_str(l_time.day, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 2, '0');
|
||||
break;
|
||||
case 'e':
|
||||
sprintf(intbuff,"%d",l_time.day);
|
||||
str->append(intbuff);
|
||||
length= int10_to_str(l_time.day, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 1, '0');
|
||||
break;
|
||||
case 'f':
|
||||
length= int10_to_str(l_time.second_part, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 6, '0');
|
||||
break;
|
||||
case 'H':
|
||||
sprintf(intbuff,"%02d",l_time.hour);
|
||||
str->append(intbuff,2);
|
||||
length= int10_to_str(l_time.hour, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 2, '0');
|
||||
break;
|
||||
case 'h':
|
||||
case 'I':
|
||||
sprintf(intbuff,"%02d", (l_time.hour+11)%12+1);
|
||||
str->append(intbuff,2);
|
||||
length= int10_to_str((l_time.hour+11)%12+1, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 2, '0');
|
||||
break;
|
||||
case 'i': /* minutes */
|
||||
sprintf(intbuff,"%02d",l_time.minute);
|
||||
str->append(intbuff,2);
|
||||
length= int10_to_str(l_time.minute, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 2, '0');
|
||||
break;
|
||||
case 'j':
|
||||
if (date_or_time)
|
||||
|
@ -863,52 +981,60 @@ String *Item_func_date_format::val_str(String *str)
|
|||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
sprintf(intbuff,"%03d",
|
||||
(int) (calc_daynr(l_time.year,l_time.month,l_time.day) -
|
||||
calc_daynr(l_time.year,1,1)) + 1);
|
||||
str->append(intbuff,3);
|
||||
length= int10_to_str(calc_daynr(l_time.year,l_time.month,l_time.day) -
|
||||
calc_daynr(l_time.year,1,1) + 1, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 3, '0');
|
||||
break;
|
||||
case 'k':
|
||||
sprintf(intbuff,"%d",l_time.hour);
|
||||
str->append(intbuff);
|
||||
length= int10_to_str(l_time.hour, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 1, '0');
|
||||
break;
|
||||
case 'l':
|
||||
sprintf(intbuff,"%d", (l_time.hour+11)%12+1);
|
||||
str->append(intbuff);
|
||||
length= int10_to_str((l_time.hour+11)%12+1, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 1, '0');
|
||||
break;
|
||||
case 'p':
|
||||
str->append(l_time.hour < 12 ? "AM" : "PM",2);
|
||||
break;
|
||||
case 'r':
|
||||
sprintf(intbuff,(l_time.hour < 12) ? "%02d:%02d:%02d AM" :
|
||||
"%02d:%02d:%02d PM",(l_time.hour+11)%12+1,l_time.minute,
|
||||
l_time.second);
|
||||
str->append(intbuff);
|
||||
length= my_sprintf(intbuff,
|
||||
(intbuff,
|
||||
(l_time.hour < 12) ? "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM",
|
||||
(l_time.hour+11)%12+1,
|
||||
l_time.minute,
|
||||
l_time.second));
|
||||
str->append(intbuff, length);
|
||||
break;
|
||||
case 'S':
|
||||
case 's':
|
||||
sprintf(intbuff,"%02d",l_time.second);
|
||||
str->append(intbuff);
|
||||
length= int10_to_str(l_time.second, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 2, '0');
|
||||
break;
|
||||
case 'T':
|
||||
sprintf(intbuff,"%02d:%02d:%02d", l_time.hour, l_time.minute,
|
||||
l_time.second);
|
||||
str->append(intbuff);
|
||||
length= my_sprintf(intbuff,
|
||||
(intbuff,
|
||||
"%02d:%02d:%02d",
|
||||
l_time.hour,
|
||||
l_time.minute,
|
||||
l_time.second));
|
||||
str->append(intbuff, length);
|
||||
break;
|
||||
case 'U':
|
||||
case 'u':
|
||||
{
|
||||
uint year;
|
||||
sprintf(intbuff,"%02d",calc_week(&l_time, 0, (*ptr) == 'U', &year));
|
||||
str->append(intbuff,2);
|
||||
length= int10_to_str(calc_week(&l_time, 0, (*ptr) == 'U', &year),
|
||||
intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 2, '0');
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
case 'V':
|
||||
{
|
||||
uint year;
|
||||
sprintf(intbuff,"%02d",calc_week(&l_time, 1, (*ptr) == 'V', &year));
|
||||
str->append(intbuff,2);
|
||||
length= int10_to_str(calc_week(&l_time, 1, (*ptr) == 'V', &year),
|
||||
intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 2, '0');
|
||||
}
|
||||
break;
|
||||
case 'x':
|
||||
|
@ -916,14 +1042,15 @@ String *Item_func_date_format::val_str(String *str)
|
|||
{
|
||||
uint year;
|
||||
(void) calc_week(&l_time, 1, (*ptr) == 'X', &year);
|
||||
sprintf(intbuff,"%04d",year);
|
||||
str->append(intbuff,4);
|
||||
length= int10_to_str(year, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 4, '0');
|
||||
}
|
||||
break;
|
||||
case 'w':
|
||||
weekday=calc_weekday(calc_daynr(l_time.year,l_time.month,l_time.day),1);
|
||||
sprintf(intbuff,"%d",weekday);
|
||||
str->append(intbuff,1);
|
||||
length= int10_to_str(weekday, intbuff, 10) - intbuff;
|
||||
str->append_with_prefill(intbuff, length, 1, '0');
|
||||
|
||||
break;
|
||||
default:
|
||||
str->append(*ptr);
|
||||
|
@ -1005,7 +1132,7 @@ void Item_date_add_interval::fix_length_and_dec()
|
|||
enum_field_types arg0_field_type;
|
||||
set_charset(default_charset());
|
||||
maybe_null=1;
|
||||
max_length=19*default_charset()->mbmaxlen;
|
||||
max_length=26*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
value.alloc(32);
|
||||
|
||||
/*
|
||||
|
@ -1051,39 +1178,55 @@ bool Item_date_add_interval::get_date(TIME *ltime, bool fuzzy_date)
|
|||
null_value=0;
|
||||
switch (int_type) {
|
||||
case INTERVAL_SECOND:
|
||||
case INTERVAL_SECOND_MICROSECOND:
|
||||
case INTERVAL_MICROSECOND:
|
||||
case INTERVAL_MINUTE:
|
||||
case INTERVAL_HOUR:
|
||||
case INTERVAL_MINUTE_MICROSECOND:
|
||||
case INTERVAL_MINUTE_SECOND:
|
||||
case INTERVAL_HOUR_MICROSECOND:
|
||||
case INTERVAL_HOUR_SECOND:
|
||||
case INTERVAL_HOUR_MINUTE:
|
||||
case INTERVAL_DAY_MICROSECOND:
|
||||
case INTERVAL_DAY_SECOND:
|
||||
case INTERVAL_DAY_MINUTE:
|
||||
case INTERVAL_DAY_HOUR:
|
||||
long sec,days,daynr;
|
||||
long sec,days,daynr,microseconds,extra_sec;
|
||||
ltime->time_type=TIMESTAMP_FULL; // Return full date
|
||||
microseconds= ltime->second_part + sign*interval.second_part;
|
||||
extra_sec= microseconds/1000000L;
|
||||
microseconds= microseconds%1000000L;
|
||||
|
||||
sec=((ltime->day-1)*3600*24L+ltime->hour*3600+ltime->minute*60+
|
||||
ltime->second +
|
||||
sign*(interval.day*3600*24L +
|
||||
interval.hour*3600+interval.minute*60+interval.second));
|
||||
interval.hour*3600+interval.minute*60+interval.second))+
|
||||
extra_sec;
|
||||
|
||||
if (microseconds < 0)
|
||||
{
|
||||
microseconds+= 1000000L;
|
||||
sec--;
|
||||
}
|
||||
days=sec/(3600*24L); sec=sec-days*3600*24L;
|
||||
if (sec < 0)
|
||||
{
|
||||
days--;
|
||||
sec+=3600*24L;
|
||||
}
|
||||
ltime->second_part= microseconds;
|
||||
ltime->second=sec % 60;
|
||||
ltime->minute=sec/60 % 60;
|
||||
ltime->hour=sec/3600;
|
||||
daynr= calc_daynr(ltime->year,ltime->month,1) + days;
|
||||
get_date_from_daynr(daynr,<ime->year,<ime->month,<ime->day);
|
||||
if (daynr < 0 || daynr >= 3652424) // Day number from year 0 to 9999-12-31
|
||||
if (daynr < 0 || daynr >= MAX_DAY_NUMBER) // Day number from year 0 to 9999-12-31
|
||||
goto null_date;
|
||||
break;
|
||||
case INTERVAL_DAY:
|
||||
period= calc_daynr(ltime->year,ltime->month,ltime->day) +
|
||||
sign*interval.day;
|
||||
if (period < 0 || period >= 3652424) // Daynumber from year 0 to 9999-12-31
|
||||
if (period < 0 || period >= MAX_DAY_NUMBER) // Daynumber from year 0 to 9999-12-31
|
||||
goto null_date;
|
||||
get_date_from_daynr((long) period,<ime->year,<ime->month,<ime->day);
|
||||
break;
|
||||
|
@ -1124,34 +1267,21 @@ bool Item_date_add_interval::get_date(TIME *ltime, bool fuzzy_date)
|
|||
String *Item_date_add_interval::val_str(String *str)
|
||||
{
|
||||
TIME ltime;
|
||||
CHARSET_INFO *cs=default_charset();
|
||||
uint32 l;
|
||||
enum date_time_format_types format;
|
||||
|
||||
if (Item_date_add_interval::get_date(<ime,0))
|
||||
return 0;
|
||||
|
||||
if (ltime.time_type == TIMESTAMP_DATE)
|
||||
{
|
||||
l=11*cs->mbmaxlen+32;
|
||||
if (str->alloc(l))
|
||||
goto null_date;
|
||||
l=cs->cset->snprintf(cs,(char*) str->ptr(),l,"%04d-%02d-%02d",
|
||||
ltime.year,ltime.month,ltime.day);
|
||||
str->length(l);
|
||||
}
|
||||
format= DATE_ONLY;
|
||||
else if (ltime.second_part)
|
||||
format= DATE_TIME_MICROSECOND;
|
||||
else
|
||||
{
|
||||
l=20*cs->mbmaxlen+32;
|
||||
if (str->alloc(l))
|
||||
goto null_date;
|
||||
l=cs->cset->snprintf(cs,(char*) str->ptr(),l,"%04d-%02d-%02d %02d:%02d:%02d",
|
||||
ltime.year,ltime.month,ltime.day,
|
||||
ltime.hour,ltime.minute,ltime.second);
|
||||
str->length(l);
|
||||
}
|
||||
str->set_charset(cs);
|
||||
format= DATE_TIME;
|
||||
|
||||
if (make_datetime(str, <ime, format))
|
||||
return str;
|
||||
|
||||
null_date:
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1188,6 +1318,11 @@ void Item_extract::fix_length_and_dec()
|
|||
case INTERVAL_MINUTE: max_length=2; date_value=0; break;
|
||||
case INTERVAL_MINUTE_SECOND: max_length=4; date_value=0; break;
|
||||
case INTERVAL_SECOND: max_length=2; date_value=0; break;
|
||||
case INTERVAL_MICROSECOND: max_length=2; date_value=0; break;
|
||||
case INTERVAL_DAY_MICROSECOND: max_length=20; date_value=0; break;
|
||||
case INTERVAL_HOUR_MICROSECOND: max_length=13; date_value=0; break;
|
||||
case INTERVAL_MINUTE_MICROSECOND: max_length=11; date_value=0; break;
|
||||
case INTERVAL_SECOND_MICROSECOND: max_length=9; date_value=0; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1234,6 +1369,21 @@ longlong Item_extract::val_int()
|
|||
case INTERVAL_MINUTE: return (long) ltime.minute*neg;
|
||||
case INTERVAL_MINUTE_SECOND: return (long) (ltime.minute*100+ltime.second)*neg;
|
||||
case INTERVAL_SECOND: return (long) ltime.second*neg;
|
||||
case INTERVAL_MICROSECOND: return (long) ltime.second_part*neg;
|
||||
case INTERVAL_DAY_MICROSECOND: return (((longlong)ltime.day*1000000L +
|
||||
(longlong)ltime.hour*10000L +
|
||||
ltime.minute*100 +
|
||||
ltime.second)*1000000L +
|
||||
ltime.second_part)*neg;
|
||||
case INTERVAL_HOUR_MICROSECOND: return (((longlong)ltime.hour*10000L +
|
||||
ltime.minute*100 +
|
||||
ltime.second)*1000000L +
|
||||
ltime.second_part)*neg;
|
||||
case INTERVAL_MINUTE_MICROSECOND: return (((longlong)(ltime.minute*100+
|
||||
ltime.second))*1000000L+
|
||||
ltime.second_part)*neg;
|
||||
case INTERVAL_SECOND_MICROSECOND: return ((longlong)ltime.second*1000000L+
|
||||
ltime.second_part)*neg;
|
||||
}
|
||||
return 0; // Impossible
|
||||
}
|
||||
|
@ -1247,3 +1397,337 @@ void Item_typecast::print(String *str)
|
|||
str->append(func_name());
|
||||
str->append(')');
|
||||
}
|
||||
|
||||
String *Item_datetime_typecast::val_str(String *str)
|
||||
{
|
||||
TIME ltime;
|
||||
|
||||
if (!get_arg0_date(<ime,1) &&
|
||||
make_datetime(str, <ime, ltime.second_part ?
|
||||
DATE_TIME_MICROSECOND : DATE_TIME))
|
||||
return str;
|
||||
|
||||
null_date:
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool Item_time_typecast::get_time(TIME *ltime)
|
||||
{
|
||||
bool res= get_arg0_time(ltime);
|
||||
ltime->time_type= TIMESTAMP_TIME;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
String *Item_time_typecast::val_str(String *str)
|
||||
{
|
||||
TIME ltime;
|
||||
|
||||
if (!get_arg0_time(<ime) &&
|
||||
make_datetime(str, <ime, ltime.second_part ? TIME_MICROSECOND : TIME_ONLY))
|
||||
return str;
|
||||
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool Item_date_typecast::get_date(TIME *ltime, bool fuzzy_date)
|
||||
{
|
||||
bool res= get_arg0_date(ltime,1);
|
||||
ltime->time_type= TIMESTAMP_DATE;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
String *Item_date_typecast::val_str(String *str)
|
||||
{
|
||||
TIME ltime;
|
||||
|
||||
if (!get_arg0_date(<ime,1) &&
|
||||
make_datetime(str, <ime, DATE_ONLY))
|
||||
return str;
|
||||
|
||||
null_date:
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
MAKEDATE(a,b) is a date function that creates a date value
|
||||
from a year and day value.
|
||||
*/
|
||||
|
||||
String *Item_func_makedate::val_str(String *str)
|
||||
{
|
||||
TIME l_time;
|
||||
long daynr= args[1]->val_int();
|
||||
long yearnr= args[0]->val_int();
|
||||
long days;
|
||||
|
||||
if (args[0]->null_value || args[1]->null_value ||
|
||||
yearnr < 0 || daynr <= 0)
|
||||
goto null_date;
|
||||
|
||||
days= calc_daynr(yearnr,1,1) + daynr - 1;
|
||||
if (days > 0 || days < MAX_DAY_NUMBER) // Day number from year 0 to 9999-12-31
|
||||
{
|
||||
null_value=0;
|
||||
get_date_from_daynr(days,&l_time.year,&l_time.month,&l_time.day);
|
||||
if (make_datetime(str, &l_time, DATE_ONLY))
|
||||
return str;
|
||||
}
|
||||
|
||||
null_date:
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Item_func_add_time::fix_length_and_dec()
|
||||
{
|
||||
enum_field_types arg0_field_type;
|
||||
decimals=0;
|
||||
max_length=26*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
|
||||
/*
|
||||
The field type for the result of an Item_func_add_time function is defined as
|
||||
follows:
|
||||
|
||||
- If first arg is a MYSQL_TYPE_DATETIME or MYSQL_TYPE_TIMESTAMP
|
||||
result is MYSQL_TYPE_DATETIME
|
||||
- If first arg is a MYSQL_TYPE_TIME result is MYSQL_TYPE_TIME
|
||||
- Otherwise the result is MYSQL_TYPE_STRING
|
||||
*/
|
||||
|
||||
cached_field_type= MYSQL_TYPE_STRING;
|
||||
arg0_field_type= args[0]->field_type();
|
||||
if (arg0_field_type == MYSQL_TYPE_DATE ||
|
||||
arg0_field_type == MYSQL_TYPE_DATETIME ||
|
||||
arg0_field_type == MYSQL_TYPE_TIMESTAMP)
|
||||
cached_field_type= MYSQL_TYPE_DATETIME;
|
||||
else if (arg0_field_type == MYSQL_TYPE_TIME)
|
||||
cached_field_type= MYSQL_TYPE_TIME;
|
||||
}
|
||||
|
||||
/*
|
||||
ADDTIME(t,a) and SUBTIME(t,a) are time functions that calculate a time/datetime value
|
||||
|
||||
t: time_or_datetime_expression
|
||||
a: time_expression
|
||||
|
||||
Result: Time value or datetime value
|
||||
*/
|
||||
|
||||
String *Item_func_add_time::val_str(String *str)
|
||||
{
|
||||
TIME l_time1, l_time2, l_time3;
|
||||
bool is_time= 0;
|
||||
long microseconds, seconds, days= 0;
|
||||
int l_sign= sign;
|
||||
|
||||
null_value=0;
|
||||
l_time3.neg= 0;
|
||||
if (is_date) // TIMESTAMP function
|
||||
{
|
||||
if (get_arg0_date(&l_time1,1) ||
|
||||
args[1]->get_time(&l_time2) ||
|
||||
l_time1.time_type == TIMESTAMP_TIME ||
|
||||
l_time2.time_type != TIMESTAMP_TIME)
|
||||
goto null_date;
|
||||
}
|
||||
else // ADDTIME function
|
||||
{
|
||||
if (args[0]->get_time(&l_time1) ||
|
||||
args[1]->get_time(&l_time2) ||
|
||||
l_time2.time_type == TIMESTAMP_FULL)
|
||||
goto null_date;
|
||||
is_time= (l_time1.time_type == TIMESTAMP_TIME);
|
||||
if (is_time && (l_time2.neg == l_time1.neg && l_time1.neg))
|
||||
l_time3.neg= 1;
|
||||
}
|
||||
if (l_time1.neg != l_time2.neg)
|
||||
l_sign= -l_sign;
|
||||
|
||||
microseconds= l_time1.second_part + l_sign*l_time2.second_part;
|
||||
seconds= (l_time1.hour*3600L + l_time1.minute*60L + l_time1.second +
|
||||
(l_time2.day*86400L + l_time2.hour*3600L +
|
||||
l_time2.minute*60L + l_time2.second)*l_sign);
|
||||
if (is_time)
|
||||
seconds+= l_time1.day*86400L;
|
||||
else
|
||||
days+= calc_daynr((uint) l_time1.year,(uint) l_time1.month, (uint) l_time1.day);
|
||||
seconds= seconds + microseconds/1000000L;
|
||||
microseconds= microseconds%1000000L;
|
||||
days+= seconds/86400L;
|
||||
seconds= seconds%86400L;
|
||||
|
||||
if (microseconds < 0)
|
||||
{
|
||||
microseconds+= 1000000L;
|
||||
seconds--;
|
||||
}
|
||||
if (seconds < 0)
|
||||
{
|
||||
days+= seconds/86400L - 1;
|
||||
seconds+= 86400L;
|
||||
}
|
||||
if (days < 0)
|
||||
{
|
||||
if (!is_time)
|
||||
goto null_date;
|
||||
if (microseconds)
|
||||
{
|
||||
microseconds= 1000000L - microseconds;
|
||||
seconds++;
|
||||
}
|
||||
seconds= 86400L - seconds;
|
||||
days= -(++days);
|
||||
l_time3.neg= 1;
|
||||
}
|
||||
|
||||
calc_time_from_sec(&l_time3, seconds, microseconds);
|
||||
if (!is_time)
|
||||
{
|
||||
get_date_from_daynr(days,&l_time3.year,&l_time3.month,&l_time3.day);
|
||||
if (l_time3.day &&
|
||||
make_datetime(str, &l_time3,
|
||||
l_time1.second_part || l_time2.second_part ?
|
||||
DATE_TIME_MICROSECOND : DATE_TIME))
|
||||
return str;
|
||||
goto null_date;
|
||||
}
|
||||
|
||||
l_time3.hour+= days*24;
|
||||
if (make_datetime(str, &l_time3,
|
||||
l_time1.second_part || l_time2.second_part ?
|
||||
TIME_MICROSECOND : TIME_ONLY))
|
||||
return str;
|
||||
|
||||
null_date:
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
TIMEDIFF(t,s) is a time function that calculates the
|
||||
time value between a start and end time.
|
||||
|
||||
t and s: time_or_datetime_expression
|
||||
Result: Time value
|
||||
*/
|
||||
|
||||
String *Item_func_timediff::val_str(String *str)
|
||||
{
|
||||
longlong seconds;
|
||||
long microseconds;
|
||||
long days;
|
||||
int l_sign= 1;
|
||||
TIME l_time1 ,l_time2, l_time3;
|
||||
|
||||
null_value= 0;
|
||||
if (args[0]->get_time(&l_time1) ||
|
||||
args[1]->get_time(&l_time2) ||
|
||||
l_time1.time_type != l_time2.time_type)
|
||||
goto null_date;
|
||||
|
||||
if (l_time1.neg != l_time2.neg)
|
||||
l_sign= -l_sign;
|
||||
|
||||
if (l_time1.time_type == TIMESTAMP_TIME) // Time value
|
||||
days= l_time1.day - l_sign*l_time2.day;
|
||||
else // DateTime value
|
||||
days= (calc_daynr((uint) l_time1.year,
|
||||
(uint) l_time1.month,
|
||||
(uint) l_time1.day) -
|
||||
l_sign*calc_daynr((uint) l_time2.year,
|
||||
(uint) l_time2.month,
|
||||
(uint) l_time2.day));
|
||||
|
||||
microseconds= l_time1.second_part - l_sign*l_time2.second_part;
|
||||
seconds= ((longlong) days*86400L + l_time1.hour*3600L +
|
||||
l_time1.minute*60L + l_time1.second + microseconds/1000000L -
|
||||
(longlong)l_sign*(l_time2.hour*3600L+l_time2.minute*60L+l_time2.second));
|
||||
|
||||
l_time3.neg= 0;
|
||||
if (seconds < 0)
|
||||
{
|
||||
seconds= -seconds;
|
||||
l_time3.neg= 1;
|
||||
}
|
||||
else if (seconds == 0 && microseconds < 0)
|
||||
{
|
||||
microseconds= -microseconds;
|
||||
l_time3.neg= 1;
|
||||
}
|
||||
if (microseconds < 0)
|
||||
{
|
||||
microseconds+= 1000000L;
|
||||
seconds--;
|
||||
}
|
||||
if ((l_time2.neg == l_time1.neg) && l_time1.neg)
|
||||
l_time3.neg= l_time3.neg ? 0 : 1;
|
||||
|
||||
calc_time_from_sec(&l_time3, seconds, microseconds);
|
||||
if (make_datetime(str, &l_time3,
|
||||
l_time1.second_part || l_time2.second_part ?
|
||||
TIME_MICROSECOND : TIME_ONLY))
|
||||
return str;
|
||||
|
||||
null_date:
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
MAKETIME(h,m,s) is a time function that calculates a time value
|
||||
from the total number of hours, minutes, and seconds.
|
||||
Result: Time value
|
||||
*/
|
||||
|
||||
String *Item_func_maketime::val_str(String *str)
|
||||
{
|
||||
TIME ltime;
|
||||
|
||||
long hour= args[0]->val_int();
|
||||
long minute= args[1]->val_int();
|
||||
long second= args[2]->val_int();
|
||||
|
||||
if ((null_value=(args[0]->null_value ||
|
||||
args[1]->null_value ||
|
||||
args[2]->null_value ||
|
||||
minute > 59 || minute < 0 ||
|
||||
second > 59 || second < 0)))
|
||||
goto null_date;
|
||||
|
||||
ltime.neg= 0;
|
||||
if (hour < 0)
|
||||
{
|
||||
ltime.neg= 1;
|
||||
hour= -hour;
|
||||
}
|
||||
ltime.hour= (ulong)hour;
|
||||
ltime.minute= (ulong)minute;
|
||||
ltime.second= (ulong)second;
|
||||
if (make_datetime(str, <ime, TIME_ONLY))
|
||||
return str;
|
||||
|
||||
null_date:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
MICROSECOND(a) is a function ( extraction) that extracts the microseconds from a.
|
||||
|
||||
a: Datetime or time value
|
||||
Result: int value
|
||||
*/
|
||||
longlong Item_func_microsecond::val_int()
|
||||
{
|
||||
TIME ltime;
|
||||
if (!get_arg0_time(<ime))
|
||||
return ltime.second_part;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -478,9 +478,10 @@ public:
|
|||
enum interval_type
|
||||
{
|
||||
INTERVAL_YEAR, INTERVAL_MONTH, INTERVAL_DAY, INTERVAL_HOUR, INTERVAL_MINUTE,
|
||||
INTERVAL_SECOND, INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE,
|
||||
INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND,
|
||||
INTERVAL_MINUTE_SECOND
|
||||
INTERVAL_SECOND, INTERVAL_MICROSECOND ,INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR,
|
||||
INTERVAL_DAY_MINUTE, INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE,
|
||||
INTERVAL_HOUR_SECOND, INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND,
|
||||
INTERVAL_HOUR_MICROSECOND, INTERVAL_MINUTE_MICROSECOND, INTERVAL_SECOND_MICROSECOND
|
||||
};
|
||||
|
||||
|
||||
|
@ -556,6 +557,8 @@ class Item_date_typecast :public Item_typecast
|
|||
{
|
||||
public:
|
||||
Item_date_typecast(Item *a) :Item_typecast(a) {}
|
||||
String *val_str(String *str);
|
||||
bool get_date(TIME *ltime, bool fuzzy_date);
|
||||
const char *func_name() const { return "date"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
Field *tmp_table_field() { return result_field; }
|
||||
|
@ -570,6 +573,8 @@ class Item_time_typecast :public Item_typecast
|
|||
{
|
||||
public:
|
||||
Item_time_typecast(Item *a) :Item_typecast(a) {}
|
||||
String *val_str(String *str);
|
||||
bool get_time(TIME *ltime);
|
||||
const char *func_name() const { return "time"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
Field *tmp_table_field() { return result_field; }
|
||||
|
@ -584,6 +589,7 @@ class Item_datetime_typecast :public Item_typecast
|
|||
{
|
||||
public:
|
||||
Item_datetime_typecast(Item *a) :Item_typecast(a) {}
|
||||
String *val_str(String *str);
|
||||
const char *func_name() const { return "datetime"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
||||
Field *tmp_table_field() { return result_field; }
|
||||
|
@ -592,3 +598,106 @@ public:
|
|||
return (new Field_datetime(maybe_null, name, t_arg, default_charset()));
|
||||
}
|
||||
};
|
||||
|
||||
class Item_func_makedate :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_makedate(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
String *val_str(String *str);
|
||||
const char *func_name() const { return "makedate"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
max_length=8*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
}
|
||||
Field *tmp_table_field() { return result_field; }
|
||||
Field *tmp_table_field(TABLE *t_arg)
|
||||
{
|
||||
return (new Field_date(maybe_null, name, t_arg, &my_charset_bin));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Item_func_add_time :public Item_str_func
|
||||
{
|
||||
const bool is_date;
|
||||
int sign;
|
||||
enum_field_types cached_field_type;
|
||||
|
||||
public:
|
||||
Item_func_add_time(Item *a, Item *b, bool type_arg, bool neg_arg)
|
||||
:Item_str_func(a, b), is_date(type_arg) { sign= neg_arg ? -1 : 1; }
|
||||
String *val_str(String *str);
|
||||
const char *func_name() const { return "addtime"; }
|
||||
enum_field_types field_type() const { return cached_field_type; }
|
||||
void fix_length_and_dec();
|
||||
|
||||
/*
|
||||
TODO:
|
||||
Change this when we support
|
||||
microseconds in TIME/DATETIME
|
||||
*/
|
||||
Field *tmp_table_field() { return result_field; }
|
||||
Field *tmp_table_field(TABLE *t_arg)
|
||||
{
|
||||
if (cached_field_type == MYSQL_TYPE_TIME)
|
||||
return (new Field_time(maybe_null, name, t_arg, &my_charset_bin));
|
||||
else if (cached_field_type == MYSQL_TYPE_DATETIME)
|
||||
return (new Field_datetime(maybe_null, name, t_arg, &my_charset_bin));
|
||||
return (new Field_string(max_length, maybe_null, name, t_arg, &my_charset_bin));
|
||||
}
|
||||
};
|
||||
|
||||
class Item_func_timediff :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_timediff(Item *a, Item *b)
|
||||
:Item_str_func(a, b) {}
|
||||
String *val_str(String *str);
|
||||
const char *func_name() const { return "timediff"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
max_length=17*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
}
|
||||
Field *tmp_table_field() { return result_field; }
|
||||
Field *tmp_table_field(TABLE *t_arg)
|
||||
{
|
||||
return (new Field_time(maybe_null, name, t_arg, &my_charset_bin));
|
||||
}
|
||||
};
|
||||
|
||||
class Item_func_maketime :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_maketime(Item *a, Item *b, Item *c)
|
||||
:Item_str_func(a, b ,c) {}
|
||||
String *val_str(String *str);
|
||||
const char *func_name() const { return "maketime"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
max_length=8*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
}
|
||||
Field *tmp_table_field() { return result_field; }
|
||||
Field *tmp_table_field(TABLE *t_arg)
|
||||
{
|
||||
return (new Field_time(maybe_null, name, t_arg, &my_charset_bin));
|
||||
}
|
||||
};
|
||||
|
||||
class Item_func_microsecond :public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_func_microsecond(Item *a) :Item_int_func(a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "microsecond"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
maybe_null=1;
|
||||
}
|
||||
};
|
||||
|
|
17
sql/lex.h
17
sql/lex.h
|
@ -116,6 +116,7 @@ static SYMBOL symbols[] = {
|
|||
{ "DATETIME", SYM(DATETIME),0,0},
|
||||
{ "DAY", SYM(DAY_SYM),0,0},
|
||||
{ "DAY_HOUR", SYM(DAY_HOUR_SYM),0,0},
|
||||
{ "DAY_MICROSECOND", SYM(DAY_MICROSECOND_SYM),0,0},
|
||||
{ "DAY_MINUTE", SYM(DAY_MINUTE_SYM),0,0},
|
||||
{ "DAY_SECOND", SYM(DAY_SECOND_SYM),0,0},
|
||||
{ "DEC", SYM(DECIMAL_SYM),0,0},
|
||||
|
@ -186,6 +187,7 @@ static SYMBOL symbols[] = {
|
|||
{ "HELP", SYM(HELP_SYM),0,0},
|
||||
{ "HIGH_PRIORITY", SYM(HIGH_PRIORITY),0,0},
|
||||
{ "HOUR", SYM(HOUR_SYM),0,0},
|
||||
{ "HOUR_MICROSECOND", SYM(HOUR_MICROSECOND_SYM),0,0},
|
||||
{ "HOUR_MINUTE", SYM(HOUR_MINUTE_SYM),0,0},
|
||||
{ "HOUR_SECOND", SYM(HOUR_SECOND_SYM),0,0},
|
||||
{ "HOSTS", SYM(HOSTS_SYM),0,0},
|
||||
|
@ -259,9 +261,11 @@ static SYMBOL symbols[] = {
|
|||
{ "MERGE", SYM(MERGE_SYM),0,0},
|
||||
{ "MEDIUM", SYM(MEDIUM_SYM),0,0},
|
||||
{ "MEMORY", SYM(MEMORY_SYM),0,0},
|
||||
{ "MICROSECOND", SYM(MICROSECOND_SYM),0,0},
|
||||
{ "MIDDLEINT", SYM(MEDIUMINT),0,0}, /* For powerbuilder */
|
||||
{ "MIN_ROWS", SYM(MIN_ROWS),0,0},
|
||||
{ "MINUTE", SYM(MINUTE_SYM),0,0},
|
||||
{ "MINUTE_MICROSECOND", SYM(MINUTE_MICROSECOND_SYM),0,0},
|
||||
{ "MINUTE_SECOND", SYM(MINUTE_SECOND_SYM),0,0},
|
||||
{ "MOD", SYM(MOD_SYM),0,0},
|
||||
{ "MODE", SYM(MODE_SYM),0,0},
|
||||
|
@ -337,6 +341,7 @@ static SYMBOL symbols[] = {
|
|||
{ "ROWS", SYM(ROWS_SYM),0,0},
|
||||
{ "RTREE", SYM(RTREE_SYM),0,0},
|
||||
{ "SECOND", SYM(SECOND_SYM),0,0},
|
||||
{ "SECOND_MICROSECOND", SYM(SECOND_MICROSECOND_SYM),0,0},
|
||||
{ "SEPARATOR", SYM(SEPARATOR_SYM),0,0},
|
||||
{ "SELECT", SYM(SELECT_SYM),0,0},
|
||||
{ "SERIAL", SYM(SERIAL_SYM),0,0},
|
||||
|
@ -427,7 +432,8 @@ static SYMBOL symbols[] = {
|
|||
static SYMBOL sql_functions[] = {
|
||||
{ "ABS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_abs)},
|
||||
{ "ACOS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_acos)},
|
||||
{ "ADDDATE", SYM(DATE_ADD_INTERVAL),0,0},
|
||||
{ "ADDDATE", SYM(ADDDATE_SYM),0,0},
|
||||
{ "ADDTIME", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_addtime)},
|
||||
{ "AES_ENCRYPT", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_aes_encrypt)},
|
||||
{ "AES_DECRYPT", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_aes_decrypt)},
|
||||
{ "AREA", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_area)},
|
||||
|
@ -470,6 +476,7 @@ static SYMBOL sql_functions[] = {
|
|||
{ "CURDATE", SYM(CURDATE),0,0},
|
||||
{ "CURTIME", SYM(CURTIME),0,0},
|
||||
{ "DATE_ADD", SYM(DATE_ADD_INTERVAL),0,0},
|
||||
{ "DATEDIFF", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_datediff)},
|
||||
{ "DATE_FORMAT", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_date_format)},
|
||||
{ "DATE_SUB", SYM(DATE_SUB_INTERVAL),0,0},
|
||||
{ "DAYNAME", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_dayname)},
|
||||
|
@ -545,6 +552,8 @@ static SYMBOL sql_functions[] = {
|
|||
{ "LPAD", SYM(FUNC_ARG3),0,CREATE_FUNC(create_func_lpad)},
|
||||
{ "LTRIM", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ltrim)},
|
||||
{ "MAKE_SET", SYM(MAKE_SET_SYM),0,0},
|
||||
{ "MAKEDATE", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_makedate)},
|
||||
{ "MAKETIME", SYM(FUNC_ARG3),0,CREATE_FUNC(create_func_maketime)},
|
||||
{ "MASTER_POS_WAIT", SYM(MASTER_POS_WAIT),0,0},
|
||||
{ "MAX", SYM(MAX_SYM),0,0},
|
||||
{ "MBRCONTAINS", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_contains)},
|
||||
|
@ -605,7 +614,7 @@ static SYMBOL sql_functions[] = {
|
|||
{ "RTRIM", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_rtrim)},
|
||||
{ "SEC_TO_TIME", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_sec_to_time)},
|
||||
{ "SESSION_USER", SYM(USER),0,0},
|
||||
{ "SUBDATE", SYM(DATE_SUB_INTERVAL),0,0},
|
||||
{ "SUBDATE", SYM(SUBDATE_SYM),0,0},
|
||||
{ "SIGN", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_sign)},
|
||||
{ "SIN", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_sin)},
|
||||
{ "SHA", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_sha)},
|
||||
|
@ -618,14 +627,17 @@ static SYMBOL sql_functions[] = {
|
|||
{ "STD", SYM(STD_SYM),0,0},
|
||||
{ "STDDEV", SYM(STD_SYM),0,0},
|
||||
{ "STRCMP", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_strcmp)},
|
||||
{ "SUBSTR", SYM(SUBSTRING),0,0},
|
||||
{ "SUBSTRING", SYM(SUBSTRING),0,0},
|
||||
{ "SUBSTRING_INDEX", SYM(SUBSTRING_INDEX),0,0},
|
||||
{ "SUBTIME", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_subtime)},
|
||||
{ "SUM", SYM(SUM_SYM),0,0},
|
||||
{ "SYSDATE", SYM(NOW_SYM),0,0},
|
||||
{ "SYSTEM_USER", SYM(USER),0,0},
|
||||
{ "TAN", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_tan)},
|
||||
{ "TIME_FORMAT", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_time_format)},
|
||||
{ "TIME_TO_SEC", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_time_to_sec)},
|
||||
{ "TIMEDIFF", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_timediff)},
|
||||
{ "TO_DAYS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_to_days)},
|
||||
{ "TOUCHES", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_touches)},
|
||||
{ "TRIM", SYM(TRIM),0,0},
|
||||
|
@ -639,6 +651,7 @@ static SYMBOL sql_functions[] = {
|
|||
{ "VERSION", SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_version)},
|
||||
{ "WEEK", SYM(WEEK_SYM),0,0},
|
||||
{ "WEEKDAY", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_weekday)},
|
||||
{ "WEEKOFYEAR", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_weekofyear)},
|
||||
{ "WITHIN", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_within)},
|
||||
{ "X", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_x)},
|
||||
{ "Y", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_y)},
|
||||
|
|
|
@ -224,6 +224,8 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
|
|||
|
||||
#define RAID_BLOCK_SIZE 1024
|
||||
|
||||
#define MY_CHARSET_BIN_MB_MAXLEN 1
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
/*
|
||||
Sync points allow us to force the server to reach a certain line of code
|
||||
|
@ -533,6 +535,8 @@ int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
|
|||
bool verbose);
|
||||
int mysqld_show_keys(THD *thd, TABLE_LIST *table);
|
||||
int mysqld_show_logs(THD *thd);
|
||||
void append_identifier(THD *thd, String *packet, const char *name,
|
||||
uint length);
|
||||
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
|
||||
int mysqld_dump_create_info(THD *thd, TABLE *table, int fd = -1);
|
||||
int mysqld_show_create(THD *thd, TABLE_LIST *table_list);
|
||||
|
@ -556,6 +560,7 @@ void free_prep_stmt(PREP_STMT *stmt, TREE_FREE mode, void *not_used);
|
|||
bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length);
|
||||
void mysql_stmt_execute(THD *thd, char *packet);
|
||||
void mysql_stmt_free(THD *thd, char *packet);
|
||||
void mysql_stmt_reset(THD *thd, char *packet);
|
||||
void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length);
|
||||
int check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
|
||||
List<Item> &values, ulong counter);
|
||||
|
@ -769,6 +774,7 @@ extern rw_lock_t LOCK_grant;
|
|||
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
|
||||
extern pthread_attr_t connection_attrib;
|
||||
extern I_List<THD> threads;
|
||||
extern I_List<NAMED_LIST> key_caches;
|
||||
extern MY_BITMAP temp_pool;
|
||||
extern DATE_FORMAT dayord;
|
||||
extern String empty_string;
|
||||
|
@ -850,6 +856,7 @@ longlong str_to_datetime(const char *str,uint length,bool fuzzy_date);
|
|||
timestamp_type str_to_TIME(const char *str, uint length, TIME *l_time,
|
||||
bool fuzzy_date);
|
||||
void localtime_to_TIME(TIME *to, struct tm *from);
|
||||
void calc_time_from_sec(TIME *to, long seconds, long microseconds);
|
||||
|
||||
int test_if_number(char *str,int *res,bool allow_wildcards);
|
||||
void change_byte(byte *,uint,char,char);
|
||||
|
@ -902,9 +909,10 @@ extern void sql_cache_free();
|
|||
extern int sql_cache_hit(THD *thd, char *inBuf, uint length);
|
||||
|
||||
/* item.cc */
|
||||
Item *get_system_var(enum_var_type var_type, LEX_STRING name);
|
||||
Item *get_system_var(enum_var_type var_type, const char *var_name, uint length,
|
||||
const char *item_name);
|
||||
Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
|
||||
LEX_STRING component);
|
||||
Item *get_system_var(THD *thd, enum_var_type var_type, const char *var_name,
|
||||
uint length, const char *item_name);
|
||||
/* log.cc */
|
||||
bool flush_error_log(void);
|
||||
|
||||
|
|
|
@ -312,11 +312,12 @@ const char *sql_mode_str="OFF";
|
|||
|
||||
FILE *bootstrap_file;
|
||||
|
||||
I_List <i_string_pair> replicate_rewrite_db;
|
||||
I_List<i_string_pair> replicate_rewrite_db;
|
||||
I_List<i_string> replicate_do_db, replicate_ignore_db;
|
||||
// allow the user to tell us which db to replicate and which to ignore
|
||||
I_List<i_string> binlog_do_db, binlog_ignore_db;
|
||||
I_List<THD> threads,thread_cache;
|
||||
I_List<NAMED_LIST> key_caches;
|
||||
|
||||
struct system_variables global_system_variables;
|
||||
struct system_variables max_system_variables;
|
||||
|
@ -875,6 +876,7 @@ void clean_up(bool print_message)
|
|||
#endif
|
||||
(void) ha_panic(HA_PANIC_CLOSE); /* close all tables and logs */
|
||||
end_key_cache(&dflt_keycache,1);
|
||||
delete_elements(&key_caches, free_key_cache);
|
||||
end_thr_alarm(1); /* Free allocated memory */
|
||||
#ifdef USE_RAID
|
||||
end_raid();
|
||||
|
@ -1818,15 +1820,28 @@ extern "C" int my_message_sql(uint error, const char *str,
|
|||
{
|
||||
THD *thd;
|
||||
DBUG_ENTER("my_message_sql");
|
||||
DBUG_PRINT("error",("Message: '%s'",str));
|
||||
if ((thd=current_thd))
|
||||
DBUG_PRINT("error", ("Message: '%s'", str));
|
||||
if ((thd= current_thd))
|
||||
{
|
||||
/*
|
||||
thd->lex.current_select equel to zero if lex structure is not inited
|
||||
(not query command (COM_QUERY))
|
||||
*/
|
||||
if (thd->lex.current_select &&
|
||||
thd->lex.current_select->no_error && !thd->is_fatal_error)
|
||||
{
|
||||
DBUG_PRINT("error", ("above error converted to warning"));
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str);
|
||||
}
|
||||
else
|
||||
{
|
||||
NET *net= &thd->net;
|
||||
net->report_error= 1;
|
||||
if (!net->last_error[0]) // Return only first message
|
||||
{
|
||||
strmake(net->last_error,str,sizeof(net->last_error)-1);
|
||||
net->last_errno=error ? error : ER_UNKNOWN_ERROR;
|
||||
strmake(net->last_error, str, sizeof(net->last_error)-1);
|
||||
net->last_errno= error ? error : ER_UNKNOWN_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1988,22 +2003,6 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
|||
DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname,
|
||||
server_version, SYSTEM_TYPE,MACHINE_TYPE));
|
||||
|
||||
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
|
||||
{
|
||||
/* Retrieve used stack size; Needed for checking stack overflows */
|
||||
size_t stack_size= 0;
|
||||
pthread_attr_getstacksize(&connection_attrib, &stack_size);
|
||||
/* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */
|
||||
if (stack_size && stack_size < thread_stack)
|
||||
{
|
||||
if (global_system_variables.log_warnings)
|
||||
sql_print_error("Warning: Asked for %ld thread stack, but got %ld",
|
||||
thread_stack, stack_size);
|
||||
thread_stack= stack_size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined( SET_RLIMIT_NOFILE) || defined( OS2)
|
||||
/* connections and databases needs lots of files */
|
||||
{
|
||||
|
@ -2353,6 +2352,21 @@ int main(int argc, char **argv)
|
|||
if (!(opt_specialflag & SPECIAL_NO_PRIOR))
|
||||
my_pthread_setprio(pthread_self(),CONNECT_PRIOR);
|
||||
pthread_attr_setstacksize(&connection_attrib,thread_stack);
|
||||
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
|
||||
{
|
||||
/* Retrieve used stack size; Needed for checking stack overflows */
|
||||
size_t stack_size= 0;
|
||||
pthread_attr_getstacksize(&connection_attrib, &stack_size);
|
||||
/* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */
|
||||
if (stack_size && stack_size < thread_stack)
|
||||
{
|
||||
if (global_system_variables.log_warnings)
|
||||
sql_print_error("Warning: Asked for %ld thread stack, but got %ld",
|
||||
thread_stack, stack_size);
|
||||
thread_stack= stack_size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
(void) thr_setconcurrency(concurrency); // 10 by default
|
||||
|
||||
select_thread=pthread_self();
|
||||
|
@ -4091,7 +4105,7 @@ replicating a LOAD DATA INFILE command.",
|
|||
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD,
|
||||
IO_SIZE, 0},
|
||||
{"key_buffer_size", OPT_KEY_BUFFER_SIZE,
|
||||
"The size of the buffer used for index blocks. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
|
||||
"The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
|
||||
(gptr*) &keybuff_size, (gptr*) &keybuff_size, 0,
|
||||
(enum get_opt_var_type) (GET_ULL | GET_ASK_ADDR),
|
||||
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD,
|
||||
|
@ -4667,6 +4681,9 @@ static void mysql_init_variables(void)
|
|||
my_bind_addr = htonl(INADDR_ANY);
|
||||
threads.empty();
|
||||
thread_cache.empty();
|
||||
key_caches.empty();
|
||||
if (!get_or_create_key_cache("default", 7))
|
||||
exit(1);
|
||||
|
||||
/* Initialize structures that is used when processing options */
|
||||
replicate_rewrite_db.empty();
|
||||
|
@ -5297,16 +5314,30 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
/* Initiates DEBUG - but no debugging here ! */
|
||||
|
||||
|
||||
extern "C" gptr *
|
||||
mysql_getopt_value(char *keyname, uint key_length,
|
||||
mysql_getopt_value(const char *keyname, uint key_length,
|
||||
const struct my_option *option)
|
||||
{
|
||||
if (!key_length)
|
||||
{
|
||||
keyname= "default";
|
||||
key_length= 7;
|
||||
}
|
||||
switch (option->id) {
|
||||
case OPT_KEY_BUFFER_SIZE:
|
||||
{
|
||||
KEY_CACHE *key_cache;
|
||||
if (!(key_cache= get_or_create_key_cache(keyname, key_length)))
|
||||
exit(1);
|
||||
return (gptr*) &key_cache->size;
|
||||
}
|
||||
}
|
||||
return option->value;
|
||||
}
|
||||
|
||||
|
||||
static void get_options(int argc,char **argv)
|
||||
{
|
||||
int ho_error;
|
||||
|
@ -5354,6 +5385,8 @@ static void get_options(int argc,char **argv)
|
|||
table_alias_charset= (lower_case_table_names ?
|
||||
files_charset_info :
|
||||
&my_charset_bin);
|
||||
/* QQ To be deleted when we have key cache variables in a struct */
|
||||
keybuff_size= (((KEY_CACHE *) find_named(&key_caches, "default", 7))->size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -5568,6 +5601,6 @@ template class I_List<THD>;
|
|||
template class I_List_iterator<THD>;
|
||||
template class I_List<i_string>;
|
||||
template class I_List<i_string_pair>;
|
||||
|
||||
template class I_List<NAMED_LIST>;
|
||||
FIX_GCC_LINKING_PROBLEM
|
||||
#endif
|
||||
|
|
|
@ -959,5 +959,5 @@ my_net_read(NET *net)
|
|||
return len;
|
||||
}
|
||||
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
#endif /* #ifndef EMBEDDED_LIBRARY */
|
||||
|
||||
|
|
|
@ -832,10 +832,10 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
|
|||
Field *field=((Item_field*) (func->key_item()))->field;
|
||||
Item_result cmp_type=field->cmp_type();
|
||||
tree= get_mm_parts(param,field,Item_func::EQ_FUNC,
|
||||
func->arguments()[0],cmp_type);
|
||||
func->arguments()[1],cmp_type);
|
||||
if (!tree)
|
||||
DBUG_RETURN(tree); // Not key field
|
||||
for (uint i=1 ; i < func->argument_count(); i++)
|
||||
for (uint i=2 ; i < func->argument_count(); i++)
|
||||
{
|
||||
SEL_TREE *new_tree=get_mm_parts(param,field,Item_func::EQ_FUNC,
|
||||
func->arguments()[i],cmp_type);
|
||||
|
@ -2652,7 +2652,7 @@ int QUICK_SELECT_DESC::get_next()
|
|||
else
|
||||
{
|
||||
DBUG_ASSERT(range->flag & NEAR_MAX || range_reads_after_key(range));
|
||||
#ifdef NOT_IMPLEMENTED_YET
|
||||
#ifndef NOT_IMPLEMENTED_YET
|
||||
result=file->index_read(record, (byte*) range->max_key,
|
||||
range->max_length,
|
||||
((range->flag & NEAR_MAX) ?
|
||||
|
|
|
@ -572,7 +572,7 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
|
|||
#endif
|
||||
}
|
||||
|
||||
send_eof(thd);
|
||||
send_eof(thd, 1);
|
||||
DBUG_RETURN(prepare_for_send(list));
|
||||
|
||||
err:
|
||||
|
@ -823,6 +823,13 @@ bool Protocol_simple::store(Field *field)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
TODO:
|
||||
Second_part format ("%06") needs to change when
|
||||
we support 0-6 decimals for time.
|
||||
*/
|
||||
|
||||
|
||||
bool Protocol_simple::store(TIME *tm)
|
||||
{
|
||||
#ifndef DEBUG_OFF
|
||||
|
@ -840,6 +847,8 @@ bool Protocol_simple::store(TIME *tm)
|
|||
(int) tm->hour,
|
||||
(int) tm->minute,
|
||||
(int) tm->second));
|
||||
if (tm->second_part)
|
||||
length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part));
|
||||
return net_store_data((char*) buff, length);
|
||||
}
|
||||
|
||||
|
@ -861,6 +870,12 @@ bool Protocol_simple::store_date(TIME *tm)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
TODO:
|
||||
Second_part format ("%06") needs to change when
|
||||
we support 0-6 decimals for time.
|
||||
*/
|
||||
|
||||
bool Protocol_simple::store_time(TIME *tm)
|
||||
{
|
||||
#ifndef DEBUG_OFF
|
||||
|
@ -876,6 +891,8 @@ bool Protocol_simple::store_time(TIME *tm)
|
|||
(long) day*24L+(long) tm->hour,
|
||||
(int) tm->minute,
|
||||
(int) tm->second));
|
||||
if (tm->second_part)
|
||||
length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part));
|
||||
return net_store_data((char*) buff, length);
|
||||
}
|
||||
|
||||
|
|
218
sql/set_var.cc
218
sql/set_var.cc
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||
/* Copyright (C) 2000-2003 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -86,9 +86,9 @@ static void fix_net_retry_count(THD *thd, enum_var_type type);
|
|||
static void fix_max_join_size(THD *thd, enum_var_type type);
|
||||
static void fix_query_cache_size(THD *thd, enum_var_type type);
|
||||
static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type);
|
||||
static void fix_key_buffer_size(THD *thd, enum_var_type type);
|
||||
static void fix_myisam_max_extra_sort_file_size(THD *thd, enum_var_type type);
|
||||
static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
|
||||
static KEY_CACHE *create_key_cache(const char *name, uint length);
|
||||
void fix_sql_mode_var(THD *thd, enum_var_type type);
|
||||
static byte *get_error_count(THD *thd);
|
||||
static byte *get_warning_count(THD *thd);
|
||||
|
@ -136,9 +136,7 @@ sys_var_thd_ulong sys_interactive_timeout("interactive_timeout",
|
|||
&SV::net_interactive_timeout);
|
||||
sys_var_thd_ulong sys_join_buffer_size("join_buffer_size",
|
||||
&SV::join_buff_size);
|
||||
sys_var_ulonglong_ptr sys_key_buffer_size("key_buffer_size",
|
||||
&keybuff_size,
|
||||
fix_key_buffer_size);
|
||||
sys_var_key_buffer_size sys_key_buffer_size("key_buffer_size");
|
||||
sys_var_bool_ptr sys_local_infile("local_infile",
|
||||
&opt_local_infile);
|
||||
sys_var_thd_bool sys_log_warnings("log_warnings", &SV::log_warnings);
|
||||
|
@ -793,12 +791,6 @@ static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type)
|
|||
#endif
|
||||
|
||||
|
||||
static void fix_key_buffer_size(THD *thd, enum_var_type type)
|
||||
{
|
||||
ha_resize_key_cache();
|
||||
}
|
||||
|
||||
|
||||
void fix_delay_key_write(THD *thd, enum_var_type type)
|
||||
{
|
||||
switch ((enum_delay_key_write) delay_key_write_options) {
|
||||
|
@ -870,7 +862,7 @@ bool sys_var_enum::update(THD *thd, set_var *var)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_enum::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
||||
{
|
||||
return (byte*) enum_names->type_names[*value];
|
||||
}
|
||||
|
@ -906,7 +898,8 @@ void sys_var_thd_ulong::set_default(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
return (byte*) &(global_system_variables.*offset);
|
||||
|
@ -951,7 +944,8 @@ void sys_var_thd_ha_rows::set_default(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
return (byte*) &(global_system_variables.*offset);
|
||||
|
@ -994,7 +988,8 @@ void sys_var_thd_ulonglong::set_default(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_thd_ulonglong::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_thd_ulonglong::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
return (byte*) &(global_system_variables.*offset);
|
||||
|
@ -1021,7 +1016,8 @@ void sys_var_thd_bool::set_default(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
return (byte*) &(global_system_variables.*offset);
|
||||
|
@ -1115,7 +1111,7 @@ err:
|
|||
to create an item that gets the current value at fix_fields() stage.
|
||||
*/
|
||||
|
||||
Item *sys_var::item(THD *thd, enum_var_type var_type)
|
||||
Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
|
||||
{
|
||||
if (check_type(var_type))
|
||||
{
|
||||
|
@ -1131,16 +1127,16 @@ Item *sys_var::item(THD *thd, enum_var_type var_type)
|
|||
}
|
||||
switch (type()) {
|
||||
case SHOW_LONG:
|
||||
return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type));
|
||||
return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type, base));
|
||||
case SHOW_LONGLONG:
|
||||
return new Item_int(*(longlong*) value_ptr(thd, var_type));
|
||||
return new Item_int(*(longlong*) value_ptr(thd, var_type, base));
|
||||
case SHOW_HA_ROWS:
|
||||
return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type));
|
||||
return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type, base));
|
||||
case SHOW_MY_BOOL:
|
||||
return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type),1);
|
||||
return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type, base),1);
|
||||
case SHOW_CHAR:
|
||||
{
|
||||
char *str= (char*) value_ptr(thd, var_type);
|
||||
char *str= (char*) value_ptr(thd, var_type, base);
|
||||
return new Item_string(str, strlen(str), system_charset_info);
|
||||
}
|
||||
default:
|
||||
|
@ -1169,7 +1165,8 @@ void sys_var_thd_enum::set_default(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
ulong tmp= ((type == OPT_GLOBAL) ?
|
||||
global_system_variables.*offset :
|
||||
|
@ -1186,7 +1183,8 @@ bool sys_var_thd_bit::update(THD *thd, set_var *var)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
/*
|
||||
If reverse is 0 (default) return 1 if bit is set.
|
||||
|
@ -1249,6 +1247,7 @@ bool sys_var_collation::check(THD *thd, set_var *var)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool sys_var_character_set::check(THD *thd, set_var *var)
|
||||
{
|
||||
CHARSET_INFO *tmp;
|
||||
|
@ -1274,20 +1273,24 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool sys_var_character_set::update(THD *thd, set_var *var)
|
||||
{
|
||||
ci_ptr(thd,var->type)[0]= var->save_result.charset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
byte *sys_var_character_set::value_ptr(THD *thd, enum_var_type type)
|
||||
|
||||
byte *sys_var_character_set::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
CHARSET_INFO *cs= ci_ptr(thd,type)[0];
|
||||
return cs ? (byte*) cs->csname : (byte*) "NULL";
|
||||
}
|
||||
|
||||
|
||||
CHARSET_INFO ** sys_var_character_set_connection::ci_ptr(THD *thd, enum_var_type type)
|
||||
CHARSET_INFO ** sys_var_character_set_connection::ci_ptr(THD *thd,
|
||||
enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
return &global_system_variables.collation_connection;
|
||||
|
@ -1295,7 +1298,9 @@ CHARSET_INFO ** sys_var_character_set_connection::ci_ptr(THD *thd, enum_var_type
|
|||
return &thd->variables.collation_connection;
|
||||
}
|
||||
|
||||
void sys_var_character_set_connection::set_default(THD *thd, enum_var_type type)
|
||||
|
||||
void sys_var_character_set_connection::set_default(THD *thd,
|
||||
enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
global_system_variables.collation_connection= default_charset_info;
|
||||
|
@ -1304,7 +1309,8 @@ void sys_var_character_set_connection::set_default(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
CHARSET_INFO ** sys_var_character_set_client::ci_ptr(THD *thd, enum_var_type type)
|
||||
CHARSET_INFO ** sys_var_character_set_client::ci_ptr(THD *thd,
|
||||
enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
return &global_system_variables.character_set_client;
|
||||
|
@ -1312,6 +1318,7 @@ CHARSET_INFO ** sys_var_character_set_client::ci_ptr(THD *thd, enum_var_type typ
|
|||
return &thd->variables.character_set_client;
|
||||
}
|
||||
|
||||
|
||||
void sys_var_character_set_client::set_default(THD *thd, enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
|
@ -1320,6 +1327,7 @@ void sys_var_character_set_client::set_default(THD *thd, enum_var_type type)
|
|||
thd->variables.character_set_client= global_system_variables.character_set_client;
|
||||
}
|
||||
|
||||
|
||||
CHARSET_INFO ** sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
|
@ -1328,6 +1336,7 @@ CHARSET_INFO ** sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type ty
|
|||
return &thd->variables.character_set_results;
|
||||
}
|
||||
|
||||
|
||||
void sys_var_character_set_results::set_default(THD *thd, enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
|
@ -1336,6 +1345,7 @@ void sys_var_character_set_results::set_default(THD *thd, enum_var_type type)
|
|||
thd->variables.character_set_results= global_system_variables.character_set_results;
|
||||
}
|
||||
|
||||
|
||||
CHARSET_INFO ** sys_var_character_set_server::ci_ptr(THD *thd, enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
|
@ -1344,6 +1354,7 @@ CHARSET_INFO ** sys_var_character_set_server::ci_ptr(THD *thd, enum_var_type typ
|
|||
return &thd->variables.character_set_server;
|
||||
}
|
||||
|
||||
|
||||
void sys_var_character_set_server::set_default(THD *thd, enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
|
@ -1352,7 +1363,9 @@ void sys_var_character_set_server::set_default(THD *thd, enum_var_type type)
|
|||
thd->variables.character_set_server= global_system_variables.character_set_server;
|
||||
}
|
||||
|
||||
CHARSET_INFO ** sys_var_character_set_database::ci_ptr(THD *thd, enum_var_type type)
|
||||
|
||||
CHARSET_INFO ** sys_var_character_set_database::ci_ptr(THD *thd,
|
||||
enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
return &global_system_variables.character_set_database;
|
||||
|
@ -1360,6 +1373,7 @@ CHARSET_INFO ** sys_var_character_set_database::ci_ptr(THD *thd, enum_var_type t
|
|||
return &thd->variables.character_set_database;
|
||||
}
|
||||
|
||||
|
||||
void sys_var_character_set_database::set_default(THD *thd, enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
|
@ -1368,6 +1382,7 @@ void sys_var_character_set_database::set_default(THD *thd, enum_var_type type)
|
|||
thd->variables.character_set_database= thd->db_charset;
|
||||
}
|
||||
|
||||
|
||||
bool sys_var_collation_connection::update(THD *thd, set_var *var)
|
||||
{
|
||||
if (var->type == OPT_GLOBAL)
|
||||
|
@ -1377,7 +1392,9 @@ bool sys_var_collation_connection::update(THD *thd, set_var *var)
|
|||
return 0;
|
||||
}
|
||||
|
||||
byte *sys_var_collation_connection::value_ptr(THD *thd, enum_var_type type)
|
||||
|
||||
byte *sys_var_collation_connection::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
|
||||
global_system_variables.collation_connection :
|
||||
|
@ -1385,6 +1402,7 @@ byte *sys_var_collation_connection::value_ptr(THD *thd, enum_var_type type)
|
|||
return cs ? (byte*) cs->name : (byte*) "NULL";
|
||||
}
|
||||
|
||||
|
||||
void sys_var_collation_connection::set_default(THD *thd, enum_var_type type)
|
||||
{
|
||||
if (type == OPT_GLOBAL)
|
||||
|
@ -1394,6 +1412,71 @@ void sys_var_collation_connection::set_default(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
|
||||
{
|
||||
ulonglong tmp= var->value->val_int();
|
||||
if (!base_name.length)
|
||||
{
|
||||
base_name.str= (char*) "default";
|
||||
base_name.length= 7;
|
||||
}
|
||||
KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, base_name.str,
|
||||
base_name.length);
|
||||
if (!key_cache)
|
||||
{
|
||||
if (!tmp) // Tried to delete cache
|
||||
return 0; // Ok, nothing to do
|
||||
if (!(key_cache= create_key_cache(base_name.str,
|
||||
base_name.length)))
|
||||
return 1;
|
||||
}
|
||||
if (!tmp)
|
||||
{
|
||||
/* Delete not default key caches */
|
||||
if (base_name.length != 7 || memcpy(base_name.str, "default", 7))
|
||||
{
|
||||
/*
|
||||
QQ: Here we should move tables using this key cache to default
|
||||
key cache
|
||||
*/
|
||||
delete key_cache;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
key_cache->size= (ulonglong) getopt_ull_limit_value(tmp, option_limits);
|
||||
|
||||
/* QQ: Needs to be updated when we have multiple key caches */
|
||||
keybuff_size= key_cache->size;
|
||||
ha_resize_key_cache();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ulonglong zero=0;
|
||||
|
||||
byte *sys_var_key_buffer_size::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
const char *name;
|
||||
uint length;
|
||||
|
||||
if (!base->str)
|
||||
{
|
||||
name= "default";
|
||||
length= 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
name= base->str;
|
||||
length= base->length;
|
||||
}
|
||||
KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, name, length);
|
||||
if (!key_cache)
|
||||
return (byte*) &zero;
|
||||
return (byte*) &key_cache->size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
Functions to handle SET NAMES and SET CHARACTER SET
|
||||
|
@ -1429,7 +1512,8 @@ void sys_var_timestamp::set_default(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_timestamp::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_timestamp::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
thd->sys_var_tmp.long_value= (long) thd->start_time;
|
||||
return (byte*) &thd->sys_var_tmp.long_value;
|
||||
|
@ -1443,7 +1527,8 @@ bool sys_var_last_insert_id::update(THD *thd, set_var *var)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
thd->sys_var_tmp.long_value= (long) thd->insert_id();
|
||||
return (byte*) &thd->last_insert_id;
|
||||
|
@ -1457,7 +1542,8 @@ bool sys_var_insert_id::update(THD *thd, set_var *var)
|
|||
}
|
||||
|
||||
|
||||
byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
return (byte*) &thd->current_insert_id;
|
||||
}
|
||||
|
@ -1848,7 +1934,8 @@ int set_var_password::update(THD *thd)
|
|||
Functions to handle sql_mode
|
||||
****************************************************************************/
|
||||
|
||||
byte *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type)
|
||||
byte *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
ulong val;
|
||||
char buff[256];
|
||||
|
@ -1945,6 +2032,68 @@ ulong fix_sql_mode(ulong sql_mode)
|
|||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Named list handling
|
||||
****************************************************************************/
|
||||
|
||||
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length)
|
||||
{
|
||||
I_List_iterator<NAMED_LIST> it(*list);
|
||||
NAMED_LIST *element;
|
||||
while ((element= it++))
|
||||
{
|
||||
if (element->cmp(name, length))
|
||||
return element->data;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void delete_elements(I_List<NAMED_LIST> *list, void (*free_element)(gptr))
|
||||
{
|
||||
NAMED_LIST *element;
|
||||
while ((element= list->get()))
|
||||
{
|
||||
(*free_element)(element->data);
|
||||
delete element;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Key cache functions */
|
||||
|
||||
static KEY_CACHE *create_key_cache(const char *name, uint length)
|
||||
{
|
||||
KEY_CACHE *key_cache;
|
||||
DBUG_PRINT("info",("Creating key cache: %s", name));
|
||||
if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE),
|
||||
MYF(MY_ZEROFILL | MY_WME))))
|
||||
{
|
||||
if (!new NAMED_LIST(&key_caches, name, length, (gptr) key_cache))
|
||||
{
|
||||
my_free((char*) key_cache, MYF(0));
|
||||
key_cache= 0;
|
||||
}
|
||||
}
|
||||
return key_cache;
|
||||
}
|
||||
|
||||
|
||||
KEY_CACHE *get_or_create_key_cache(const char *name, uint length)
|
||||
{
|
||||
KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, name,
|
||||
length);
|
||||
if (!key_cache)
|
||||
key_cache= create_key_cache(name, length);
|
||||
return key_cache;
|
||||
}
|
||||
|
||||
|
||||
void free_key_cache(gptr key_cache)
|
||||
{
|
||||
my_free(key_cache, MYF(0));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Used templates
|
||||
|
@ -1953,4 +2102,5 @@ ulong fix_sql_mode(ulong sql_mode)
|
|||
#ifdef __GNUC__
|
||||
template class List<set_var_base>;
|
||||
template class List_iterator_fast<set_var_base>;
|
||||
template class I_List_iterator<NAMED_LIST>;
|
||||
#endif
|
||||
|
|
105
sql/set_var.h
105
sql/set_var.h
|
@ -47,12 +47,18 @@ public:
|
|||
struct my_option *option_limits; /* Updated by by set_var_init() */
|
||||
uint name_length; /* Updated by by set_var_init() */
|
||||
const char *name;
|
||||
LEX_STRING base_name; /* for structs */
|
||||
|
||||
sys_after_update_func after_update;
|
||||
sys_var(const char *name_arg) :name(name_arg),after_update(0)
|
||||
{}
|
||||
{
|
||||
base_name.length=0;
|
||||
}
|
||||
sys_var(const char *name_arg,sys_after_update_func func)
|
||||
:name(name_arg),after_update(func)
|
||||
{}
|
||||
{
|
||||
base_name.length=0;
|
||||
}
|
||||
virtual ~sys_var() {}
|
||||
virtual bool check(THD *thd, set_var *var) { return 0; }
|
||||
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
|
||||
|
@ -60,14 +66,16 @@ public:
|
|||
virtual bool update(THD *thd, set_var *var)=0;
|
||||
virtual void set_default(THD *thd, enum_var_type type) {}
|
||||
virtual SHOW_TYPE type() { return SHOW_UNDEF; }
|
||||
virtual byte *value_ptr(THD *thd, enum_var_type type) { return 0; }
|
||||
virtual byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
||||
{ return 0; }
|
||||
virtual bool check_type(enum_var_type type)
|
||||
{ return type != OPT_GLOBAL; } /* Error if not GLOBAL */
|
||||
virtual bool check_update_type(Item_result type)
|
||||
{ return type != INT_RESULT; } /* Assume INT */
|
||||
virtual bool check_default(enum_var_type type)
|
||||
{ return option_limits == 0; }
|
||||
Item *item(THD *thd, enum_var_type type);
|
||||
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
virtual bool is_struct() { return 0; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -83,7 +91,8 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
SHOW_TYPE type() { return SHOW_LONG; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type) { return (byte*) value; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
||||
{ return (byte*) value; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -99,7 +108,8 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type) { return (byte*) value; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
||||
{ return (byte*) value; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -117,7 +127,8 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
SHOW_TYPE type() { return SHOW_MY_BOOL; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type) { return (byte*) value; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
||||
{ return (byte*) value; }
|
||||
bool check_update_type(Item_result type) { return 0; }
|
||||
};
|
||||
|
||||
|
@ -149,7 +160,8 @@ public:
|
|||
(*set_default_func)(thd, type);
|
||||
}
|
||||
SHOW_TYPE type() { return SHOW_CHAR; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type) { return (byte*) value; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
||||
{ return (byte*) value; }
|
||||
bool check_update_type(Item_result type)
|
||||
{
|
||||
return type != STRING_RESULT; /* Only accept strings */
|
||||
|
@ -173,7 +185,7 @@ public:
|
|||
}
|
||||
bool update(THD *thd, set_var *var);
|
||||
SHOW_TYPE type() { return SHOW_CHAR; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
bool check_update_type(Item_result type) { return 0; }
|
||||
};
|
||||
|
||||
|
@ -209,7 +221,7 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
SHOW_TYPE type() { return SHOW_LONG; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
};
|
||||
|
||||
class sys_var_pseudo_thread_id :public sys_var_thd_ulong
|
||||
|
@ -236,7 +248,7 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
SHOW_TYPE type() { return SHOW_HA_ROWS; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
};
|
||||
|
||||
|
||||
|
@ -256,7 +268,7 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
bool check_default(enum_var_type type)
|
||||
{
|
||||
return type == OPT_GLOBAL && !option_limits;
|
||||
|
@ -282,7 +294,7 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
SHOW_TYPE type() { return SHOW_MY_BOOL; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
bool check(THD *thd, set_var *var)
|
||||
{
|
||||
return check_enum(thd, var, &bool_typelib);
|
||||
|
@ -313,7 +325,7 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
SHOW_TYPE type() { return SHOW_CHAR; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
bool check_update_type(Item_result type) { return 0; }
|
||||
};
|
||||
|
||||
|
@ -332,7 +344,7 @@ public:
|
|||
return check_set(thd, var, enum_names);
|
||||
}
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
};
|
||||
|
||||
|
||||
|
@ -355,7 +367,7 @@ public:
|
|||
bool check_update_type(Item_result type) { return 0; }
|
||||
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
||||
SHOW_TYPE type() { return SHOW_MY_BOOL; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
};
|
||||
|
||||
|
||||
|
@ -370,7 +382,7 @@ public:
|
|||
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
||||
bool check_default(enum_var_type type) { return 0; }
|
||||
SHOW_TYPE type() { return SHOW_LONG; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
};
|
||||
|
||||
|
||||
|
@ -381,7 +393,7 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
||||
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
};
|
||||
|
||||
|
||||
|
@ -392,7 +404,7 @@ public:
|
|||
bool update(THD *thd, set_var *var);
|
||||
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
|
||||
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
};
|
||||
|
||||
|
||||
|
@ -456,7 +468,7 @@ SHOW_TYPE type() { return SHOW_CHAR; }
|
|||
}
|
||||
bool check_default(enum_var_type type) { return 0; }
|
||||
bool update(THD *thd, set_var *var);
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
virtual void set_default(THD *thd, enum_var_type type)= 0;
|
||||
virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
|
||||
};
|
||||
|
@ -513,9 +525,24 @@ public:
|
|||
sys_var_collation_connection(const char *name_arg) :sys_var_collation(name_arg) {}
|
||||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
};
|
||||
|
||||
|
||||
class sys_var_key_buffer_size :public sys_var
|
||||
{
|
||||
public:
|
||||
sys_var_key_buffer_size(const char *name_arg)
|
||||
:sys_var(name_arg)
|
||||
{}
|
||||
bool update(THD *thd, set_var *var);
|
||||
SHOW_TYPE type() { return SHOW_LONGLONG; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
bool check_default(enum_var_type type) { return 1; }
|
||||
bool is_struct() { return 1; }
|
||||
};
|
||||
|
||||
|
||||
/* Variable that you can only read from */
|
||||
|
||||
class sys_var_readonly: public sys_var
|
||||
|
@ -534,7 +561,7 @@ public:
|
|||
bool check_default(enum_var_type type) { return 1; }
|
||||
bool check_type(enum_var_type type) { return type != var_type; }
|
||||
bool check_update_type(Item_result type) { return 1; }
|
||||
byte *value_ptr(THD *thd, enum_var_type type)
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
||||
{
|
||||
return (*value_ptr_func)(thd);
|
||||
}
|
||||
|
@ -639,6 +666,33 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/* Named lists (used for keycaches) */
|
||||
|
||||
class NAMED_LIST :public ilink
|
||||
{
|
||||
const char *name;
|
||||
uint name_length;
|
||||
public:
|
||||
gptr data;
|
||||
|
||||
NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
|
||||
uint name_length_arg, gptr data_arg):
|
||||
name_length(name_length_arg), data(data_arg)
|
||||
{
|
||||
name=my_strdup(name_arg,MYF(MY_WME));
|
||||
links->push_back(this);
|
||||
}
|
||||
inline bool cmp(const char *name_cmp, uint length)
|
||||
{
|
||||
return length == name_length && !memcmp(name, name_cmp, length);
|
||||
}
|
||||
~NAMED_LIST()
|
||||
{
|
||||
my_free((char*) name, MYF(0));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Prototypes for helper functions
|
||||
*/
|
||||
|
@ -649,6 +703,11 @@ sys_var *find_sys_var(const char *str, uint length=0);
|
|||
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
|
||||
void fix_delay_key_write(THD *thd, enum_var_type type);
|
||||
ulong fix_sql_mode(ulong sql_mode);
|
||||
|
||||
extern sys_var_str sys_charset_system;
|
||||
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
|
||||
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length);
|
||||
void delete_elements(I_List<NAMED_LIST> *list, void (*free_element)(gptr));
|
||||
|
||||
/* key_cache functions */
|
||||
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
|
||||
void free_key_cache(gptr key_cache);
|
||||
|
|
|
@ -16,8 +16,8 @@ v/*
|
|||
"ANO",
|
||||
"Nemohu vytvo-Bøit soubor '%-.64s' (chybový kód: %d)",
|
||||
"Nemohu vytvo-Bøit tabulku '%-.64s' (chybový kód: %d)",
|
||||
"Nemohu vytvo-Bøit databázi '%-.64s', chyba %d",
|
||||
"Nemohu vytvo-Bøit databázi '%-.64s', databáze ji¾ existuje",
|
||||
"Nemohu vytvo-Bøit databázi '%-.64s' (chybový kód: %d)",
|
||||
"Nemohu vytvo-Bøit databázi '%-.64s'; databáze ji¾ existuje",
|
||||
"Nemohu zru-B¹it databázi '%-.64s', databáze neexistuje",
|
||||
"Chyba p-Bøi ru¹ení databáze (nemohu vymazat '%-.64s', chyba %d)",
|
||||
"Chyba p-Bøi ru¹ení databáze (nemohu vymazat adresáø '%-.64s', chyba %d)",
|
||||
|
@ -222,7 +222,7 @@ v/*
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -275,3 +275,4 @@ v/*
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
"JA",
|
||||
"Kan ikke oprette filen '%-.64s' (Fejlkode: %d)",
|
||||
"Kan ikke oprette tabellen '%-.64s' (Fejlkode: %d)",
|
||||
"Kan ikke oprette databasen '%-.64s'. Fejl %d",
|
||||
"Kan ikke oprette databasen '%-.64s'. Databasen eksisterer",
|
||||
"Kan ikke slette (droppe) '%-.64s'. Databasen eksisterer ikke",
|
||||
"Kan ikke oprette databasen '%-.64s' (Fejlkode: %d)",
|
||||
"Kan ikke oprette databasen '%-.64s'; databasen eksisterer",
|
||||
"Kan ikke slette (droppe) '%-.64s'; databasen eksisterer ikke",
|
||||
"Fejl ved sletning (drop) af databasen (kan ikke slette '%-.64s', Fejl %d)",
|
||||
"Fejl ved sletting af database (kan ikke slette folderen '%-.64s', Fejl %d)",
|
||||
"Fejl ved sletning af '%-.64s' (Fejlkode: %d)",
|
||||
|
@ -216,7 +216,7 @@
|
|||
"CREATE DATABASE er ikke tilladt mens en tråd holder på globalt read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -269,3 +269,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
"Kan file '%-.64s' niet aanmaken (Errcode: %d)",
|
||||
"Kan tabel '%-.64s' niet aanmaken (Errcode: %d)",
|
||||
"Kan database '%-.64s' niet aanmaken (Errcode: %d)",
|
||||
"Kan database '%-.64s' niet aanmaken. Database bestaat reeds",
|
||||
"Kan database '%-.64s' niet verwijderen. Database bestaat niet",
|
||||
"Kan database '%-.64s' niet aanmaken; database bestaat reeds",
|
||||
"Kan database '%-.64s' niet verwijderen; database bestaat niet",
|
||||
"Fout bij verwijderen database (kan '%-.64s' niet verwijderen, Errcode: %d)",
|
||||
"Fout bij verwijderen database (kan rmdir '%-.64s' niet uitvoeren, Errcode: %d)",
|
||||
"Fout bij het verwijderen van '%-.64s' (Errcode: %d)",
|
||||
|
@ -224,7 +224,7 @@
|
|||
"CREATE DATABASE niet toegestaan terwijl thread een globale 'read lock' bezit",
|
||||
"Foutieve parameters voor %s",
|
||||
"%-.32s@%-.64s mag geen nieuwe gebruikers creeren",
|
||||
"Incorrecte tabel definitie; Alle MERGE tabellen moeten tot dezelfde database behoren",
|
||||
"Incorrecte tabel definitie; alle MERGE tabellen moeten tot dezelfde database behoren",
|
||||
"Deadlock gevonden tijdens lock-aanvraag poging; Probeer herstart van de transactie",
|
||||
"Het gebruikte tabel type ondersteund geen FULLTEXT indexen",
|
||||
"Kan foreign key beperking niet toevoegen",
|
||||
|
@ -277,3 +277,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
"YES",
|
||||
"Can't create file '%-.64s' (errno: %d)",
|
||||
"Can't create table '%-.64s' (errno: %d)",
|
||||
"Can't create database '%-.64s'. (errno: %d)",
|
||||
"Can't create database '%-.64s'. Database exists",
|
||||
"Can't drop database '%-.64s'. Database doesn't exist",
|
||||
"Can't create database '%-.64s' (errno: %d)",
|
||||
"Can't create database '%-.64s'; database exists",
|
||||
"Can't drop database '%-.64s'; database doesn't exist",
|
||||
"Error dropping database (can't delete '%-.64s', errno: %d)",
|
||||
"Error dropping database (can't rmdir '%-.64s', errno: %d)",
|
||||
"Error on delete of '%-.64s' (errno: %d)",
|
||||
|
@ -213,7 +213,7 @@
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -271,3 +271,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"JAH",
|
||||
"Ei suuda luua faili '%-.64s' (veakood: %d)",
|
||||
"Ei suuda luua tabelit '%-.64s' (veakood: %d)",
|
||||
"Ei suuda luua andmebaasi '%-.64s'. (veakood: %d)",
|
||||
"Ei suuda luua andmebaasi '%-.64s' (veakood: %d)",
|
||||
"Ei suuda luua andmebaasi '%-.64s': andmebaas juba eksisteerib",
|
||||
"Ei suuda kustutada andmebaasi '%-.64s': andmebaasi ei eksisteeri",
|
||||
"Viga andmebaasi kustutamisel (ei suuda kustutada faili '%-.64s', veakood: %d)",
|
||||
|
@ -271,3 +271,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
"OUI",
|
||||
"Ne peut créer le fichier '%-.64s' (Errcode: %d)",
|
||||
"Ne peut créer la table '%-.64s' (Errcode: %d)",
|
||||
"Ne peut créer la base '%-.64s'. Erreur %d",
|
||||
"Ne peut créer la base '%-.64s'. Elle existe déjà",
|
||||
"Ne peut effacer la base '%-.64s'. Elle n'existe pas",
|
||||
"Ne peut créer la base '%-.64s' (Erreur %d)",
|
||||
"Ne peut créer la base '%-.64s'; elle existe déjà",
|
||||
"Ne peut effacer la base '%-.64s'; elle n'existe pas",
|
||||
"Ne peut effacer la base '%-.64s' (erreur %d)",
|
||||
"Erreur en effaçant la base (rmdir '%-.64s', erreur %d)",
|
||||
"Erreur en effaçant '%-.64s' (Errcode: %d)",
|
||||
|
@ -213,7 +213,7 @@
|
|||
"CREATE DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture",
|
||||
"Mauvais arguments à %s",
|
||||
"%-.32s@%-.64s n'est pas autorisé à créer de nouveaux utilisateurs",
|
||||
"Définition de table incorrecte : toutes les tables MERGE doivent être dans la même base de donnée",
|
||||
"Définition de table incorrecte; toutes les tables MERGE doivent être dans la même base de donnée",
|
||||
"Deadlock découvert en essayant d'obtenir les verrous : essayez de redémarrer la transaction",
|
||||
"Le type de table utilisé ne supporte pas les index FULLTEXT",
|
||||
"Impossible d'ajouter des contraintes d'index externe",
|
||||
|
@ -266,3 +266,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
"isamchk",
|
||||
"Nein",
|
||||
"Ja",
|
||||
"Kann Datei '%-.64s' nicht erzeugen. (Fehler: %d)",
|
||||
"Kann Tabelle '%-.64s' nicht erzeugen. (Fehler: %d)",
|
||||
"Kann Datenbank '%-.64s' nicht erzeugen. (Fehler: %d)",
|
||||
"Kann Datenbank '%-.64s' nicht erzeugen. Datenbank '%-.64s' existiert bereits.",
|
||||
"Kann Datenbank '%-.64s' nicht löschen. Keine Datenbank '%-.64s' vorhanden.",
|
||||
"Kann Datei '%-.64s' nicht erzeugen (Fehler: %d)",
|
||||
"Kann Tabelle '%-.64s' nicht erzeugen (Fehler: %d)",
|
||||
"Kann Datenbank '%-.64s' nicht erzeugen (Fehler: %d)",
|
||||
"Kann Datenbank '%-.64s' nicht erzeugen; datenbank '%-.64s' existiert bereits.",
|
||||
"Kann Datenbank '%-.64s' nicht löschen; keine Datenbank '%-.64s' vorhanden.",
|
||||
"Fehler beim Löschen der Datenbank. ('%-.64s' kann nicht gelöscht werden, Fehlernuumer: %d)",
|
||||
"Fehler beim Löschen der Datenbank. (Verzeichnis '%-.64s' kann nicht gelöscht werden, Fehlernummer: %d)",
|
||||
"Fehler beim Löschen von '%-.64s'. (Fehler: %d)",
|
||||
|
@ -222,7 +222,7 @@
|
|||
"Solange ein globaler Read LOCK gesetzt ist, ist CREATE DATABASE nicht zulässig.",
|
||||
"Falsche Argumente für %s",
|
||||
"%-.32s@%-.64s is nicht berechtigt neue Benutzer hinzuzufügen.",
|
||||
"Falsche Tabellendefinition: Sämtliche MERGE-Tabellen müssen in derselben Datenbank sein.",
|
||||
"Falsche Tabellendefinition; sämtliche MERGE-Tabellen müssen in derselben Datenbank sein.",
|
||||
"Beim Versuch einen Lock anzufordern ist ein Deadlock aufgetreten. Es wird versucht die Transaktion erneut zu starten.",
|
||||
"Der verwendete Tabellentyp unterstützt keinen FULLTEXT-Index.",
|
||||
"Foreign_Key Beschränkung konnte nicht hinzugefügt werden.",
|
||||
|
@ -275,3 +275,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
"ÍÁÉ",
|
||||
"Áäýíáôç ç äçìéïõñãßá ôïõ áñ÷åßïõ '%-.64s' (êùäéêüò ëÜèïõò: %d)",
|
||||
"Áäýíáôç ç äçìéïõñãßá ôïõ ðßíáêá '%-.64s' (êùäéêüò ëÜèïõò: %d)",
|
||||
"Αδύνατη η δημιουργία της βάσης δεδομένων '%-.64s'. (κωδικός λάθους: %d)",
|
||||
"Αδύνατη η δημιουργία της βάσης δεδομένων '%-.64s'. Η βάση δεδομένων υπάρχει ήδη",
|
||||
"Áäýíáôç ç äçìéïõñãßá ôçò âÜóçò äåäïìÝíùí '%-.64s' (êùäéêüò ëÜèïõò: %d)",
|
||||
"Áäýíáôç ç äçìéïõñãßá ôçò âÜóçò äåäïìÝíùí '%-.64s'; Ç âÜóç äåäïìÝíùí õðÜñ÷åé Þäç",
|
||||
"Áäýíáôç ç äéáãñáöÞ ôçò âÜóçò äåäïìÝíùí '%-.64s'. Ç âÜóç äåäïìÝíùí äåí õðÜñ÷åé",
|
||||
"ÐáñïõóéÜóôçêå ðñüâëçìá êáôÜ ôç äéáãñáöÞ ôçò âÜóçò äåäïìÝíùí (áäýíáôç ç äéáãñáöÞ '%-.64s', êùäéêüò ëÜèïõò: %d)",
|
||||
"ÐáñïõóéÜóôçêå ðñüâëçìá êáôÜ ôç äéáãñáöÞ ôçò âÜóçò äåäïìÝíùí (áäýíáôç ç äéáãñáöÞ ôïõ öáêÝëëïõ '%-.64s', êùäéêüò ëÜèïõò: %d)",
|
||||
|
@ -213,7 +213,7 @@
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -266,3 +266,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -268,3 +268,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
"SI",
|
||||
"Impossibile creare il file '%-.64s' (errno: %d)",
|
||||
"Impossibile creare la tabella '%-.64s' (errno: %d)",
|
||||
"Impossibile creare il database '%-.64s'. (errno: %d)",
|
||||
"Impossibile creare il database '%-.64s'. Il database esiste",
|
||||
"Impossibile cancellare '%-.64s'. Il database non esiste",
|
||||
"Impossibile creare il database '%-.64s' (errno: %d)",
|
||||
"Impossibile creare il database '%-.64s'; il database esiste",
|
||||
"Impossibile cancellare '%-.64s'; il database non esiste",
|
||||
"Errore durante la cancellazione del database (impossibile cancellare '%-.64s', errno: %d)",
|
||||
"Errore durante la cancellazione del database (impossibile rmdir '%-.64s', errno: %d)",
|
||||
"Errore durante la cancellazione di '%-.64s' (errno: %d)",
|
||||
|
@ -266,3 +266,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -268,3 +268,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -266,3 +266,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
"JA",
|
||||
"Kan ikkje opprette fila '%-.64s' (Feilkode: %d)",
|
||||
"Kan ikkje opprette tabellen '%-.64s' (Feilkode: %d)",
|
||||
"Kan ikkje opprette databasen '%-.64s'. Feil %d",
|
||||
"Kan ikkje opprette databasen '%-.64s'. Databasen eksisterer",
|
||||
"Kan ikkje fjerne (drop) '%-.64s'. Databasen eksisterer ikkje",
|
||||
"Kan ikkje opprette databasen '%-.64s' (Feilkode: %d)",
|
||||
"Kan ikkje opprette databasen '%-.64s'; databasen eksisterer",
|
||||
"Kan ikkje fjerne (drop) '%-.64s'; databasen eksisterer ikkje",
|
||||
"Feil ved fjerning (drop) av databasen (kan ikkje slette '%-.64s', feil %d)",
|
||||
"Feil ved sletting av database (kan ikkje slette katalogen '%-.64s', feil %d)",
|
||||
"Feil ved sletting av '%-.64s' (Feilkode: %d)",
|
||||
|
@ -215,7 +215,7 @@
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -268,3 +268,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
"JA",
|
||||
"Kan ikke opprette fila '%-.64s' (Feilkode: %d)",
|
||||
"Kan ikke opprette tabellen '%-.64s' (Feilkode: %d)",
|
||||
"Kan ikke opprette databasen '%-.64s'. Feil %d",
|
||||
"Kan ikke opprette databasen '%-.64s'. Databasen eksisterer",
|
||||
"Kan ikke fjerne (drop) '%-.64s'. Databasen eksisterer ikke",
|
||||
"Kan ikke opprette databasen '%-.64s' (Feilkode: %d)",
|
||||
"Kan ikke opprette databasen '%-.64s'; databasen eksisterer",
|
||||
"Kan ikke fjerne (drop) '%-.64s'; databasen eksisterer ikke",
|
||||
"Feil ved fjerning (drop) av databasen (kan ikke slette '%-.64s', feil %d)",
|
||||
"Feil ved sletting av database (kan ikke slette katalogen '%-.64s', feil %d)",
|
||||
"Feil ved sletting av '%-.64s' (Feilkode: %d)",
|
||||
|
@ -215,7 +215,7 @@
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -268,3 +268,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
"TAK",
|
||||
"Nie mo¿na stworzyæ pliku '%-.64s' (Kod b³êdu: %d)",
|
||||
"Nie mo¿na stworzyæ tabeli '%-.64s' (Kod b³êdu: %d)",
|
||||
"Nie można stworzyć bazy danych '%-.64s'. Bł?d %d",
|
||||
"Nie można stworzyć bazy danych '%-.64s'. Baza danych już istnieje",
|
||||
"Nie można usun?ć bazy danych '%-.64s'. Baza danych nie istnieje",
|
||||
"Nie można stworzyć bazy danych '%-.64s' (Kod błędu: %d)",
|
||||
"Nie można stworzyć bazy danych '%-.64s'; baza danych już istnieje",
|
||||
"Nie można usun?ć bazy danych '%-.64s'; baza danych nie istnieje",
|
||||
"B³?d podczas usuwania bazy danych (nie mo¿na usun?æ '%-.64s', b³?d %d)",
|
||||
"B³?d podczas usuwania bazy danych (nie mo¿na wykonaæ rmdir '%-.64s', b³?d %d)",
|
||||
"B³?d podczas usuwania '%-.64s' (Kod b³êdu: %d)",
|
||||
|
@ -217,7 +217,7 @@
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -270,3 +270,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
"Não pode criar o arquivo '%-.64s' (erro no. %d)",
|
||||
"Não pode criar a tabela '%-.64s' (erro no. %d)",
|
||||
"Não pode criar o banco de dados '%-.64s' (erro no. %d)",
|
||||
"Não pode criar o banco de dados '%-.64s'. Este banco de dados já existe",
|
||||
"Não pode eliminar o banco de dados '%-.64s'. Este banco de dados não existe",
|
||||
"Não pode criar o banco de dados '%-.64s'; este banco de dados já existe",
|
||||
"Não pode eliminar o banco de dados '%-.64s'; este banco de dados não existe",
|
||||
"Erro ao eliminar banco de dados (não pode eliminar '%-.64s' - erro no. %d)",
|
||||
"Erro ao eliminar banco de dados (não pode remover diretório '%-.64s' - erro no. %d)",
|
||||
"Erro na remoção de '%-.64s' (erro no. %d)",
|
||||
|
@ -266,3 +266,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
"DA",
|
||||
"Nu pot sa creez fisierul '%-.64s' (Eroare: %d)",
|
||||
"Nu pot sa creez tabla '%-.64s' (Eroare: %d)",
|
||||
"Nu pot sa creez baza de date '%-.64s'. (Eroare: %d)",
|
||||
"Nu pot sa creez baza de date '%-.64s'. Baza de date exista deja",
|
||||
"Nu pot sa drop baza de date '%-.64s'. Baza da date este inexistenta",
|
||||
"Nu pot sa creez baza de date '%-.64s' (Eroare: %d)",
|
||||
"Nu pot sa creez baza de date '%-.64s'; baza de date exista deja",
|
||||
"Nu pot sa drop baza de date '%-.64s'; baza da date este inexistenta",
|
||||
"Eroare dropuind baza de date (nu pot sa sterg '%-.64s', Eroare: %d)",
|
||||
"Eroare dropuind baza de date (nu pot sa rmdir '%-.64s', Eroare: %d)",
|
||||
"Eroare incercind sa delete '%-.64s' (Eroare: %d)",
|
||||
|
@ -217,7 +217,7 @@
|
|||
"CREATE DATABASE not allowed while thread is holding global read lock",
|
||||
"Wrong arguments to %s",
|
||||
"%-.32s@%-.64s is not allowed to create new users",
|
||||
"Incorrect table definition; All MERGE tables must be in the same database",
|
||||
"Incorrect table definition; all MERGE tables must be in the same database",
|
||||
"Deadlock found when trying to get lock; Try restarting transaction",
|
||||
"The used table type doesn't support FULLTEXT indexes",
|
||||
"Cannot add foreign key constraint",
|
||||
|
@ -270,3 +270,4 @@
|
|||
"Can't revoke all privileges, grant for one or more of the requested users"
|
||||
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
|
||||
"Illegal mix of collations for operation '%s'",
|
||||
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue