mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Added --compact to mysqlbinlog
Fixed output from mysqlbinlog when using --skip-comments Fixed warnings from valgrind Fixed ref_length when used with HEAP tables More efficent need_conversion() Fixed error handling in UPDATE with not updateable tables Fixed bug in null handling in CAST to signed/unsigned client/client_priv.h: cleanup & added OPT_COMPACT client/mysqldump.c: Added option --compact to get a compact readable dump. Ensure that SET CHARACTER_SET_CLIENT is not done if we have not remembered the old character set Print optimization comments even if --skip-comments are given as these are not true comments. (Before these where only printed at end, which was a bug) mysql-test/r/cast.result: More cast tests mysql-test/r/derived.result: Removed warnings mysql-test/r/mysqldump.result: Update results after fixing mysqlbinlog mysql-test/r/query_cache.result: Make test usable with --extern more tests mysql-test/r/rpl_until.result: Make test repeatable under valgrind mysql-test/r/sql_mode.result: Fix test result mysql-test/r/subselect.result: Make test smaller. Update wrong results mysql-test/t/cast.test: More cast tests mysql-test/t/derived.test: Removed warnings mysql-test/t/query_cache.test: Make test usable with --extern more tests mysql-test/t/rpl_until.test: fix for valgrind. Becasue of unknown reason one got 'Slave_SQL_Running=yes' in this setup mysql-test/t/subselect.test: Make test case smaller sql/field.cc: Updated need_conversion() to use new arguments sql/ha_heap.cc: Moved initialization of ref_length to right place. This fixed problem that we had a ref_length of 8 for heap tables, which was not efficent. sql/item_func.cc: Cleanup sql/item_func.h: Fixed bug in null_handling for cast to signed/unsigned sql/item_strfunc.cc: Optimized/cleaned up Item_func_conv_charset3 sql/item_sum.cc: Cleanup. Ensure that some flag variables are cleared in cleanup() sql/item_sum.h: Fixed references to uninitialized memory sql/opt_range.cc: Fixed spelling error sql/sql_class.cc: Fixed wrong return code, which could case protocol problems sql/sql_class.h: After merge fix sql/sql_prepare.cc: Added comments sql/sql_show.cc: Cleanup sql/sql_string.cc: Optimzed usage of need_conversion(). - Removed not used argument - Save diff lenght in 'offset' to not have to recalculate length several times. Cleaned up comment Optimized copy_aligned() based on the knowledge that it's only called when you have wrong data sql/sql_string.h: Updated need_conversion() and copy_aligned() to use new arguments sql/sql_update.cc: Fixed error handling with non-updateable tables sql/sql_yacc.yy: Ensure that lex->lock_options are set correctly (to get rid of warnings from valgrind) Ensure that cast_type sets lex->charset and lex->length. Without these CONVERT() didn't work properly
This commit is contained in:
@ -26,7 +26,9 @@
|
|||||||
|
|
||||||
/* We have to define 'enum options' identical in all files to keep OS2 happy */
|
/* We have to define 'enum options' identical in all files to keep OS2 happy */
|
||||||
|
|
||||||
enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
|
enum options_client
|
||||||
|
{
|
||||||
|
OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
|
||||||
OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE,
|
OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE,
|
||||||
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
|
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
|
||||||
OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE,
|
OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE,
|
||||||
@ -37,7 +39,8 @@ enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
|
|||||||
OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL,
|
OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL,
|
||||||
OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
|
OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
|
||||||
OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
|
OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
|
||||||
OPT_DELETE_MASTER_LOGS,
|
OPT_DELETE_MASTER_LOGS, OPT_COMPACT,
|
||||||
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
|
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
|
||||||
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
|
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
|
||||||
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH };
|
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
|
||||||
|
};
|
||||||
|
@ -81,7 +81,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
|
|||||||
opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_names=0,
|
opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_names=0,
|
||||||
opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
|
opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
|
||||||
opt_delete_master_logs=0, tty_password=0,
|
opt_delete_master_logs=0, tty_password=0,
|
||||||
opt_single_transaction=0, opt_comments= 0;
|
opt_single_transaction=0, opt_comments= 0, opt_compact= 0;
|
||||||
static MYSQL mysql_connection,*sock=0;
|
static MYSQL mysql_connection,*sock=0;
|
||||||
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
|
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
|
||||||
*current_host=0,*path=0,*fields_terminated=0,
|
*current_host=0,*path=0,*fields_terminated=0,
|
||||||
@ -140,6 +140,10 @@ static struct my_option my_long_options[] =
|
|||||||
"Change the dump to be compatible with a given mode. By default tables are dumped without any restrictions. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option does a no operation on earlier server versions.",
|
"Change the dump to be compatible with a given mode. By default tables are dumped without any restrictions. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option does a no operation on earlier server versions.",
|
||||||
(gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0,
|
(gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0,
|
||||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"compact", OPT_COMPACT,
|
||||||
|
"Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-lock-tables",
|
||||||
|
(gptr*) &opt_compact, (gptr*) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||||
|
0, 0},
|
||||||
{"complete-insert", 'c', "Use complete insert statements.", (gptr*) &cFlag,
|
{"complete-insert", 'c', "Use complete insert statements.", (gptr*) &cFlag,
|
||||||
(gptr*) &cFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &cFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"compress", 'C', "Use compression in server/client protocol.",
|
{"compress", 'C', "Use compression in server/client protocol.",
|
||||||
@ -347,15 +351,19 @@ static void write_header(FILE *sql_file, char *db_name)
|
|||||||
fputs("<?xml version=\"1.0\"?>\n", sql_file);
|
fputs("<?xml version=\"1.0\"?>\n", sql_file);
|
||||||
fputs("<mysqldump>\n", sql_file);
|
fputs("<mysqldump>\n", sql_file);
|
||||||
}
|
}
|
||||||
else if (opt_comments)
|
else if (!opt_compact)
|
||||||
|
{
|
||||||
|
if (opt_comments)
|
||||||
{
|
{
|
||||||
fprintf(sql_file, "-- MySQL dump %s\n--\n", DUMP_VERSION);
|
fprintf(sql_file, "-- MySQL dump %s\n--\n", DUMP_VERSION);
|
||||||
fprintf(sql_file, "-- Host: %s Database: %s\n",
|
fprintf(sql_file, "-- Host: %s Database: %s\n",
|
||||||
current_host ? current_host : "localhost", db_name ? db_name : "");
|
current_host ? current_host : "localhost", db_name ? db_name :
|
||||||
|
"");
|
||||||
fputs("-- ------------------------------------------------------\n",
|
fputs("-- ------------------------------------------------------\n",
|
||||||
sql_file);
|
sql_file);
|
||||||
fprintf(sql_file, "-- Server version\t%s\n",
|
fprintf(sql_file, "-- Server version\t%s\n",
|
||||||
mysql_get_server_info(&mysql_connection));
|
mysql_get_server_info(&mysql_connection));
|
||||||
|
}
|
||||||
if (!opt_set_names)
|
if (!opt_set_names)
|
||||||
fprintf(sql_file,"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=%s */;\n",default_charset);
|
fprintf(sql_file,"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=%s */;\n",default_charset);
|
||||||
fprintf(md_result_file,"\
|
fprintf(md_result_file,"\
|
||||||
@ -371,17 +379,18 @@ static void write_header(FILE *sql_file, char *db_name)
|
|||||||
static void write_footer(FILE *sql_file)
|
static void write_footer(FILE *sql_file)
|
||||||
{
|
{
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
fputs("</mysqldump>", sql_file);
|
fputs("</mysqldump>\n", sql_file);
|
||||||
else
|
else if (!opt_compact)
|
||||||
{
|
{
|
||||||
fprintf(md_result_file,"\n\
|
fprintf(md_result_file,"\n\
|
||||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n\
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n\
|
||||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n\
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n\
|
||||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n\
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n");
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n\
|
if (!opt_set_names)
|
||||||
");
|
fprintf(md_result_file,
|
||||||
}
|
"/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n");
|
||||||
fputs("\n", sql_file);
|
fputs("\n", sql_file);
|
||||||
|
}
|
||||||
} /* write_footer */
|
} /* write_footer */
|
||||||
|
|
||||||
|
|
||||||
@ -448,6 +457,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
extended_insert= opt_drop= opt_lock= quick= create_options=
|
extended_insert= opt_drop= opt_lock= quick= create_options=
|
||||||
opt_disable_keys= lock_tables= 0;
|
opt_disable_keys= lock_tables= 0;
|
||||||
break;
|
break;
|
||||||
|
case (int) OPT_COMPACT:
|
||||||
|
if (opt_compact)
|
||||||
|
{
|
||||||
|
opt_comments= opt_drop= opt_disable_keys= opt_lock= 0;
|
||||||
|
opt_set_names= 1;
|
||||||
|
}
|
||||||
case (int) OPT_TABLES:
|
case (int) OPT_TABLES:
|
||||||
opt_databases=0;
|
opt_databases=0;
|
||||||
break;
|
break;
|
||||||
@ -1270,7 +1285,7 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
fprintf(md_result_file,"-- WHERE: %s\n",where);
|
fprintf(md_result_file,"-- WHERE: %s\n",where);
|
||||||
strxmov(strend(query), " WHERE ",where,NullS);
|
strxmov(strend(query), " WHERE ",where,NullS);
|
||||||
}
|
}
|
||||||
if (!opt_xml)
|
if (!opt_xml && !opt_compact)
|
||||||
fputs("\n", md_result_file);
|
fputs("\n", md_result_file);
|
||||||
if (mysql_query(sock, query))
|
if (mysql_query(sock, query))
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,12 @@ Note 1003 select high_priority ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as
|
|||||||
select cast(5 as unsigned) -6.0;
|
select cast(5 as unsigned) -6.0;
|
||||||
cast(5 as unsigned) -6.0
|
cast(5 as unsigned) -6.0
|
||||||
-1.0
|
-1.0
|
||||||
|
select cast(NULL as signed), cast(1/0 as signed);
|
||||||
|
cast(NULL as signed) cast(1/0 as signed)
|
||||||
|
NULL NULL
|
||||||
|
select cast(NULL as unsigned), cast(1/0 as unsigned);
|
||||||
|
cast(NULL as unsigned) cast(1/0 as unsigned)
|
||||||
|
NULL NULL
|
||||||
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
|
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
|
||||||
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
|
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
|
||||||
0 1
|
0 1
|
||||||
@ -36,6 +42,21 @@ cast("1:2:3" as TIME)
|
|||||||
select CONVERT("2004-01-22 21:45:33",DATE);
|
select CONVERT("2004-01-22 21:45:33",DATE);
|
||||||
CONVERT("2004-01-22 21:45:33",DATE)
|
CONVERT("2004-01-22 21:45:33",DATE)
|
||||||
2004-01-22
|
2004-01-22
|
||||||
|
select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
|
||||||
|
CONVERT(DATE "2004-01-22 21:45:33" USING latin1)
|
||||||
|
2004-01-22 21:45:33
|
||||||
|
select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
|
||||||
|
CONVERT(DATE "2004-01-22 21:45:33",CHAR)
|
||||||
|
2004-01-22 21:45:33
|
||||||
|
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
|
||||||
|
CONVERT(DATE "2004-01-22 21:45:33",CHAR(4))
|
||||||
|
2004
|
||||||
|
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY);
|
||||||
|
CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY)
|
||||||
|
2004
|
||||||
|
select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
|
||||||
|
CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY)
|
||||||
|
2004
|
||||||
set names binary;
|
set names binary;
|
||||||
select cast(_latin1'test' as char character set latin2);
|
select cast(_latin1'test' as char character set latin2);
|
||||||
cast(_latin1'test' as char character set latin2)
|
cast(_latin1'test' as char character set latin2)
|
||||||
@ -43,6 +64,12 @@ test
|
|||||||
select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251);
|
select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251);
|
||||||
cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251)
|
cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251)
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
|
||||||
|
convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci")
|
||||||
|
test
|
||||||
|
select convert(_koi8r'<27><><EFBFBD><EFBFBD>', "koi8r_general_ci", "cp1251_general_ci");
|
||||||
|
convert(_koi8r'<27><><EFBFBD><EFBFBD>', "koi8r_general_ci", "cp1251_general_ci")
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
create table t1 select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251) as t;
|
create table t1 select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251) as t;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
|
@ -252,9 +252,7 @@ drop table t1;
|
|||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`N` int(11) unsigned NOT NULL default '0',
|
`N` int(11) unsigned NOT NULL default '0',
|
||||||
`M` tinyint(1) default '0',
|
`M` tinyint(1) default '0',
|
||||||
) TYPE=MyISAM DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
Warnings:
|
|
||||||
Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
|
|
||||||
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
|
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
|
||||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
@ -279,9 +277,7 @@ OBJECTID int(11) NOT NULL default '0',
|
|||||||
SORTORDER int(11) NOT NULL auto_increment,
|
SORTORDER int(11) NOT NULL auto_increment,
|
||||||
KEY t1_SortIndex (SORTORDER),
|
KEY t1_SortIndex (SORTORDER),
|
||||||
KEY t1_IdIndex (OBJECTID)
|
KEY t1_IdIndex (OBJECTID)
|
||||||
) TYPE=MyISAM DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
Warnings:
|
|
||||||
Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
|
|
||||||
CREATE TABLE t2 (
|
CREATE TABLE t2 (
|
||||||
ID int(11) default NULL,
|
ID int(11) default NULL,
|
||||||
PARID int(11) default NULL,
|
PARID int(11) default NULL,
|
||||||
|
@ -21,6 +21,11 @@ DROP TABLE t1;
|
|||||||
CREATE TABLE t1 (a decimal(240, 20));
|
CREATE TABLE t1 (a decimal(240, 20));
|
||||||
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
||||||
("0987654321098765432109876543210987654321");
|
("0987654321098765432109876543210987654321");
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||||
DROP TABLE IF EXISTS `t1`;
|
DROP TABLE IF EXISTS `t1`;
|
||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`a` decimal(240,20) default NULL
|
`a` decimal(240,20) default NULL
|
||||||
@ -41,6 +46,11 @@ UNLOCK TABLES;
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (a double);
|
CREATE TABLE t1 (a double);
|
||||||
INSERT INTO t1 VALUES (-9e999999);
|
INSERT INTO t1 VALUES (-9e999999);
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||||
DROP TABLE IF EXISTS `t1`;
|
DROP TABLE IF EXISTS `t1`;
|
||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`a` double default NULL
|
`a` double default NULL
|
||||||
@ -105,6 +115,11 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
|
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
|
||||||
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
|
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||||
DROP TABLE IF EXISTS `t1`;
|
DROP TABLE IF EXISTS `t1`;
|
||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`a` varchar(255) default NULL
|
`a` varchar(255) default NULL
|
||||||
@ -125,6 +140,9 @@ UNLOCK TABLES;
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (a int) ENGINE=MYISAM;
|
CREATE TABLE t1 (a int) ENGINE=MYISAM;
|
||||||
INSERT INTO t1 VALUES (1), (2);
|
INSERT INTO t1 VALUES (1), (2);
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||||
DROP TABLE IF EXISTS `t1`;
|
DROP TABLE IF EXISTS `t1`;
|
||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`a` int(11) default NULL
|
`a` int(11) default NULL
|
||||||
@ -140,8 +158,10 @@ UNLOCK TABLES;
|
|||||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
||||||
|
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
|
||||||
DROP TABLE IF EXISTS `t1`;
|
DROP TABLE IF EXISTS `t1`;
|
||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`a` int(11) default NULL
|
`a` int(11) default NULL
|
||||||
@ -157,6 +177,5 @@ UNLOCK TABLES;
|
|||||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@ -696,17 +696,22 @@ word
|
|||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Qcache_queries_in_cache 1
|
Qcache_queries_in_cache 1
|
||||||
load data infile '../../std_data/words.dat' into table t1;
|
load data infile 'TEST_DIR/std_data/words.dat' into table t1;
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Qcache_queries_in_cache 0
|
Qcache_queries_in_cache 0
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
70
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
insert into t1 values (1),(2),(3);
|
insert into t1 values (1),(2),(3);
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Qcache_queries_in_cache 0
|
Qcache_queries_in_cache 0
|
||||||
select * from t1 into outfile "query_caceh.out.file";
|
select * from t1 into outfile "query_cache.out.file";
|
||||||
|
select * from t1 into outfile "query_cache.out.file";
|
||||||
|
ERROR HY000: File 'query_cache.out.file' already exists
|
||||||
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
|
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
|
@ -55,7 +55,7 @@ stop slave;
|
|||||||
start slave until master_log_file='master-bin.000001', master_log_pos=561;
|
start slave until master_log_file='master-bin.000001', master_log_pos=561;
|
||||||
show slave status;
|
show slave status;
|
||||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 561 # Master master-bin.000001 561 No #
|
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes # 0 0 561 # Master master-bin.000001 561 No #
|
||||||
start slave until master_log_file='master-bin', master_log_pos=561;
|
start slave until master_log_file='master-bin', master_log_pos=561;
|
||||||
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
|
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
|
||||||
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
|
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
|
||||||
|
@ -70,7 +70,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
`email` varchar(60) NOT NULL default '',
|
`email` varchar(60) NOT NULL default '',
|
||||||
PRIMARY KEY (`a`),
|
PRIMARY KEY (`a`),
|
||||||
UNIQUE KEY `email` (`email`)
|
UNIQUE KEY `email` (`email`)
|
||||||
) ENGINE=HEAP ROW_FORMAT=DYNAMIC
|
) TYPE=HEAP ROW_FORMAT=DYNAMIC
|
||||||
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
|
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
|
||||||
select @@sql_mode;
|
select @@sql_mode;
|
||||||
@@sql_mode
|
@@sql_mode
|
||||||
|
@ -1578,50 +1578,28 @@ select * from t1;
|
|||||||
a b
|
a b
|
||||||
1 0.123
|
1 0.123
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE `t1` (
|
||||||
id int(11) NOT NULL auto_increment,
|
`id` int(11) NOT NULL auto_increment,
|
||||||
ts timestamp NOT NULL,
|
`id_cns` tinyint(3) unsigned NOT NULL default '0',
|
||||||
id_cns tinyint(3) unsigned NOT NULL default '0',
|
`tipo` enum('','UNO','DUE') NOT NULL default '',
|
||||||
id_desc_nota int(11) NOT NULL default '1',
|
`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
|
||||||
id_publ_uff int(11) NOT NULL default '0',
|
`particolare` mediumint(8) unsigned NOT NULL default '0',
|
||||||
tipo enum('','UNO','DUE') NOT NULL default '',
|
`generale` mediumint(8) unsigned NOT NULL default '0',
|
||||||
f_aggiunte set('TRE','TRETRE','QUATTRO','CINQUE','SEI','SETTE') NOT NULL
|
`bis` tinyint(3) unsigned NOT NULL default '0',
|
||||||
default '',
|
PRIMARY KEY (`id`),
|
||||||
anno_dep smallint(4) unsigned zerofill NOT NULL default '0000',
|
UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
|
||||||
data_dep smallint(4) unsigned zerofill NOT NULL default '0000',
|
UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
|
||||||
particolare mediumint(8) unsigned NOT NULL default '0',
|
|
||||||
generale mediumint(8) unsigned NOT NULL default '0',
|
|
||||||
bis tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY(id),
|
|
||||||
UNIQUE KEY idx_cns_gen_anno (anno_dep,id_cns,generale,particolare),
|
|
||||||
UNIQUE KEY idx_cns_par_anno (id_cns,anno_dep,tipo,particolare,bis)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;
|
|
||||||
INSERT INTO t1 (id, ts, id_cns, id_desc_nota, id_publ_uff, tipo, f_aggiunte,
|
|
||||||
anno_dep, data_dep, particolare, generale, bis) VALUES
|
|
||||||
(NULL, NULL, 16, 29, 622, 'UNO', '', 1987, 1218, 2048, 9681, 0),
|
|
||||||
(NULL, NULL, 50, 23, 1717, 'UNO', '', 1987, 1126, 1536, 13987, 0),
|
|
||||||
(NULL, NULL, 16, 123, 123, 'UNO', '', 1987, 1221, 2432, 14594, 0),
|
|
||||||
(NULL, NULL, 16, 124, 124, 'UNO', '', 1987, 1201, 1792, 13422, 0),
|
|
||||||
(NULL, NULL, 16, 125, 125, 'UNO', '', 1987, 0723, 1025, 10240, 0),
|
|
||||||
(NULL, NULL, 16, 126, 126, 'UNO', '', 1987, 1204, 1026, 7089, 0);
|
|
||||||
CREATE TABLE t2 (
|
|
||||||
id tinyint(3) unsigned NOT NULL auto_increment,
|
|
||||||
descr varchar(40) NOT NULL default '',
|
|
||||||
f_servizi set('UNO','DUE') NOT NULL default '',
|
|
||||||
data_uno_min int(8) unsigned NOT NULL default '0',
|
|
||||||
data_due_min int(8) unsigned NOT NULL default '0',
|
|
||||||
max_anno_dep smallint(6) unsigned NOT NULL default '0',
|
|
||||||
data_agg int(8) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
);
|
||||||
INSERT INTO t2 (id, descr, f_servizi, data_uno_min, data_due_min,
|
INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
|
||||||
max_anno_dep, data_agg) VALUES
|
CREATE TABLE `t2` (
|
||||||
(16, 'C_UNO', 'UNO,DUE', 19000000, 30000000, 1987, 0),
|
`id` tinyint(3) unsigned NOT NULL auto_increment,
|
||||||
(50, 'C_TRE', 'UNO', 19000000, 30000000, 1990, 0);
|
`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
|
||||||
SELECT cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE
|
PRIMARY KEY (`id`)
|
||||||
s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM
|
);
|
||||||
t2 AS cns;
|
INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
|
||||||
PIPPO
|
SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
|
||||||
1
|
id max_anno_dep PIPPO
|
||||||
NULL
|
16 1987 1
|
||||||
|
50 1990 0
|
||||||
|
51 1990 NULL
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
@ -10,10 +10,17 @@ select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1;
|
|||||||
select ~5, cast(~5 as signed);
|
select ~5, cast(~5 as signed);
|
||||||
explain extended select ~5, cast(~5 as signed);
|
explain extended select ~5, cast(~5 as signed);
|
||||||
select cast(5 as unsigned) -6.0;
|
select cast(5 as unsigned) -6.0;
|
||||||
|
select cast(NULL as signed), cast(1/0 as signed);
|
||||||
|
select cast(NULL as unsigned), cast(1/0 as unsigned);
|
||||||
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
|
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
|
||||||
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
|
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
|
||||||
select cast("1:2:3" as TIME);
|
select cast("1:2:3" as TIME);
|
||||||
select CONVERT("2004-01-22 21:45:33",DATE);
|
select CONVERT("2004-01-22 21:45:33",DATE);
|
||||||
|
select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
|
||||||
|
select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
|
||||||
|
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
|
||||||
|
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY);
|
||||||
|
select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
|
||||||
|
|
||||||
#
|
#
|
||||||
# Character set convertion
|
# Character set convertion
|
||||||
@ -21,6 +28,8 @@ select CONVERT("2004-01-22 21:45:33",DATE);
|
|||||||
set names binary;
|
set names binary;
|
||||||
select cast(_latin1'test' as char character set latin2);
|
select cast(_latin1'test' as char character set latin2);
|
||||||
select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251);
|
select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251);
|
||||||
|
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
|
||||||
|
select convert(_koi8r'<27><><EFBFBD><EFBFBD>', "koi8r_general_ci", "cp1251_general_ci");
|
||||||
create table t1 select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251) as t;
|
create table t1 select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251) as t;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -147,7 +147,7 @@ drop table t1;
|
|||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`N` int(11) unsigned NOT NULL default '0',
|
`N` int(11) unsigned NOT NULL default '0',
|
||||||
`M` tinyint(1) default '0',
|
`M` tinyint(1) default '0',
|
||||||
) TYPE=MyISAM DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
|
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
|
||||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
@ -167,7 +167,7 @@ CREATE TABLE t1 (
|
|||||||
SORTORDER int(11) NOT NULL auto_increment,
|
SORTORDER int(11) NOT NULL auto_increment,
|
||||||
KEY t1_SortIndex (SORTORDER),
|
KEY t1_SortIndex (SORTORDER),
|
||||||
KEY t1_IdIndex (OBJECTID)
|
KEY t1_IdIndex (OBJECTID)
|
||||||
) TYPE=MyISAM DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
CREATE TABLE t2 (
|
CREATE TABLE t2 (
|
||||||
ID int(11) default NULL,
|
ID int(11) default NULL,
|
||||||
PARID int(11) default NULL,
|
PARID int(11) default NULL,
|
||||||
|
@ -466,8 +466,10 @@ select * from t1 where id=2;
|
|||||||
create table t1 (word char(20) not null);
|
create table t1 (word char(20) not null);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
load data infile '../../std_data/words.dat' into table t1;
|
--replace_result $MYSQL_TEST_DIR TEST_DIR
|
||||||
|
eval load data infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
|
select count(*) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -476,7 +478,9 @@ drop table t1;
|
|||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
insert into t1 values (1),(2),(3);
|
insert into t1 values (1),(2),(3);
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
select * from t1 into outfile "query_caceh.out.file";
|
select * from t1 into outfile "query_cache.out.file";
|
||||||
|
--error 1086
|
||||||
|
select * from t1 into outfile "query_cache.out.file";
|
||||||
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
|
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -59,10 +59,11 @@ stop slave;
|
|||||||
|
|
||||||
# this should stop immideately
|
# this should stop immideately
|
||||||
start slave until master_log_file='master-bin.000001', master_log_pos=561;
|
start slave until master_log_file='master-bin.000001', master_log_pos=561;
|
||||||
--real-sleep 2;
|
# 2 is not enough when running with valgrind
|
||||||
|
--real-sleep 4;
|
||||||
# here the sql slave thread should be stopped
|
# here the sql slave thread should be stopped
|
||||||
--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
|
--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
|
||||||
--replace_column 1 # 9 # 23 # 33 #
|
--replace_column 1 # 9 # 12 # 23 # 33 #
|
||||||
show slave status;
|
show slave status;
|
||||||
|
|
||||||
#testing various error conditions
|
#testing various error conditions
|
||||||
|
@ -1026,52 +1026,26 @@ drop table t1;
|
|||||||
# Bug 2479
|
# Bug 2479
|
||||||
#
|
#
|
||||||
|
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE `t1` (
|
||||||
id int(11) NOT NULL auto_increment,
|
`id` int(11) NOT NULL auto_increment,
|
||||||
ts timestamp NOT NULL,
|
`id_cns` tinyint(3) unsigned NOT NULL default '0',
|
||||||
id_cns tinyint(3) unsigned NOT NULL default '0',
|
`tipo` enum('','UNO','DUE') NOT NULL default '',
|
||||||
id_desc_nota int(11) NOT NULL default '1',
|
`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
|
||||||
id_publ_uff int(11) NOT NULL default '0',
|
`particolare` mediumint(8) unsigned NOT NULL default '0',
|
||||||
tipo enum('','UNO','DUE') NOT NULL default '',
|
`generale` mediumint(8) unsigned NOT NULL default '0',
|
||||||
f_aggiunte set('TRE','TRETRE','QUATTRO','CINQUE','SEI','SETTE') NOT NULL
|
`bis` tinyint(3) unsigned NOT NULL default '0',
|
||||||
default '',
|
PRIMARY KEY (`id`),
|
||||||
anno_dep smallint(4) unsigned zerofill NOT NULL default '0000',
|
UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
|
||||||
data_dep smallint(4) unsigned zerofill NOT NULL default '0000',
|
UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
|
||||||
particolare mediumint(8) unsigned NOT NULL default '0',
|
|
||||||
generale mediumint(8) unsigned NOT NULL default '0',
|
|
||||||
bis tinyint(3) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY(id),
|
|
||||||
UNIQUE KEY idx_cns_gen_anno (anno_dep,id_cns,generale,particolare),
|
|
||||||
UNIQUE KEY idx_cns_par_anno (id_cns,anno_dep,tipo,particolare,bis)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;
|
|
||||||
|
|
||||||
INSERT INTO t1 (id, ts, id_cns, id_desc_nota, id_publ_uff, tipo, f_aggiunte,
|
|
||||||
anno_dep, data_dep, particolare, generale, bis) VALUES
|
|
||||||
(NULL, NULL, 16, 29, 622, 'UNO', '', 1987, 1218, 2048, 9681, 0),
|
|
||||||
(NULL, NULL, 50, 23, 1717, 'UNO', '', 1987, 1126, 1536, 13987, 0),
|
|
||||||
(NULL, NULL, 16, 123, 123, 'UNO', '', 1987, 1221, 2432, 14594, 0),
|
|
||||||
(NULL, NULL, 16, 124, 124, 'UNO', '', 1987, 1201, 1792, 13422, 0),
|
|
||||||
(NULL, NULL, 16, 125, 125, 'UNO', '', 1987, 0723, 1025, 10240, 0),
|
|
||||||
(NULL, NULL, 16, 126, 126, 'UNO', '', 1987, 1204, 1026, 7089, 0);
|
|
||||||
|
|
||||||
CREATE TABLE t2 (
|
|
||||||
id tinyint(3) unsigned NOT NULL auto_increment,
|
|
||||||
descr varchar(40) NOT NULL default '',
|
|
||||||
f_servizi set('UNO','DUE') NOT NULL default '',
|
|
||||||
data_uno_min int(8) unsigned NOT NULL default '0',
|
|
||||||
data_due_min int(8) unsigned NOT NULL default '0',
|
|
||||||
max_anno_dep smallint(6) unsigned NOT NULL default '0',
|
|
||||||
data_agg int(8) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY (id)
|
|
||||||
);
|
);
|
||||||
|
INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
|
||||||
|
CREATE TABLE `t2` (
|
||||||
|
`id` tinyint(3) unsigned NOT NULL auto_increment,
|
||||||
|
`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
|
||||||
|
|
||||||
INSERT INTO t2 (id, descr, f_servizi, data_uno_min, data_due_min,
|
SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
|
||||||
max_anno_dep, data_agg) VALUES
|
|
||||||
(16, 'C_UNO', 'UNO,DUE', 19000000, 30000000, 1987, 0),
|
|
||||||
(50, 'C_TRE', 'UNO', 19000000, 30000000, 1990, 0);
|
|
||||||
|
|
||||||
SELECT cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE
|
|
||||||
s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM
|
|
||||||
t2 AS cns;
|
|
||||||
|
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
20
sql/field.cc
20
sql/field.cc
@ -4058,10 +4058,12 @@ void Field_datetime::sql_type(String &res) const
|
|||||||
int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
|
int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
int error= 0;
|
int error= 0;
|
||||||
|
uint32 not_used;
|
||||||
char buff[80];
|
char buff[80];
|
||||||
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
||||||
|
|
||||||
/* Convert character set if nesessary */
|
/* Convert character set if nesessary */
|
||||||
if (String::needs_conversion(from, length, cs, field_charset))
|
if (String::needs_conversion(length, cs, field_charset, ¬_used))
|
||||||
{
|
{
|
||||||
tmpstr.copy(from, length, cs, field_charset);
|
tmpstr.copy(from, length, cs, field_charset);
|
||||||
from= tmpstr.ptr();
|
from= tmpstr.ptr();
|
||||||
@ -4246,10 +4248,12 @@ uint Field_string::max_packed_col_length(uint max_length)
|
|||||||
int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
|
int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
int error= 0;
|
int error= 0;
|
||||||
|
uint32 not_used;
|
||||||
char buff[80];
|
char buff[80];
|
||||||
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
||||||
|
|
||||||
/* Convert character set if nesessary */
|
/* Convert character set if nesessary */
|
||||||
if (String::needs_conversion(from, length, cs, field_charset))
|
if (String::needs_conversion(length, cs, field_charset, ¬_used))
|
||||||
{
|
{
|
||||||
tmpstr.copy(from, length, cs, field_charset);
|
tmpstr.copy(from, length, cs, field_charset);
|
||||||
from= tmpstr.ptr();
|
from= tmpstr.ptr();
|
||||||
@ -4565,10 +4569,11 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||||||
bool was_conversion;
|
bool was_conversion;
|
||||||
char buff[80];
|
char buff[80];
|
||||||
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
||||||
|
uint32 not_used;
|
||||||
|
|
||||||
/* Convert character set if nesessary */
|
/* Convert character set if nesessary */
|
||||||
if ((was_conversion= String::needs_conversion(from, length,
|
if ((was_conversion= String::needs_conversion(length, cs, field_charset,
|
||||||
cs, field_charset)))
|
¬_used)))
|
||||||
{
|
{
|
||||||
tmpstr.copy(from, length, cs, field_charset);
|
tmpstr.copy(from, length, cs, field_charset);
|
||||||
from= tmpstr.ptr();
|
from= tmpstr.ptr();
|
||||||
@ -5079,10 +5084,12 @@ void Field_enum::store_type(ulonglong value)
|
|||||||
int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
|
int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
int err= 0;
|
int err= 0;
|
||||||
|
uint32 not_used;
|
||||||
char buff[80];
|
char buff[80];
|
||||||
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
||||||
|
|
||||||
/* Convert character set if nesessary */
|
/* Convert character set if nesessary */
|
||||||
if (String::needs_conversion(from, length, cs, field_charset))
|
if (String::needs_conversion(length, cs, field_charset, ¬_used))
|
||||||
{
|
{
|
||||||
tmpstr.copy(from, length, cs, field_charset);
|
tmpstr.copy(from, length, cs, field_charset);
|
||||||
from= tmpstr.ptr();
|
from= tmpstr.ptr();
|
||||||
@ -5259,11 +5266,12 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||||||
int err= 0;
|
int err= 0;
|
||||||
char *not_used;
|
char *not_used;
|
||||||
uint not_used2;
|
uint not_used2;
|
||||||
|
uint32 not_used_offset;
|
||||||
char buff[80];
|
char buff[80];
|
||||||
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
String tmpstr(buff,sizeof(buff), &my_charset_bin);
|
||||||
|
|
||||||
/* Convert character set if nesessary */
|
/* Convert character set if nesessary */
|
||||||
if (String::needs_conversion(from, length, cs, field_charset))
|
if (String::needs_conversion(length, cs, field_charset, ¬_used_offset))
|
||||||
{
|
{
|
||||||
tmpstr.copy(from, length, cs, field_charset);
|
tmpstr.copy(from, length, cs, field_charset);
|
||||||
from= tmpstr.ptr();
|
from= tmpstr.ptr();
|
||||||
|
@ -40,6 +40,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
|
|||||||
if (!create(name, table, &create_info))
|
if (!create(name, table, &create_info))
|
||||||
file= heap_open(name, mode);
|
file= heap_open(name, mode);
|
||||||
}
|
}
|
||||||
|
ref_length= sizeof(HEAP_PTR);
|
||||||
return (file ? 0 : 1);
|
return (file ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +336,6 @@ int ha_heap::create(const char *name, TABLE *table_arg,
|
|||||||
my_free((gptr) keydef, MYF(0));
|
my_free((gptr) keydef, MYF(0));
|
||||||
if (file)
|
if (file)
|
||||||
info(HA_STATUS_NO_LOCK | HA_STATUS_CONST | HA_STATUS_VARIABLE);
|
info(HA_STATUS_NO_LOCK | HA_STATUS_CONST | HA_STATUS_VARIABLE);
|
||||||
ref_length= sizeof(HEAP_PTR);
|
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,8 +1068,7 @@ String *Item_func_min_max::val_str(String *str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!res) // If NULL
|
if (res) // If !NULL
|
||||||
return 0;
|
|
||||||
res->set_charset(collation.collation);
|
res->set_charset(collation.collation);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -211,20 +211,28 @@ class Item_func_signed :public Item_int_func
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Item_func_signed(Item *a) :Item_int_func(a) {}
|
Item_func_signed(Item *a) :Item_int_func(a) {}
|
||||||
double val() { null_value=args[0]->null_value; return args[0]->val(); }
|
double val()
|
||||||
longlong val_int() { null_value=args[0]->null_value; return args[0]->val_int(); }
|
{
|
||||||
|
double tmp= args[0]->val();
|
||||||
|
null_value= args[0]->null_value;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
longlong val_int()
|
||||||
|
{
|
||||||
|
longlong tmp= args[0]->val_int();
|
||||||
|
null_value= args[0]->null_value;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{ max_length=args[0]->max_length; unsigned_flag=0; }
|
{ max_length=args[0]->max_length; unsigned_flag=0; }
|
||||||
void print(String *str);
|
void print(String *str);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Item_func_unsigned :public Item_int_func
|
class Item_func_unsigned :public Item_func_signed
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Item_func_unsigned(Item *a) :Item_int_func(a) {}
|
Item_func_unsigned(Item *a) :Item_func_signed(a) {}
|
||||||
double val() { null_value=args[0]->null_value; return args[0]->val(); }
|
|
||||||
longlong val_int() { null_value=args[0]->null_value; return args[0]->val_int(); }
|
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{ max_length=args[0]->max_length; unsigned_flag=1; }
|
{ max_length=args[0]->max_length; unsigned_flag=1; }
|
||||||
void print(String *str);
|
void print(String *str);
|
||||||
|
@ -2126,14 +2126,12 @@ void Item_func_conv_charset::print(String *str)
|
|||||||
|
|
||||||
String *Item_func_conv_charset3::val_str(String *str)
|
String *Item_func_conv_charset3::val_str(String *str)
|
||||||
{
|
{
|
||||||
my_wc_t wc;
|
char cs1[30], cs2[30];
|
||||||
int cnvres;
|
String to_cs_buff(cs1, sizeof(cs1), default_charset_info);
|
||||||
const uchar *s, *se;
|
String from_cs_buff(cs2, sizeof(cs2), default_charset_info);
|
||||||
uchar *d, *d0, *de;
|
|
||||||
uint32 dmaxlen;
|
|
||||||
String *arg= args[0]->val_str(str);
|
String *arg= args[0]->val_str(str);
|
||||||
String *to_cs= args[1]->val_str(str);
|
String *to_cs= args[1]->val_str(&to_cs_buff);
|
||||||
String *from_cs= args[2]->val_str(str);
|
String *from_cs= args[2]->val_str(&from_cs_buff);
|
||||||
CHARSET_INFO *from_charset;
|
CHARSET_INFO *from_charset;
|
||||||
CHARSET_INFO *to_charset;
|
CHARSET_INFO *to_charset;
|
||||||
|
|
||||||
@ -2147,47 +2145,13 @@ String *Item_func_conv_charset3::val_str(String *str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s=(const uchar*)arg->ptr();
|
if (str_value.copy(arg->ptr(), arg->length(), from_charset, to_charset))
|
||||||
se=s+arg->length();
|
|
||||||
|
|
||||||
dmaxlen=arg->length()*to_charset->mbmaxlen+1;
|
|
||||||
str->alloc(dmaxlen);
|
|
||||||
d0=d=(unsigned char*)str->ptr();
|
|
||||||
de=d+dmaxlen;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
{
|
||||||
cnvres=from_charset->cset->mb_wc(from_charset,&wc,s,se);
|
null_value= 1;
|
||||||
if (cnvres>0)
|
return 0;
|
||||||
{
|
|
||||||
s+=cnvres;
|
|
||||||
}
|
}
|
||||||
else if (cnvres==MY_CS_ILSEQ)
|
null_value= 0;
|
||||||
{
|
return &str_value;
|
||||||
s++;
|
|
||||||
wc='?';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
|
|
||||||
outp:
|
|
||||||
cnvres=to_charset->cset->wc_mb(to_charset,wc,d,de);
|
|
||||||
if (cnvres>0)
|
|
||||||
{
|
|
||||||
d+=cnvres;
|
|
||||||
}
|
|
||||||
else if (cnvres==MY_CS_ILUNI && wc!='?')
|
|
||||||
{
|
|
||||||
wc='?';
|
|
||||||
goto outp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
str->length((uint32) (d-d0));
|
|
||||||
str->set_charset(to_charset);
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1092,14 +1092,20 @@ void Item_sum_count_distinct::cleanup()
|
|||||||
if (!original)
|
if (!original)
|
||||||
{
|
{
|
||||||
if (table)
|
if (table)
|
||||||
|
{
|
||||||
free_tmp_table(current_thd, table);
|
free_tmp_table(current_thd, table);
|
||||||
delete tmp_table_param;
|
|
||||||
if (use_tree)
|
|
||||||
delete_tree(tree);
|
|
||||||
table= 0;
|
table= 0;
|
||||||
|
}
|
||||||
|
delete tmp_table_param;
|
||||||
|
tmp_table_param= 0;
|
||||||
|
if (use_tree)
|
||||||
|
{
|
||||||
|
delete_tree(tree);
|
||||||
use_tree= 0;
|
use_tree= 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Item_sum_count_distinct::fix_fields(THD *thd, TABLE_LIST *tables,
|
bool Item_sum_count_distinct::fix_fields(THD *thd, TABLE_LIST *tables,
|
||||||
Item **ref)
|
Item **ref)
|
||||||
@ -1674,12 +1680,20 @@ void Item_func_group_concat::cleanup()
|
|||||||
{
|
{
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
if (table)
|
if (table)
|
||||||
|
{
|
||||||
free_tmp_table(thd, table);
|
free_tmp_table(thd, table);
|
||||||
|
table= 0;
|
||||||
|
}
|
||||||
delete tmp_table_param;
|
delete tmp_table_param;
|
||||||
|
tmp_table_param= 0;
|
||||||
if (tree_mode)
|
if (tree_mode)
|
||||||
|
{
|
||||||
|
tree_mode= 0;
|
||||||
delete_tree(tree);
|
delete_tree(tree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Item_func_group_concat::~Item_func_group_concat()
|
Item_func_group_concat::~Item_func_group_concat()
|
||||||
{
|
{
|
||||||
|
@ -397,12 +397,13 @@ class Item_sum_hybrid :public Item_sum
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Item_sum_hybrid(Item *item_par,int sign)
|
Item_sum_hybrid(Item *item_par,int sign)
|
||||||
:Item_sum(item_par), hybrid_type(INT_RESULT), cmp_sign(sign),
|
:Item_sum(item_par), sum(0.0), sum_int(0),
|
||||||
used_table_cache(~(table_map) 0),
|
hybrid_type(INT_RESULT), hybrid_field_type(FIELD_TYPE_LONGLONG),
|
||||||
|
cmp_sign(sign), used_table_cache(~(table_map) 0),
|
||||||
cmp_charset(&my_charset_bin)
|
cmp_charset(&my_charset_bin)
|
||||||
{}
|
{}
|
||||||
Item_sum_hybrid(THD *thd, Item_sum_hybrid *item):
|
Item_sum_hybrid(THD *thd, Item_sum_hybrid *item):
|
||||||
Item_sum(thd, item), value(item->value), tmp_value(item->tmp_value),
|
Item_sum(thd, item), value(item->value),
|
||||||
sum(item->sum), sum_int(item->sum_int), hybrid_type(item->hybrid_type),
|
sum(item->sum), sum_int(item->sum_int), hybrid_type(item->hybrid_type),
|
||||||
hybrid_field_type(item->hybrid_field_type),cmp_sign(item->cmp_sign),
|
hybrid_field_type(item->hybrid_field_type),cmp_sign(item->cmp_sign),
|
||||||
used_table_cache(item->used_table_cache), cmp_charset(item->cmp_charset) {}
|
used_table_cache(item->used_table_cache), cmp_charset(item->cmp_charset) {}
|
||||||
|
@ -1005,7 +1005,7 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We can't use an index when comparing stings of
|
We can't use an index when comparing strings of
|
||||||
different collations
|
different collations
|
||||||
*/
|
*/
|
||||||
if (field->result_type() == STRING_RESULT &&
|
if (field->result_type() == STRING_RESULT &&
|
||||||
|
@ -744,7 +744,7 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
|
|||||||
if (!access(path, F_OK))
|
if (!access(path, F_OK))
|
||||||
{
|
{
|
||||||
my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
|
my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Create the file world readable */
|
/* Create the file world readable */
|
||||||
if ((file= my_create(path, 0666, O_WRONLY, MYF(MY_WME))) < 0)
|
if ((file= my_create(path, 0666, O_WRONLY, MYF(MY_WME))) < 0)
|
||||||
|
@ -993,10 +993,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
class select_dump :public select_to_file {
|
class select_dump :public select_to_file {
|
||||||
sql_exchange *exchange;
|
|
||||||
File file;
|
|
||||||
IO_CACHE cache;
|
|
||||||
ha_rows row_count;
|
|
||||||
public:
|
public:
|
||||||
select_dump(sql_exchange *ex) :select_to_file(ex) {}
|
select_dump(sql_exchange *ex) :select_to_file(ex) {}
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
|
@ -1005,8 +1005,10 @@ void mysql_stmt_execute(THD *thd, char *packet)
|
|||||||
sl->where= sl->prep_where->copy_andor_structure(thd);
|
sl->where= sl->prep_where->copy_andor_structure(thd);
|
||||||
DBUG_ASSERT(sl->join == 0);
|
DBUG_ASSERT(sl->join == 0);
|
||||||
ORDER *order;
|
ORDER *order;
|
||||||
|
/* Fix GROUP list */
|
||||||
for (order=(ORDER *)sl->group_list.first ; order ; order=order->next)
|
for (order=(ORDER *)sl->group_list.first ; order ; order=order->next)
|
||||||
order->item= (Item **)(order+1);
|
order->item= (Item **)(order+1);
|
||||||
|
/* Fix ORDER list */
|
||||||
for (order=(ORDER *)sl->order_list.first ; order ; order=order->next)
|
for (order=(ORDER *)sl->order_list.first ; order ; order=order->next)
|
||||||
order->item= (Item **)(order+1);
|
order->item= (Item **)(order+1);
|
||||||
}
|
}
|
||||||
|
@ -519,8 +519,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
|||||||
protocol->store_null();
|
protocol->store_null();
|
||||||
// Send error to Comment field
|
// Send error to Comment field
|
||||||
protocol->store(thd->net.last_error, system_charset_info);
|
protocol->store(thd->net.last_error, system_charset_info);
|
||||||
thd->net.last_error[0]=0;
|
thd->clear_error();
|
||||||
thd->net.last_errno= 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -230,67 +230,85 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Checks that the source string can be just copied
|
Checks that the source string can be just copied to the destination string
|
||||||
to the destination string without conversion.
|
without conversion.
|
||||||
If either character set conversion or adding leading
|
|
||||||
zeros (e.g. for UCS-2) must be done then return
|
SYNPOSIS
|
||||||
value is TRUE else FALSE.
|
|
||||||
|
needs_conversion()
|
||||||
|
arg_length Length of string to copy.
|
||||||
|
from_cs Character set to copy from
|
||||||
|
to_cs Character set to copy to
|
||||||
|
uint32 *offset Returns number of unaligned characters.
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
0 No conversion needed
|
||||||
|
1 Either character set conversion or adding leading zeros
|
||||||
|
(e.g. for UCS-2) must be done
|
||||||
*/
|
*/
|
||||||
bool String::needs_conversion(const char *str, uint32 arg_length,
|
|
||||||
|
bool String::needs_conversion(uint32 arg_length,
|
||||||
CHARSET_INFO *from_cs,
|
CHARSET_INFO *from_cs,
|
||||||
CHARSET_INFO *to_cs)
|
CHARSET_INFO *to_cs,
|
||||||
|
uint32 *offset)
|
||||||
{
|
{
|
||||||
|
*offset= 0;
|
||||||
if ((to_cs == &my_charset_bin) ||
|
if ((to_cs == &my_charset_bin) ||
|
||||||
(to_cs == from_cs) ||
|
(to_cs == from_cs) ||
|
||||||
my_charset_same(from_cs, to_cs) ||
|
my_charset_same(from_cs, to_cs) ||
|
||||||
((from_cs == &my_charset_bin) && (!(arg_length % to_cs->mbminlen))))
|
((from_cs == &my_charset_bin) &&
|
||||||
|
(!(*offset=(arg_length % to_cs->mbminlen)))))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** For real multi-byte, ascii incompatible charactser sets,
|
Copy a multi-byte character sets with adding leading zeros.
|
||||||
** like UCS-2, add leading zeros if we have an incomplete character.
|
|
||||||
** Thus,
|
SYNOPSIS
|
||||||
** SELECT _ucs2 0xAA
|
|
||||||
** will automatically be converted into
|
copy_aligned()
|
||||||
** SELECT _ucs2 0x00AA
|
str String to copy
|
||||||
|
arg_length Length of string. This should NOT be dividable with
|
||||||
|
cs->mbminlen.
|
||||||
|
offset arg_length % cs->mb_minlength
|
||||||
|
cs Character set for 'str'
|
||||||
|
|
||||||
|
NOTES
|
||||||
|
For real multi-byte, ascii incompatible charactser sets,
|
||||||
|
like UCS-2, add leading zeros if we have an incomplete character.
|
||||||
|
Thus,
|
||||||
|
SELECT _ucs2 0xAA
|
||||||
|
will automatically be converted into
|
||||||
|
SELECT _ucs2 0x00AA
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
0 ok
|
||||||
|
1 error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool String::copy_aligned(const char *str,uint32 arg_length,
|
bool String::copy_aligned(const char *str,uint32 arg_length, uint32 offset,
|
||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
/* How many bytes are in incomplete character */
|
/* How many bytes are in incomplete character */
|
||||||
uint32 offs= (arg_length % cs->mbminlen);
|
offset= cs->mbmaxlen - offset; /* How many zeros we should prepend */
|
||||||
|
DBUG_ASSERT(offset && offset != cs->mbmaxlen);
|
||||||
|
|
||||||
if (!offs) /* All characters are complete, just copy */
|
uint32 aligned_length= arg_length + offset;
|
||||||
{
|
|
||||||
copy(str, arg_length, cs);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
offs= cs->mbmaxlen - offs; /* How many zeros we should prepend */
|
|
||||||
uint32 aligned_length= arg_length + offs;
|
|
||||||
if (alloc(aligned_length))
|
if (alloc(aligned_length))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/*
|
|
||||||
Probably this condition is not really necessary
|
|
||||||
because if aligned_length is 0 then offs is 0 too
|
|
||||||
and we'll return after calling set().
|
|
||||||
*/
|
|
||||||
if ((str_length= aligned_length))
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
Note, this is only safe for little-endian UCS-2.
|
Note, this is only safe for little-endian UCS-2.
|
||||||
If we add big-endian UCS-2 sometimes, this code
|
If we add big-endian UCS-2 sometimes, this code
|
||||||
will be more complicated. But it's OK for now.
|
will be more complicated. But it's OK for now.
|
||||||
*/
|
*/
|
||||||
bzero((char*)Ptr, offs);
|
bzero((char*) Ptr, offset);
|
||||||
memcpy(Ptr + offs, str, arg_length);
|
memcpy(Ptr + offset, str, arg_length);
|
||||||
}
|
|
||||||
Ptr[aligned_length]=0;
|
Ptr[aligned_length]=0;
|
||||||
|
/* str_length is always >= 0 as arg_length is != 0 */
|
||||||
|
str_length= aligned_length;
|
||||||
str_charset= cs;
|
str_charset= cs;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -300,14 +318,14 @@ bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
|
|||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
/* How many bytes are in incomplete character */
|
/* How many bytes are in incomplete character */
|
||||||
uint32 offs= (arg_length % cs->mbminlen);
|
uint32 offset= (arg_length % cs->mbminlen);
|
||||||
|
|
||||||
if (!offs) /* All characters are complete, just copy */
|
if (!offset) /* All characters are complete, just copy */
|
||||||
{
|
{
|
||||||
set(str, arg_length, cs);
|
set(str, arg_length, cs);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return copy_aligned(str, arg_length, cs);
|
return copy_aligned(str, arg_length, offset, cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy with charset convertion */
|
/* Copy with charset convertion */
|
||||||
@ -315,14 +333,11 @@ bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
|
|||||||
bool String::copy(const char *str, uint32 arg_length,
|
bool String::copy(const char *str, uint32 arg_length,
|
||||||
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
|
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
|
||||||
{
|
{
|
||||||
if (!needs_conversion(str, arg_length, from_cs, to_cs))
|
uint32 offset;
|
||||||
{
|
if (!needs_conversion(arg_length, from_cs, to_cs, &offset))
|
||||||
return copy(str, arg_length, to_cs);
|
return copy(str, arg_length, to_cs);
|
||||||
}
|
if ((from_cs == &my_charset_bin) && offset)
|
||||||
if ((from_cs == &my_charset_bin) && (arg_length % to_cs->mbminlen))
|
return copy_aligned(str, arg_length, offset, to_cs);
|
||||||
{
|
|
||||||
return copy_aligned(str, arg_length, to_cs);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 new_length= to_cs->mbmaxlen*arg_length;
|
uint32 new_length= to_cs->mbmaxlen*arg_length;
|
||||||
if (alloc(new_length))
|
if (alloc(new_length))
|
||||||
@ -744,7 +759,8 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if ((cnvres=from_cs->cset->mb_wc(from_cs, &wc, (uchar*) from, from_end)) > 0)
|
if ((cnvres= from_cs->cset->mb_wc(from_cs, &wc, (uchar*) from,
|
||||||
|
from_end)) > 0)
|
||||||
from+= cnvres;
|
from+= cnvres;
|
||||||
else if (cnvres == MY_CS_ILSEQ)
|
else if (cnvres == MY_CS_ILSEQ)
|
||||||
{
|
{
|
||||||
|
@ -183,9 +183,11 @@ public:
|
|||||||
bool copy(); // Alloc string if not alloced
|
bool copy(); // Alloc string if not alloced
|
||||||
bool copy(const String &s); // Allocate new string
|
bool copy(const String &s); // Allocate new string
|
||||||
bool copy(const char *s,uint32 arg_length, CHARSET_INFO *cs); // Allocate new string
|
bool copy(const char *s,uint32 arg_length, CHARSET_INFO *cs); // Allocate new string
|
||||||
static bool needs_conversion(const char *s, uint32 arg_length,
|
static bool needs_conversion(uint32 arg_length,
|
||||||
CHARSET_INFO *cs_from, CHARSET_INFO *cs_to);
|
CHARSET_INFO *cs_from, CHARSET_INFO *cs_to,
|
||||||
bool copy_aligned(const char *s, uint32 arg_length, CHARSET_INFO *cs);
|
uint32 *offset);
|
||||||
|
bool copy_aligned(const char *s, uint32 arg_length, uint32 offset,
|
||||||
|
CHARSET_INFO *cs);
|
||||||
bool set_or_copy_aligned(const char *s, uint32 arg_length, CHARSET_INFO *cs);
|
bool set_or_copy_aligned(const char *s, uint32 arg_length, CHARSET_INFO *cs);
|
||||||
bool copy(const char*s,uint32 arg_length, CHARSET_INFO *csfrom,
|
bool copy(const char*s,uint32 arg_length, CHARSET_INFO *csfrom,
|
||||||
CHARSET_INFO *csto);
|
CHARSET_INFO *csto);
|
||||||
|
@ -482,8 +482,11 @@ int mysql_multi_update(THD *thd,
|
|||||||
for (tl= select_lex->get_table_list() ; tl ; tl= tl->next)
|
for (tl= select_lex->get_table_list() ; tl ; tl= tl->next)
|
||||||
{
|
{
|
||||||
if (tl->derived && (item_tables & tl->table->map))
|
if (tl->derived && (item_tables & tl->table->map))
|
||||||
|
{
|
||||||
my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
|
my_printf_error(ER_NON_UPDATABLE_TABLE, ER(ER_NON_UPDATABLE_TABLE),
|
||||||
MYF(0), tl->alias, "UPDATE");
|
MYF(0), tl->alias, "UPDATE");
|
||||||
|
DBUG_RETURN(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -918,7 +918,7 @@ create:
|
|||||||
&tmp_table_alias :
|
&tmp_table_alias :
|
||||||
(LEX_STRING*) 0),
|
(LEX_STRING*) 0),
|
||||||
TL_OPTION_UPDATING,
|
TL_OPTION_UPDATING,
|
||||||
((using_update_log)?
|
(using_update_log ?
|
||||||
TL_READ_NO_INSERT:
|
TL_READ_NO_INSERT:
|
||||||
TL_READ)))
|
TL_READ)))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
@ -2191,8 +2191,7 @@ select_part2:
|
|||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
LEX *lex= Lex;
|
||||||
SELECT_LEX *sel= lex->current_select;
|
SELECT_LEX *sel= lex->current_select;
|
||||||
if (lex->current_select == &lex->select_lex)
|
lex->lock_option= TL_READ;
|
||||||
lex->lock_option= TL_READ; /* Only for global SELECT */
|
|
||||||
if (sel->linkage != UNION_TYPE)
|
if (sel->linkage != UNION_TYPE)
|
||||||
mysql_init_select(lex);
|
mysql_init_select(lex);
|
||||||
lex->current_select->parsing_place= SELECT_LEX_NODE::SELECT_LIST;
|
lex->current_select->parsing_place= SELECT_LEX_NODE::SELECT_LIST;
|
||||||
@ -3084,16 +3083,16 @@ in_sum_expr:
|
|||||||
};
|
};
|
||||||
|
|
||||||
cast_type:
|
cast_type:
|
||||||
BINARY { $$=ITEM_CAST_BINARY; }
|
BINARY { $$=ITEM_CAST_BINARY; Lex->charset= NULL; Lex->length= (char*)0; }
|
||||||
| CHAR_SYM opt_len opt_binary { $$=ITEM_CAST_CHAR; }
|
| CHAR_SYM opt_len opt_binary { $$=ITEM_CAST_CHAR; }
|
||||||
| NCHAR_SYM opt_len { $$=ITEM_CAST_CHAR; Lex->charset= national_charset_info; }
|
| NCHAR_SYM opt_len { $$=ITEM_CAST_CHAR; Lex->charset= national_charset_info; }
|
||||||
| SIGNED_SYM { $$=ITEM_CAST_SIGNED_INT; }
|
| SIGNED_SYM { $$=ITEM_CAST_SIGNED_INT; Lex->charset= NULL; Lex->length= (char*)0; }
|
||||||
| SIGNED_SYM INT_SYM { $$=ITEM_CAST_SIGNED_INT; }
|
| SIGNED_SYM INT_SYM { $$=ITEM_CAST_SIGNED_INT; Lex->charset= NULL; Lex->length= (char*)0; }
|
||||||
| UNSIGNED { $$=ITEM_CAST_UNSIGNED_INT; }
|
| UNSIGNED { $$=ITEM_CAST_UNSIGNED_INT; Lex->charset= NULL; Lex->length= (char*)0; }
|
||||||
| UNSIGNED INT_SYM { $$=ITEM_CAST_UNSIGNED_INT; }
|
| UNSIGNED INT_SYM { $$=ITEM_CAST_UNSIGNED_INT; Lex->charset= NULL; Lex->length= (char*)0; }
|
||||||
| DATE_SYM { $$=ITEM_CAST_DATE; }
|
| DATE_SYM { $$=ITEM_CAST_DATE; Lex->charset= NULL; Lex->length= (char*)0; }
|
||||||
| TIME_SYM { $$=ITEM_CAST_TIME; }
|
| TIME_SYM { $$=ITEM_CAST_TIME; Lex->charset= NULL; Lex->length= (char*)0; }
|
||||||
| DATETIME { $$=ITEM_CAST_DATETIME; }
|
| DATETIME { $$=ITEM_CAST_DATETIME; Lex->charset= NULL; Lex->length= (char*)0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
expr_list:
|
expr_list:
|
||||||
@ -3895,6 +3894,7 @@ update:
|
|||||||
LEX *lex= Lex;
|
LEX *lex= Lex;
|
||||||
mysql_init_select(lex);
|
mysql_init_select(lex);
|
||||||
lex->sql_command= SQLCOM_UPDATE;
|
lex->sql_command= SQLCOM_UPDATE;
|
||||||
|
lex->lock_option= TL_UNLOCK; /* Will be set later */
|
||||||
}
|
}
|
||||||
opt_low_priority opt_ignore join_table_list
|
opt_low_priority opt_ignore join_table_list
|
||||||
SET update_list where_clause opt_order_clause delete_limit_clause
|
SET update_list where_clause opt_order_clause delete_limit_clause
|
||||||
|
Reference in New Issue
Block a user