mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/work-row-4.1 mysql-test/r/subselect.result: Auto merged sql/sql_base.cc: Auto merged sql/sql_select.cc: Auto merged
This commit is contained in:
2
bdb/dist/RELEASE
vendored
2
bdb/dist/RELEASE
vendored
@ -16,7 +16,7 @@ DB_VERSION_STRING="Sleepycat Software: Berkeley DB $DB_VERSION: ($DB_RELEASE_DAT
|
|||||||
# bitkeeper doesn't like somebody to mess with permissions!
|
# bitkeeper doesn't like somebody to mess with permissions!
|
||||||
chmod()
|
chmod()
|
||||||
{
|
{
|
||||||
#echo "chmod $1 $2"
|
echo "chmod $1 $2" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# useful trick to find auto-generated files
|
# useful trick to find auto-generated files
|
||||||
|
17
bdb/dist/s_all
vendored
17
bdb/dist/s_all
vendored
@ -1,7 +1,22 @@
|
|||||||
#!/bin/sh -
|
#!/bin/sh -
|
||||||
# $Id: s_all,v 1.10 2001/08/04 14:01:44 bostic Exp $
|
# $Id: s_all,v 1.10 2001/08/04 14:01:44 bostic Exp $
|
||||||
|
|
||||||
sh s_perm # permissions.
|
make_dir()
|
||||||
|
{
|
||||||
|
if test ! -d $1; then
|
||||||
|
echo "mkdir $1"
|
||||||
|
mkdir $1
|
||||||
|
status=$?
|
||||||
|
if test $status -ne 0 && test ! -d $1; then
|
||||||
|
echo "error: $status"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
make_dir ../test_server
|
||||||
|
make_dir ../dbinc_auto
|
||||||
|
|
||||||
|
#sh s_perm # permissions.
|
||||||
sh s_symlink # symbolic links.
|
sh s_symlink # symbolic links.
|
||||||
sh s_readme # db/README file.
|
sh s_readme # db/README file.
|
||||||
|
|
||||||
|
@ -55,6 +55,22 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
|
|||||||
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
|
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
|
||||||
keyinfo->rb_tree.size_of_element++;
|
keyinfo->rb_tree.size_of_element++;
|
||||||
}
|
}
|
||||||
|
switch (keyinfo->seg[j].type) {
|
||||||
|
case HA_KEYTYPE_SHORT_INT:
|
||||||
|
case HA_KEYTYPE_LONG_INT:
|
||||||
|
case HA_KEYTYPE_FLOAT:
|
||||||
|
case HA_KEYTYPE_DOUBLE:
|
||||||
|
case HA_KEYTYPE_USHORT_INT:
|
||||||
|
case HA_KEYTYPE_ULONG_INT:
|
||||||
|
case HA_KEYTYPE_LONGLONG:
|
||||||
|
case HA_KEYTYPE_ULONGLONG:
|
||||||
|
case HA_KEYTYPE_INT24:
|
||||||
|
case HA_KEYTYPE_UINT24:
|
||||||
|
case HA_KEYTYPE_INT8:
|
||||||
|
keyinfo->seg[j].flag|= HA_SWAP_KEY;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
keyinfo->length= length;
|
keyinfo->length= length;
|
||||||
length+= keyinfo->rb_tree.size_of_element +
|
length+= keyinfo->rb_tree.size_of_element +
|
||||||
|
@ -443,6 +443,43 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
|
|||||||
if (!(*key++= 1 - test(rec[seg->null_pos] & seg->null_bit)))
|
if (!(*key++= 1 - test(rec[seg->null_pos] & seg->null_bit)))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (seg->flag & HA_SWAP_KEY)
|
||||||
|
{
|
||||||
|
uint length= seg->length;
|
||||||
|
byte *pos= (byte*) rec + seg->start;
|
||||||
|
|
||||||
|
#ifdef HAVE_ISNAN
|
||||||
|
if (seg->type == HA_KEYTYPE_FLOAT)
|
||||||
|
{
|
||||||
|
float nr;
|
||||||
|
float4get(nr, pos);
|
||||||
|
if (isnan(nr))
|
||||||
|
{
|
||||||
|
/* Replace NAN with zero */
|
||||||
|
bzero(key, length);
|
||||||
|
key+= length;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (seg->type == HA_KEYTYPE_DOUBLE)
|
||||||
|
{
|
||||||
|
double nr;
|
||||||
|
float8get(nr, pos);
|
||||||
|
if (isnan(nr))
|
||||||
|
{
|
||||||
|
bzero(key, length);
|
||||||
|
key+= length;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
pos+= length;
|
||||||
|
while (length--)
|
||||||
|
{
|
||||||
|
*key++= *--pos;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
memcpy(key, rec + seg->start, (size_t) seg->length);
|
memcpy(key, rec + seg->start, (size_t) seg->length);
|
||||||
key+= seg->length;
|
key+= seg->length;
|
||||||
}
|
}
|
||||||
@ -467,6 +504,18 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (seg->flag & HA_SWAP_KEY)
|
||||||
|
{
|
||||||
|
uint length= seg->length;
|
||||||
|
byte *pos= (byte*) old + length;
|
||||||
|
|
||||||
|
k_len-= length;
|
||||||
|
while (length--)
|
||||||
|
{
|
||||||
|
*key++= *--pos;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
memcpy((byte*) key, old, seg->length);
|
memcpy((byte*) key, old, seg->length);
|
||||||
key+= seg->length;
|
key+= seg->length;
|
||||||
k_len-= seg->length;
|
k_len-= seg->length;
|
||||||
|
Binary file not shown.
@ -20,7 +20,7 @@ pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h \
|
|||||||
mysql.h mysql_com.h mysqld_error.h mysql_embed.h \
|
mysql.h mysql_com.h mysqld_error.h mysql_embed.h \
|
||||||
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
|
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
|
||||||
errmsg.h my_global.h my_net.h my_alloc.h \
|
errmsg.h my_global.h my_net.h my_alloc.h \
|
||||||
my_getopt.h sslopt-longopts.h \
|
my_getopt.h sslopt-longopts.h typelib.h \
|
||||||
sslopt-vars.h sslopt-case.h $(BUILT_SOURCES)
|
sslopt-vars.h sslopt-case.h $(BUILT_SOURCES)
|
||||||
noinst_HEADERS = config-win.h config-os2.h \
|
noinst_HEADERS = config-win.h config-os2.h \
|
||||||
nisam.h heap.h merge.h my_bitmap.h\
|
nisam.h heap.h merge.h my_bitmap.h\
|
||||||
|
@ -158,3 +158,6 @@ select * from t1;
|
|||||||
if('2002'='2002','Y','N')
|
if('2002'='2002','Y','N')
|
||||||
Y
|
Y
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
|
create table t1 (a int, key(a));
|
||||||
|
create table t2 (b int, foreign key(b) references t1(a), key(b));
|
||||||
|
drop table if exists t1,t2;
|
||||||
|
@ -40,3 +40,28 @@ a
|
|||||||
select 1 from (select 1);
|
select 1 from (select 1);
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
|
drop table if exists t1;
|
||||||
|
create table t1(a int not null, t char(8), index(a));
|
||||||
|
SELECT * FROM (SELECT * FROM t1) ORDER BY a ASC LIMIT 0,20;
|
||||||
|
a t
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
3 3
|
||||||
|
4 4
|
||||||
|
5 5
|
||||||
|
6 6
|
||||||
|
7 7
|
||||||
|
8 8
|
||||||
|
9 9
|
||||||
|
10 10
|
||||||
|
11 11
|
||||||
|
12 12
|
||||||
|
13 13
|
||||||
|
14 14
|
||||||
|
15 15
|
||||||
|
16 16
|
||||||
|
17 17
|
||||||
|
18 18
|
||||||
|
19 19
|
||||||
|
20 20
|
||||||
|
drop table if exists t1;
|
||||||
|
@ -168,4 +168,19 @@ test2 2 2
|
|||||||
SELECT FOUND_ROWS();
|
SELECT FOUND_ROWS();
|
||||||
FOUND_ROWS()
|
FOUND_ROWS()
|
||||||
2
|
2
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) LIMIT 0;
|
||||||
|
1
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
FOUND_ROWS()
|
||||||
|
1
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
|
||||||
|
titre numeropost maxnumrep
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
FOUND_ROWS()
|
||||||
|
2
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
|
||||||
|
titre numeropost maxnumrep
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
FOUND_ROWS()
|
||||||
|
3
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -269,3 +269,23 @@ INSERT INTO iftest VALUES ();
|
|||||||
SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) HAVING field='b');
|
SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) HAVING field='b');
|
||||||
Subselect returns more than 1 record
|
Subselect returns more than 1 record
|
||||||
drop table iftest;
|
drop table iftest;
|
||||||
|
drop table if exists threadhardwarefr7;
|
||||||
|
CREATE TABLE `threadhardwarefr7` (
|
||||||
|
`numeropost` mediumint(8) unsigned NOT NULL default '0',
|
||||||
|
`numreponse` int(10) unsigned NOT NULL auto_increment,
|
||||||
|
`pseudo` varchar(35) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`numeropost`,`numreponse`),
|
||||||
|
UNIQUE KEY `numreponse` (`numreponse`),
|
||||||
|
KEY `pseudo` (`pseudo`,`numeropost`)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
|
||||||
|
EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM threadhardwarefr7 WHERE numeropost='1');
|
||||||
|
Subselect returns more than 1 record
|
||||||
|
EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE Select tables optimized away
|
||||||
|
EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1');
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY threadhardwarefr7 const PRIMARY,numreponse PRIMARY 7 const,const 1
|
||||||
|
2 SUBSELECT Select tables optimized away
|
||||||
|
drop table if exists threadhardwarefrtest7;
|
||||||
|
@ -110,3 +110,6 @@ drop table t1;
|
|||||||
create table t1 select if('2002'='2002','Y','N');
|
create table t1 select if('2002'='2002','Y','N');
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
|
create table t1 (a int, key(a));
|
||||||
|
create table t2 (b int, foreign key(b) references t1(a), key(b));
|
||||||
|
drop table if exists t1,t2;
|
||||||
|
@ -22,3 +22,15 @@ drop table if exists t1.t2,t3;
|
|||||||
select * from (select 1);
|
select * from (select 1);
|
||||||
select a from (select 1 as a);
|
select a from (select 1 as a);
|
||||||
select 1 from (select 1);
|
select 1 from (select 1);
|
||||||
|
drop table if exists t1;
|
||||||
|
create table t1(a int not null, t char(8), index(a));
|
||||||
|
disable_query_log;
|
||||||
|
let $1 = 10000;
|
||||||
|
while ($1)
|
||||||
|
{
|
||||||
|
eval insert into t1 values ($1,'$1');
|
||||||
|
dec $1;
|
||||||
|
}
|
||||||
|
enable_query_log;
|
||||||
|
SELECT * FROM (SELECT * FROM t1) ORDER BY a ASC LIMIT 0,20;
|
||||||
|
drop table if exists t1;
|
@ -84,4 +84,10 @@ INSERT INTO t1 (titre,maxnumrep) VALUES
|
|||||||
('test1','1'),('test2','2'),('test3','3');
|
('test1','1'),('test2','2'),('test3','3');
|
||||||
SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost IN (1,2) ORDER BY maxnumrep DESC LIMIT 0, 1;
|
SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost IN (1,2) ORDER BY maxnumrep DESC LIMIT 0, 1;
|
||||||
SELECT FOUND_ROWS();
|
SELECT FOUND_ROWS();
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) LIMIT 0;
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -166,3 +166,19 @@ INSERT INTO iftest VALUES ();
|
|||||||
-- error 1240
|
-- error 1240
|
||||||
SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) HAVING field='b');
|
SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) HAVING field='b');
|
||||||
drop table iftest;
|
drop table iftest;
|
||||||
|
|
||||||
|
drop table if exists threadhardwarefr7;
|
||||||
|
CREATE TABLE `threadhardwarefr7` (
|
||||||
|
`numeropost` mediumint(8) unsigned NOT NULL default '0',
|
||||||
|
`numreponse` int(10) unsigned NOT NULL auto_increment,
|
||||||
|
`pseudo` varchar(35) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`numeropost`,`numreponse`),
|
||||||
|
UNIQUE KEY `numreponse` (`numreponse`),
|
||||||
|
KEY `pseudo` (`pseudo`,`numeropost`)
|
||||||
|
) TYPE=MyISAM;
|
||||||
|
INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
|
||||||
|
-- error 1240
|
||||||
|
EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM threadhardwarefr7 WHERE numeropost='1');
|
||||||
|
EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
|
||||||
|
EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1');
|
||||||
|
drop table if exists threadhardwarefrtest7;
|
||||||
|
@ -881,8 +881,9 @@ bool select_singleval_subselect::send_data(List<Item> &items)
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("select_singleval_subselect::send_data");
|
DBUG_ENTER("select_singleval_subselect::send_data");
|
||||||
Item_singleval_subselect *it= (Item_singleval_subselect *)item;
|
Item_singleval_subselect *it= (Item_singleval_subselect *)item;
|
||||||
if (it->assigned()){
|
if (it->assigned())
|
||||||
my_message(ER_SUBSELECT_NO_1_ROW, ER(ER_SUBSELECT_NO_1_ROW), MYF(0));
|
{
|
||||||
|
my_message(ER_SUBSELECT_NO_1_ROW, ER(ER_SUBSELECT_NO_1_ROW), MYF(0));
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
if (unit->offset_limit_cnt)
|
if (unit->offset_limit_cnt)
|
||||||
|
@ -35,13 +35,13 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
|
|||||||
SQL_SELECT *select=0;
|
SQL_SELECT *select=0;
|
||||||
READ_RECORD info;
|
READ_RECORD info;
|
||||||
bool using_limit=limit != HA_POS_ERROR;
|
bool using_limit=limit != HA_POS_ERROR;
|
||||||
bool using_transactions;
|
bool using_transactions, safe_update;
|
||||||
ha_rows deleted;
|
ha_rows deleted;
|
||||||
DBUG_ENTER("mysql_delete");
|
DBUG_ENTER("mysql_delete");
|
||||||
|
|
||||||
if (!table_list->db)
|
if (!table_list->db)
|
||||||
table_list->db=thd->db;
|
table_list->db=thd->db;
|
||||||
if ((thd->options & OPTION_SAFE_UPDATES) && !conds)
|
if (((safe_update=thd->options & OPTION_SAFE_UPDATES)) && !conds)
|
||||||
{
|
{
|
||||||
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
|
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@ -58,7 +58,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
|
|||||||
|
|
||||||
/* Test if the user wants to delete all rows */
|
/* Test if the user wants to delete all rows */
|
||||||
if (!using_limit && (!conds || conds->const_item()) &&
|
if (!using_limit && (!conds || conds->const_item()) &&
|
||||||
!(specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)))
|
!(specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) && !safe_update)
|
||||||
{
|
{
|
||||||
deleted= table->file->records;
|
deleted= table->file->records;
|
||||||
if (!(error=table->file->delete_all_rows()))
|
if (!(error=table->file->delete_all_rows()))
|
||||||
@ -79,9 +79,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
|
|||||||
select=make_select(table,0,0,conds,&error);
|
select=make_select(table,0,0,conds,&error);
|
||||||
if (error)
|
if (error)
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
if ((select && select->check_quick(test(thd->options & OPTION_SAFE_UPDATES),
|
if ((select && select->check_quick(safe_update, limit)) || !limit)
|
||||||
limit)) ||
|
|
||||||
!limit)
|
|
||||||
{
|
{
|
||||||
delete select;
|
delete select;
|
||||||
send_ok(thd,0L);
|
send_ok(thd,0L);
|
||||||
@ -92,7 +90,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
|
|||||||
if (!table->quick_keys)
|
if (!table->quick_keys)
|
||||||
{
|
{
|
||||||
thd->lex.select_lex.options|=QUERY_NO_INDEX_USED;
|
thd->lex.select_lex.options|=QUERY_NO_INDEX_USED;
|
||||||
if ((thd->options & OPTION_SAFE_UPDATES) && limit == HA_POS_ERROR)
|
if (safe_update && !using_limit)
|
||||||
{
|
{
|
||||||
delete select;
|
delete select;
|
||||||
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
|
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
|
||||||
|
@ -119,7 +119,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
|
|||||||
table->tmp_table=TMP_TABLE;
|
table->tmp_table=TMP_TABLE;
|
||||||
if (!lex->describe)
|
if (!lex->describe)
|
||||||
sl->exclude();
|
sl->exclude();
|
||||||
t->db="";
|
t->db=(char *)"";
|
||||||
t->derived=(SELECT_LEX *)0; // just in case ...
|
t->derived=(SELECT_LEX *)0; // just in case ...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,6 +324,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
|
|||||||
this->group= group_list != 0;
|
this->group= group_list != 0;
|
||||||
row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
|
row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
|
||||||
unit->select_limit_cnt);
|
unit->select_limit_cnt);
|
||||||
|
do_send_rows = (row_limit) ? 1 : 0;
|
||||||
this->unit= unit;
|
this->unit= unit;
|
||||||
|
|
||||||
#ifdef RESTRICTED_GROUP
|
#ifdef RESTRICTED_GROUP
|
||||||
@ -371,14 +372,18 @@ JOIN::optimize()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
conds=optimize_cond(conds,&cond_value);
|
conds= optimize_cond(conds,&cond_value);
|
||||||
if (thd->fatal_error || thd->net.report_error)
|
if (thd->fatal_error)
|
||||||
{
|
{
|
||||||
|
// quick abort
|
||||||
delete procedure;
|
delete procedure;
|
||||||
error = 0;
|
error= 0;
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
} else if (thd->net.report_error)
|
||||||
if (cond_value == Item::COND_FALSE || !unit->select_limit_cnt)
|
// normal error processing & cleanup
|
||||||
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
|
if (cond_value == Item::COND_FALSE || (!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
|
||||||
{ /* Impossible cond */
|
{ /* Impossible cond */
|
||||||
zero_result_cause= "Impossible WHERE";
|
zero_result_cause= "Impossible WHERE";
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
@ -395,13 +400,7 @@ JOIN::optimize()
|
|||||||
zero_result_cause= "No matching min/max row";
|
zero_result_cause= "No matching min/max row";
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
if (select_options & SELECT_DESCRIBE)
|
zero_result_cause= "Select tables optimized away";
|
||||||
{
|
|
||||||
select_describe(this, false, false, false,
|
|
||||||
"Select tables optimized away");
|
|
||||||
delete procedure;
|
|
||||||
DBUG_RETURN(1);
|
|
||||||
}
|
|
||||||
tables_list= 0; // All tables resolved
|
tables_list= 0; // All tables resolved
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -663,7 +662,8 @@ JOIN::exec()
|
|||||||
{ // Only test of functions
|
{ // Only test of functions
|
||||||
error=0;
|
error=0;
|
||||||
if (select_options & SELECT_DESCRIBE)
|
if (select_options & SELECT_DESCRIBE)
|
||||||
select_describe(this, false, false, false, "No tables used");
|
select_describe(this, false, false, false,
|
||||||
|
(zero_result_cause?zero_result_cause:"No tables used"));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result->send_fields(fields_list,1);
|
result->send_fields(fields_list,1);
|
||||||
@ -672,7 +672,10 @@ JOIN::exec()
|
|||||||
if (do_send_rows && result->send_data(fields_list))
|
if (do_send_rows && result->send_data(fields_list))
|
||||||
error= 1;
|
error= 1;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
error= (int) result->send_eof();
|
error= (int) result->send_eof();
|
||||||
|
send_records=1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error=(int) result->send_eof();
|
error=(int) result->send_eof();
|
||||||
@ -2613,8 +2616,8 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
|
|||||||
join->sum_funcs=0;
|
join->sum_funcs=0;
|
||||||
join->send_records=(ha_rows) 0;
|
join->send_records=(ha_rows) 0;
|
||||||
join->group=0;
|
join->group=0;
|
||||||
join->do_send_rows = 1;
|
|
||||||
join->row_limit=join->unit->select_limit_cnt;
|
join->row_limit=join->unit->select_limit_cnt;
|
||||||
|
join->do_send_rows = (join->row_limit) ? 1 : 0;
|
||||||
|
|
||||||
join_tab->cache.buff=0; /* No cacheing */
|
join_tab->cache.buff=0; /* No cacheing */
|
||||||
join_tab->table=tmp_table;
|
join_tab->table=tmp_table;
|
||||||
@ -7527,8 +7530,8 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (res > 0)
|
if (res > 0 || thd->net.report_error)
|
||||||
res= -res; // mysql_explain_select do not report error
|
res= -1; // mysql_explain_select do not report error
|
||||||
DBUG_RETURN(res);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,19 +523,19 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||||||
|
|
||||||
key_iterator.rewind();
|
key_iterator.rewind();
|
||||||
key_number=0;
|
key_number=0;
|
||||||
for (; (key=key_iterator++) ; key_info++, key_number++)
|
for (; (key=key_iterator++) ; key_number++)
|
||||||
{
|
{
|
||||||
uint key_length=0;
|
uint key_length=0;
|
||||||
key_part_spec *column;
|
key_part_spec *column;
|
||||||
|
|
||||||
switch(key->type){
|
switch(key->type){
|
||||||
case Key::MULTIPLE:
|
case Key::MULTIPLE:
|
||||||
key_info->flags = 0;
|
key_info->flags = 0;
|
||||||
break;
|
break;
|
||||||
case Key::FULLTEXT:
|
case Key::FULLTEXT:
|
||||||
key_info->flags = HA_FULLTEXT;
|
key_info->flags = HA_FULLTEXT;
|
||||||
break;
|
break;
|
||||||
case Key::SPATIAL:
|
case Key::SPATIAL:
|
||||||
key_info->flags = HA_SPATIAL;
|
key_info->flags = HA_SPATIAL;
|
||||||
break;
|
break;
|
||||||
case Key::FOREIGN_KEY:
|
case Key::FOREIGN_KEY:
|
||||||
@ -734,6 +734,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
|
|||||||
my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length);
|
my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length);
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
|
key_info++;
|
||||||
}
|
}
|
||||||
if (!unique_key && !primary_key &&
|
if (!unique_key && !primary_key &&
|
||||||
(file->table_flags() & HA_REQUIRE_PRIMARY_KEY))
|
(file->table_flags() & HA_REQUIRE_PRIMARY_KEY))
|
||||||
|
Reference in New Issue
Block a user