Commit 5f4a4c7a authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into mishka.mysql.fi:/home/my/mysql-4.1


sql/mysql_priv.h:
  Auto merged
parents d5b4f205 0761637e
......@@ -755,7 +755,10 @@ bool setup_params_data(st_prep_stmt *stmt)
{
uchar *buff= (uchar*)client_param->buffer;
param->maybe_null= param->null_value= 0;
param->setup_param_func(param,&buff);
param->setup_param_func(param,&buff,
client_param->length ?
*client_param->length :
client_param->buffer_length);
}
}
param_no++;
......@@ -796,7 +799,10 @@ bool setup_params_data_withlog(st_prep_stmt *stmt)
{
uchar *buff= (uchar*)client_param->buffer;
param->maybe_null= param->null_value= 0;
param->setup_param_func(param,&buff);
param->setup_param_func(param,&buff,
client_param->length ?
*client_param->length :
client_param->buffer_length);
res= param->query_val_str(&str);
}
}
......
......@@ -295,7 +295,7 @@ Warnings:
Note 1275 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
Note 1275 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
create table t7( uq int primary key, name char(25));
insert into t7 values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
......@@ -354,7 +354,7 @@ SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
pseudo
joce
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%');
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
CREATE TABLE `t1` (
`topic` mediumint(8) unsigned NOT NULL default '0',
......@@ -384,7 +384,7 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
1
1
SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
EXPLAIN SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL topic 3 NULL 2 Using index
......@@ -471,9 +471,9 @@ UNIQUE KEY `maxnumrep` (`maxnumrep`)
) TYPE=MyISAM ROW_FORMAT=FIXED;
INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
......@@ -486,7 +486,7 @@ drop table t1;
CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
INSERT INTO t1 VALUES ();
SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL default '0',
......@@ -504,7 +504,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT
numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
EXPLAIN SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
......@@ -531,7 +531,7 @@ a b
update t1 set b= (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
update t1 set b= (select b from t2);
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
update t1 set b= (select b from t2 where t1.a = t2.a);
select * from t1;
a b
......@@ -554,7 +554,7 @@ a b
delete from t1 where b = (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
delete from t1 where b = (select b from t2);
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
delete from t1 where b = (select b from t2 where t1.a = t2.a);
select * from t1;
a b
......@@ -580,7 +580,7 @@ a b
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
ERROR HY000: You can't specify target table 't12' for update in FROM clause
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
select * from t11;
a b
......@@ -599,7 +599,7 @@ insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
......@@ -641,7 +641,7 @@ x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
select * from t1;
x y
......@@ -712,7 +712,7 @@ id
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t2 SET id=(SELECT * FROM t1);
ERROR 21000: Subselect returns more than 1 record
ERROR 21000: Subquery returns more than 1 record
drop table t2, t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
......@@ -1186,7 +1186,7 @@ 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 1241 Subselect returns more than 1 record
Error 1241 Subquery returns more than 1 record
select * from t1;
a b
1 1
......
#! /bin/sh
# debug
#set -x
# stop on errors
set -e
path=`dirname $0`
. $path/compile-netware-START
suffix="max"
extra_configs=" \
--with-innodb \
--with-embedded-server \
--with-openssl \
"
. $path/compile-netware-END
#! /bin/sh
# debug
#set -x
# stop on errors
set -e
path=`dirname $0`
. $path/compile-netware-START
suffix="max-debug"
extra_configs=" \
--with-innodb \
--with-debug=full \
--with-embedded-server \
--with-openssl \
"
. $path/compile-netware-END
#! /bin/sh
# debug
#set -x
# stop on errors
set -e
if test ! -r ./sql/mysqld.cc
then
echo "you must start from the top source directory"
exit 1
fi
path=`dirname $0`
# clean
if test -e "Makefile"; then
make -k clean;
make -k distclean;
fi
# remove other files
rm -f NEW-RPMS/*
rm -f */.deps/*.P
rm -rf Makefile.in.bk
# zip source
files=`pwd | sed -e "s/.*\\\(mysql-.*\)/\1/"`
file=`pwd | sed -e "s/.*\\mysql-\(.*\)/mysql-src-\1-pc-netware-i686/"`
cd ..
if test -e "$file.zip"; then rm -f $file.zip; fi
zip -r $file.zip $files -x \*.zip -x \*.tar.gz
if test -e "./$files/$file.zip"; then mv -f ./$files/$file.zip ./$files/$file.zip.old; fi
mv -f $file.zip ./$files/$file.zip
kYieldIfTimeSliceUp
WS2_32_shutdown
WS2_32_closesocket
WSASetLastError
WS2_32_recv
WSASetLastError
WS2_32_send
WSAGetLastError
GetProcessSwitchCount
RunningProcess
CREATE DATABASE mysql;
CREATE DATABASE test;
USE mysql;
CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) comment='Database privileges';
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db)) comment='Host privileges; Merged with database privileges';
CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(45) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User)) comment='Users and global privileges';
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user VALUES ('','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user (host,user) values ('localhost','');
INSERT INTO user (host,user) values ('','');
CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') NOT NULL, PRIMARY KEY (name)) comment='User defined functions';
CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(60) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) comment='Table privileges';
CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name)) comment='Column privileges';
CREATE TABLE help_topic (help_topic_id int unsigned NOT NULL, name varchar(64) NOT NULL, help_category_id smallint unsigned NOT NULL, description text NOT NULL, example text NOT NULL, url varchar(128) NOT NULL, primary key (help_topic_id), unique index (name))comment='help topics';
CREATE TABLE help_category (help_category_id smallint unsigned NOT NULL, name varchar(64) NOT NULL, parent_category_id smallint unsigned null, url varchar(128) NOT NULL, primary key (help_category_id), unique index (name)) comment='help categories';
CREATE TABLE help_keyword (help_keyword_id int unsigned NOT NULL, name varchar(64) NOT NULL, primary key (help_keyword_id), unique index (name)) comment='help keywords';
CREATE TABLE help_relation (help_topic_id int unsigned NOT NULL references help_topic, help_keyword_id int unsigned NOT NULL references help_keyword, primary key (help_keyword_id, help_topic_id)) comment='keyword-topic relation';
......@@ -304,11 +304,13 @@ void berkeley_cleanup_log_files(void)
char **names;
int error;
// by HF. Sometimes it crashes. TODO - find out why
#ifndef EMBEDDED_LIBRARY
/* XXX: Probably this should be done somewhere else, and
* should be tunable by the user. */
if ((error = db_env->txn_checkpoint(db_env, 0, 0, 0)))
my_error(ER_ERROR_DURING_CHECKPOINT, MYF(0), error); /* purecov: inspected */
#endif
if ((error = db_env->log_archive(db_env, &names, DB_ARCH_ABS)) != 0)
{
DBUG_PRINT("error", ("log_archive failed (error %d)", error)); /* purecov: inspected */
......
......@@ -346,7 +346,11 @@ class Item_param :public Item
void set_time(TIME *tm, timestamp_type type);
bool get_time(TIME *tm);
void reset() {}
#ifndef EMBEDDED_LIBRARY
void (*setup_param_func)(Item_param *param, uchar **pos);
#else
void (*setup_param_func)(Item_param *param, uchar **pos, ulong data_len);
#endif
enum Item_result result_type () const
{ return item_result_type; }
String *query_val_str(String *str);
......
......@@ -322,6 +322,13 @@ typedef compare_func_creator (*chooser_compare_func_creator)(bool invert);
#include "opt_range.h"
#ifdef HAVE_QUERY_CACHE
struct Query_cache_query_flags
{
unsigned int client_long_flag:1;
uint charset_num;
ha_rows limit;
};
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
#include "sql_cache.h"
#define query_cache_store_query(A, B) query_cache.store_query(A, B)
#define query_cache_destroy() query_cache.destroy()
......@@ -335,6 +342,7 @@ typedef compare_func_creator (*chooser_compare_func_creator)(bool invert);
#define query_cache_invalidate_by_MyISAM_filename_ref \
&query_cache_invalidate_by_MyISAM_filename
#else
#define QUERY_CACHE_FLAGS_SIZE 0
#define query_cache_store_query(A, B)
#define query_cache_destroy()
#define query_cache_result_size_limit(A)
......
......@@ -253,7 +253,7 @@ character-set=latin2
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -247,7 +247,7 @@ character-set=latin1
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -255,7 +255,7 @@ character-set=latin1
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -244,7 +244,7 @@ character-set=latin1
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -249,7 +249,7 @@ character-set=latin7
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -244,7 +244,7 @@ character-set=latin1
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -244,7 +244,7 @@ character-set=greek
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -246,7 +246,7 @@ character-set=latin2
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -244,7 +244,7 @@ character-set=latin1
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -246,7 +246,7 @@ character-set=ujis
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -244,7 +244,7 @@ character-set=euckr
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -246,7 +246,7 @@ character-set=latin1
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -246,7 +246,7 @@ character-set=latin1
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -248,7 +248,7 @@ character-set=latin2
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -248,7 +248,7 @@ character-set=latin2
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -239,7 +239,7 @@ character-set=cp1250
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -252,7 +252,7 @@ character-set=latin2
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -246,7 +246,7 @@ character-set=latin1
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
"Subselect returns more than 1 record",
"Subquery returns more than 1 record",
"Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist",
"Cyclic reference on subqueries",
......
......@@ -244,10 +244,10 @@ character-set=latin1
"Felaktig FOREIGN KEY-definition för '%-.64s': %s",
"Nyckelreferensen och tabellreferensen stämmer inte överens",
"Kardinalitetsfel (fler/färre än %d kolumner)",
"Subselect returnerade mer än 1 rad",
"Subquery returnerade mer än 1 rad",
"Okänd PREPARED STATEMENT id (%ld) var given till %s",
"Hjälpdatabasen finns inte eller är skadad",
"Cyklisk referens i subselect",
"Cyklisk referens i subqueries",
"Konvertar kolumn '%s' från %s till %s",
"Referens '%-.64s' stöds inte (%s)",
"Varje 'derived table' måste ha sitt eget alias",
......
......@@ -765,7 +765,13 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
&tables_type)))
{
NET *net= &thd->net;
byte flags= (thd->client_capabilities & CLIENT_LONG_FLAG ? 0x80 : 0);
Query_cache_query_flags flags;
// fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
flags.client_long_flag= (thd->client_capabilities & CLIENT_LONG_FLAG ?
1 : 0);
flags.charset_num= thd->charset()->number;
flags.limit= thd->variables.select_limit;
STRUCT_LOCK(&structure_guard_mutex);
if (query_cache_size == 0)
......@@ -792,23 +798,19 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
{
DBUG_PRINT("qcache", ("No active database"));
}
tot_length= thd->query_length + thd->db_length + 1 +
QUERY_CACHE_FLAGS_SIZE;
/*
Prepare flags:
most significant bit - CLIENT_LONG_FLAG,
other - charset number (0 no charset convertion)
We should only copy structure (don't use it location directly)
because of alignment issue
*/
flags|= (byte) thd->charset()->number;
DBUG_ASSERT(thd->charset()->number < 128);
tot_length= thd->query_length+thd->db_length+2+sizeof(ha_rows);
thd->query[tot_length-1]= (char) flags;
memcpy((void *)(thd->query + (tot_length-sizeof(ha_rows)-1)),
(const void *)&thd->variables.select_limit, sizeof(ha_rows));
memcpy((void *)(thd->query + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
&flags, QUERY_CACHE_FLAGS_SIZE);
/* Check if another thread is processing the same query? */
Query_cache_block *competitor = (Query_cache_block *)
hash_search(&queries, (byte*) thd->query, tot_length);
DBUG_PRINT("qcache", ("competitor 0x%lx, flags %x", (ulong) competitor,
flags));
DBUG_PRINT("qcache", ("competitor 0x%lx", (ulong) competitor));
if (competitor == 0)
{
/* Query is not in cache and no one is working with it; Store it */
......@@ -895,7 +897,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
Query_cache_block *first_result_block, *result_block;
Query_cache_block_table *block_table, *block_table_end;
ulong tot_length;
byte flags;
Query_cache_query_flags flags;
bool check_tables;
DBUG_ENTER("Query_cache::send_result_to_client");
......@@ -932,7 +934,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
}
Query_cache_block *query_block;
tot_length= query_length+thd->db_length+2+sizeof(ha_rows);
tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
if (thd->db_length)
{
memcpy(sql+query_length+1, thd->db, thd->db_length);
......@@ -943,17 +945,15 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
{
DBUG_PRINT("qcache", ("No active database"));
}
/*
prepare flags:
Most significant bit - CLIENT_LONG_FLAG,
Other - charset number (0 no charset convertion)
*/
flags= (thd->client_capabilities & CLIENT_LONG_FLAG ? 0x80 : 0);
flags|= (byte) thd->charset()->number;
DBUG_ASSERT(thd->charset()->number < 128);
sql[tot_length-1]= (char) flags;
memcpy((void *)(sql + (tot_length-sizeof(ha_rows)-1)),
(const void *)&thd->variables.select_limit, sizeof(ha_rows));
// fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
flags.client_long_flag= (thd->client_capabilities & CLIENT_LONG_FLAG ?
1 : 0);
flags.charset_num= thd->charset()->number;
flags.limit= thd->variables.select_limit;
memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
&flags, QUERY_CACHE_FLAGS_SIZE);
query_block = (Query_cache_block *) hash_search(&queries, (byte*) sql,
tot_length);
/* Quick abort on unlocked data */
......@@ -3099,20 +3099,21 @@ void Query_cache::queries_dump()
{
uint len;
char *str = (char*) query_cache_query_get_key((byte*) block, &len, 0);
len--; // Point at flags
uint flags = (uint) (uchar) str[len];
str[len]=0;
DBUG_PRINT("qcache", ("%u (%u,%u) '%s' '%s'",
((flags & QUERY_CACHE_CLIENT_LONG_FLAG_MASK)? 1:0),
(flags & QUERY_CACHE_CHARSET_CONVERT_MASK), len,
str,strend(str)+1));
len-= QUERY_CACHE_FLAGS_SIZE; // Point at flags
Query_cache_query_flags flags;
memcpy(&flags, str+len, QUERY_CACHE_FLAGS_SIZE);
str[len]= 0; // make zero ending DB name
DBUG_PRINT("qcache", ("F:%u C:%u L:%lu (%u) '%s' '%s'",
flags.client_long_flag,
flags.charset_num, (ulong)flags.limit,
len, str, strend(str)+1));
DBUG_PRINT("qcache", ("-b- 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx", (ulong) block,
(ulong) block->next, (ulong) block->prev,
(ulong)block->pnext, (ulong)block->pprev));
str[len]=(char) flags;
for (TABLE_COUNTER_TYPE t = 0; t < block->n_tables; t++)
memcpy(str + len, &flags, QUERY_CACHE_FLAGS_SIZE); // restore flags
for (TABLE_COUNTER_TYPE t= 0; t < block->n_tables; t++)
{
Query_cache_table *table = block->table(t)->parent;
Query_cache_table *table= block->table(t)->parent;
DBUG_PRINT("qcache", ("-t- '%s' '%s'", table->db(), table->table()));
}
Query_cache_query *header = block->query();
......
......@@ -1614,8 +1614,8 @@ bool alloc_query(THD *thd, char *packet, ulong packet_length)
/* We must allocate some extra memory for query cache */
if (!(thd->query= (char*) thd->memdup_w_gap((gptr) (packet),
packet_length,
thd->db_length+2+
sizeof(ha_rows))))
thd->db_length+ 1 +
QUERY_CACHE_FLAGS_SIZE)))
return 1;
thd->query[packet_length]=0;
thd->query_length= packet_length;
......
......@@ -76,6 +76,14 @@ Long data handling:
#define STMT_QUERY_LOG_LENGTH 8192
#ifdef EMBEDDED_LIBRARY
#define SETUP_PARAM_FUNCTION(fn_name) \
static void fn_name(Item_param *param, uchar **pos, ulong data_len)
#else
#define SETUP_PARAM_FUNCTION(fn_name) \
static void fn_name(Item_param *param, uchar **pos)
#endif
String my_null_string("NULL", 4, default_charset_info);
/*
......@@ -189,6 +197,7 @@ static bool send_item_params(PREP_STMT *stmt)
caller by positing the pointer to param data
*/
#ifndef EMBEDDED_LIBRARY
static ulong get_param_length(uchar **packet)
{
reg1 uchar *pos= *packet;
......@@ -210,6 +219,10 @@ static ulong get_param_length(uchar **packet)
(*packet)+=9; // Must be 254 when here
return (ulong) uint4korr(pos+1);
}
#else
#define get_param_length(A) data_len
#endif /*!EMBEDDED_LIBRARY*/
/*
Setup param conversion routines
......@@ -229,31 +242,31 @@ static ulong get_param_length(uchar **packet)
*/
static void setup_param_tiny(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_tiny)
{
param->set_int((longlong)(**pos));
*pos+= 1;
}
static void setup_param_short(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_short)
{
param->set_int((longlong)sint2korr(*pos));
*pos+= 2;
}
static void setup_param_int32(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_int32)
{
param->set_int((longlong)sint4korr(*pos));
*pos+= 4;
}
static void setup_param_int64(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_int64)
{
param->set_int((longlong)sint8korr(*pos));
*pos+= 8;
}
static void setup_param_float(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_float)
{
float data;
float4get(data,*pos);
......@@ -261,7 +274,7 @@ static void setup_param_float(Item_param *param, uchar **pos)
*pos+= 4;
}
static void setup_param_double(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_double)
{
double data;
float8get(data,*pos);
......@@ -269,7 +282,7 @@ static void setup_param_double(Item_param *param, uchar **pos)
*pos+= 8;
}
static void setup_param_time(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_time)
{
ulong length;
......@@ -293,7 +306,7 @@ static void setup_param_time(Item_param *param, uchar **pos)
*pos+= length;
}
static void setup_param_datetime(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_datetime)
{
uint length= get_param_length(pos);
......@@ -323,7 +336,7 @@ static void setup_param_datetime(Item_param *param, uchar **pos)
*pos+= length;
}
static void setup_param_date(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_date)
{
ulong length;
......@@ -345,7 +358,7 @@ static void setup_param_date(Item_param *param, uchar **pos)
*pos+= length;
}
static void setup_param_str(Item_param *param, uchar **pos)
SETUP_PARAM_FUNCTION(setup_param_str)
{
ulong len= get_param_length(pos);
param->set_value((const char *)*pos, len);
......
......@@ -292,7 +292,7 @@ uint my_instr_mb(CHARSET_INFO *cs,
match->end= 0;
match->mblen= 0;
}
return 1; // Empty string is always found
return 1; /* Empty string is always found */
}
big0= big;
......@@ -307,7 +307,7 @@ uint my_instr_mb(CHARSET_INFO *cs,
{
if (nmatch)
{
match[0].beg= big0;
match[0].beg= 0;
match[0].end= big-big0;
match[0].mblen= res;
if (nmatch > 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment