mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
Merge work:/my/mysql-4.0 into mashka.mysql.fi:/home/my/mysql-4.0
This commit is contained in:
commit
f06b0d9f3c
24 changed files with 242 additions and 53 deletions
|
@ -83,4 +83,3 @@ tags:
|
|||
|
||||
test:
|
||||
cd mysql-test ; ./mysql-test-run
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
|
|||
AC_INIT(sql/mysqld.cc)
|
||||
AC_CANONICAL_SYSTEM
|
||||
# The Docs Makefile.am parses this line!
|
||||
AM_INIT_AUTOMAKE(mysql, 4.0.11)
|
||||
AM_INIT_AUTOMAKE(mysql, 4.0.11-gamma)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
|
@ -702,7 +702,7 @@ AC_ARG_WITH(mysqld-user,
|
|||
AC_SUBST(MYSQLD_USER)
|
||||
|
||||
# If we should allow LOAD DATA LOCAL
|
||||
AC_MSG_CHECKING(if we should should enable LOAD DATA LOCAL by default)
|
||||
AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
|
||||
AC_ARG_ENABLE(local-infile,
|
||||
[ --enable-local-infile Enable LOAD DATA LOCAL INFILE (default: disabled)],
|
||||
[ ENABLED_LOCAL_INFILE=$enableval ],
|
||||
|
|
|
@ -764,6 +764,14 @@ typedef char bool; /* Ordinary boolean values 0 1 */
|
|||
#define INT32(v) (int32) (v)
|
||||
#define MYF(v) (myf) (v)
|
||||
|
||||
#ifndef LL
|
||||
#ifdef HAVE_LONG_LONG
|
||||
#define LL(A) A ## LL
|
||||
#else
|
||||
#define LL(A) A ## L
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
Defines to make it possible to prioritize register assignments. No
|
||||
longer that important with modern compilers.
|
||||
|
|
|
@ -77,7 +77,6 @@ NULL NULL
|
|||
10 VMT
|
||||
select id+0 as a,max(id),concat(facility) as b from t1 group by a order by b desc,a;
|
||||
a max(id) b
|
||||
NULL NULL NULL
|
||||
10 10 VMT
|
||||
9 9 SRV
|
||||
8 8 RV
|
||||
|
@ -90,6 +89,7 @@ NULL NULL NULL
|
|||
1 1 /L
|
||||
-1 -1
|
||||
0 0
|
||||
NULL NULL NULL
|
||||
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
|
||||
grp count(*)
|
||||
NULL 1
|
||||
|
|
|
@ -42,8 +42,8 @@ insert into t1 values (null,null,'');
|
|||
select count(distinct a),count(distinct grp) from t1;
|
||||
count(distinct a) count(distinct grp)
|
||||
6 3
|
||||
select sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1;
|
||||
sum(a) count(a) avg(a) std(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
|
||||
select sum(all a),count(all a),avg(all a),std(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
|
||||
sum(all a) count(all a) avg(all a) std(all a) bit_or(all a) bit_and(all a) min(all a) max(all a) min(all c) max(all c)
|
||||
21 6 3.5000 1.7078 7 0 1 6 E
|
||||
select grp, sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
|
||||
grp sum(a) count(a) avg(a) std(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
|
||||
|
|
|
@ -290,7 +290,7 @@ select * from t1;
|
|||
id val
|
||||
drop table t1;
|
||||
create table t1 (a integer) type=innodb;
|
||||
begin;
|
||||
start transaction;
|
||||
rename table t1 to t2;
|
||||
create table t1 (b integer) type=innodb;
|
||||
insert into t1 values (1);
|
||||
|
|
|
@ -1,4 +1,34 @@
|
|||
drop table if exists t1,t2,t3;
|
||||
CREATE TABLE t1 (S1 INT);
|
||||
CREATE TABLE t2 (S1 INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (2);
|
||||
SELECT * FROM t1 JOIN t2;
|
||||
S1 S1
|
||||
1 2
|
||||
SELECT * FROM t1 INNER JOIN t2;
|
||||
S1 S1
|
||||
1 2
|
||||
SELECT * from t1 JOIN t2 USING (S1);
|
||||
S1 S1
|
||||
SELECT * FROM t1 INNER JOIN t2 USING (S1);
|
||||
S1 S1
|
||||
SELECT * from t1 CROSS JOIN t2;
|
||||
S1 S1
|
||||
1 2
|
||||
SELECT * from t1 LEFT JOIN t2 USING(S1);
|
||||
S1 S1
|
||||
1 NULL
|
||||
SELECT * from t1 LEFT JOIN t2 ON(t2.S1=2);
|
||||
S1 S1
|
||||
1 2
|
||||
SELECT * from t1 RIGHT JOIN t2 USING(S1);
|
||||
S1 S1
|
||||
NULL 2
|
||||
SELECT * from t1 RIGHT JOIN t2 ON(t1.S1=1);
|
||||
S1 S1
|
||||
1 2
|
||||
drop table t1,t2;
|
||||
create table t1 (id int primary key);
|
||||
create table t2 (id int);
|
||||
insert into t1 values (75);
|
||||
|
|
|
@ -304,7 +304,7 @@ a b c
|
|||
1 NULL b
|
||||
explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 range a a 9 NULL 8 Using where; Using index; Using filesort
|
||||
t1 range a a 9 NULL 8 Using where; Using index
|
||||
explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 range a a 9 NULL 5 Using where; Using index
|
||||
|
@ -320,7 +320,18 @@ table type possible_keys key key_len ref rows Extra
|
|||
t1 range a a 9 NULL 5 Using where; Using index
|
||||
explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 range a a 9 NULL 2 Using where; Using index; Using filesort
|
||||
t1 range a a 9 NULL 2 Using where; Using index
|
||||
explain select * from t1 where a = 1 order by b desc;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ref a a 4 const 5 Using where; Using index
|
||||
select * from t1 where a = 1 order by b desc;
|
||||
a b c
|
||||
1 3 b
|
||||
1 1 b
|
||||
1 1 b
|
||||
1 1 NULL
|
||||
1 NULL b
|
||||
1 NULL NULL
|
||||
alter table t1 modify b int not null, modify c varchar(10) not null;
|
||||
explain select * from t1 order by a, b, c;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
|
|
|
@ -156,6 +156,62 @@ f double(5,0) YES NULL
|
|||
h float(3,2) YES NULL
|
||||
i float(3,0) YES NULL
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
type_bool bool not null,
|
||||
type_tiny tinyint not null auto_increment primary key,
|
||||
type_short smallint(3),
|
||||
type_mediumint mediumint,
|
||||
type_bigint bigint,
|
||||
type_decimal decimal(5,2),
|
||||
type_numeric numeric(5,2),
|
||||
empty_char char(0),
|
||||
type_char char(2),
|
||||
type_varchar varchar(10),
|
||||
type_timestamp timestamp not null,
|
||||
type_date date not null,
|
||||
type_time time not null,
|
||||
type_datetime datetime not null,
|
||||
type_year year,
|
||||
type_enum enum ('red', 'green', 'blue'),
|
||||
type_set enum ('red', 'green', 'blue'),
|
||||
type_tinyblob tinyblob,
|
||||
type_blob blob,
|
||||
type_medium_blob mediumblob,
|
||||
type_long_blob longblob,
|
||||
index(type_short)
|
||||
) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`type_bool` tinyint(1) NOT NULL default '0',
|
||||
`type_tiny` tinyint(4) NOT NULL auto_increment,
|
||||
`type_short` smallint(3) default NULL,
|
||||
`type_mediumint` mediumint(9) default NULL,
|
||||
`type_bigint` bigint(20) default NULL,
|
||||
`type_decimal` decimal(5,2) default NULL,
|
||||
`type_numeric` decimal(5,2) default NULL,
|
||||
`empty_char` char(0) default NULL,
|
||||
`type_char` char(2) default NULL,
|
||||
`type_varchar` varchar(10) default NULL,
|
||||
`type_timestamp` timestamp(14) NOT NULL,
|
||||
`type_date` date NOT NULL default '0000-00-00',
|
||||
`type_time` time NOT NULL default '00:00:00',
|
||||
`type_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`type_year` year(4) default NULL,
|
||||
`type_enum` enum('red','green','blue') default NULL,
|
||||
`type_set` enum('red','green','blue') default NULL,
|
||||
`type_tinyblob` tinyblob,
|
||||
`type_blob` blob,
|
||||
`type_medium_blob` mediumblob,
|
||||
`type_long_blob` longblob,
|
||||
PRIMARY KEY (`type_tiny`),
|
||||
KEY `type_short` (`type_short`)
|
||||
) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
|
||||
insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
|
||||
select * from t1;
|
||||
type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_numeric empty_char type_char type_varchar type_timestamp type_date type_time type_datetime type_year type_enum type_set type_tinyblob type_blob type_medium_blob type_long_blob
|
||||
0 1 NULL NULL NULL NULL NULL NULL NULL NULL 20030207100001 0000-00-00 00:00:00 0000-00-00 00:00:00 NULL NULL NULL NULL NULL NULL NULL
|
||||
drop table t1;
|
||||
create table t1 (c decimal, d double, f float, r real);
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
|
|
|
@ -21,7 +21,7 @@ select count(distinct a),count(distinct grp) from t1;
|
|||
insert into t1 values (null,null,'');
|
||||
select count(distinct a),count(distinct grp) from t1;
|
||||
|
||||
select sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1;
|
||||
select sum(all a),count(all a),avg(all a),std(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
|
||||
select grp, sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
|
||||
select grp, sum(a)+count(a)+avg(a)+std(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ drop table t1;
|
|||
#
|
||||
|
||||
create table t1 (a integer) type=innodb;
|
||||
begin;
|
||||
start transaction;
|
||||
rename table t1 to t2;
|
||||
create table t1 (b integer) type=innodb;
|
||||
insert into t1 values (1);
|
||||
|
|
|
@ -1,7 +1,30 @@
|
|||
#
|
||||
# Initialization
|
||||
drop table if exists t1,t2,t3;
|
||||
|
||||
#
|
||||
# Test different join syntaxes
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (S1 INT);
|
||||
CREATE TABLE t2 (S1 INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (2);
|
||||
SELECT * FROM t1 JOIN t2;
|
||||
SELECT * FROM t1 INNER JOIN t2;
|
||||
SELECT * from t1 JOIN t2 USING (S1);
|
||||
SELECT * FROM t1 INNER JOIN t2 USING (S1);
|
||||
SELECT * from t1 CROSS JOIN t2;
|
||||
SELECT * from t1 LEFT JOIN t2 USING(S1);
|
||||
SELECT * from t1 LEFT JOIN t2 ON(t2.S1=2);
|
||||
SELECT * from t1 RIGHT JOIN t2 USING(S1);
|
||||
SELECT * from t1 RIGHT JOIN t2 ON(t1.S1=1);
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# This failed for lia Perminov
|
||||
#
|
||||
drop table if exists t1,t2,t3;
|
||||
|
||||
|
||||
create table t1 (id int primary key);
|
||||
create table t2 (id int);
|
||||
|
|
|
@ -227,7 +227,8 @@ explain select * from t1 where a = 2 and (b is null or b > 0) order by a
|
|||
desc,b desc;
|
||||
explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
|
||||
explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
|
||||
|
||||
explain select * from t1 where a = 1 order by b desc;
|
||||
select * from t1 where a = 1 order by b desc;
|
||||
#
|
||||
# Test things when we don't have NULL keys
|
||||
#
|
||||
|
|
|
@ -80,6 +80,41 @@ create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0),
|
|||
show columns from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Do a create table that tries to cover all types and options
|
||||
#
|
||||
create table t1 (
|
||||
type_bool bool not null,
|
||||
type_tiny tinyint not null auto_increment primary key,
|
||||
type_short smallint(3),
|
||||
type_mediumint mediumint,
|
||||
type_bigint bigint,
|
||||
type_decimal decimal(5,2),
|
||||
type_numeric numeric(5,2),
|
||||
empty_char char(0),
|
||||
type_char char(2),
|
||||
type_varchar varchar(10),
|
||||
type_timestamp timestamp not null,
|
||||
type_date date not null,
|
||||
type_time time not null,
|
||||
type_datetime datetime not null,
|
||||
type_year year,
|
||||
type_enum enum ('red', 'green', 'blue'),
|
||||
type_set enum ('red', 'green', 'blue'),
|
||||
type_tinyblob tinyblob,
|
||||
type_blob blob,
|
||||
type_medium_blob mediumblob,
|
||||
type_long_blob longblob,
|
||||
index(type_short)
|
||||
) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" TYPE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1;
|
||||
|
||||
# Not tested above: RAID_# UNION INSERT_METHOD DATA DIRECTORY INDEX DIRECTORY
|
||||
show create table t1;
|
||||
insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
# Check auto conversions of types
|
||||
|
||||
create table t1 (c decimal, d double, f float, r real);
|
||||
|
|
|
@ -461,7 +461,10 @@ static void make_sortkey(register SORTPARAM *param,
|
|||
{
|
||||
if (field->is_null())
|
||||
{
|
||||
bzero((char*) to,sort_field->length+1);
|
||||
if (sort_field->reverse)
|
||||
bfill(to,sort_field->length+1,(char) 255);
|
||||
else
|
||||
bzero((char*) to,sort_field->length+1);
|
||||
to+= sort_field->length+1;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -260,6 +260,7 @@ static SYMBOL symbols[] = {
|
|||
{ "NULL", SYM(NULL_SYM),0,0},
|
||||
{ "NUMERIC", SYM(NUMERIC_SYM),0,0},
|
||||
{ "OFFSET", SYM(OFFSET_SYM),0,0},
|
||||
{ "OLD_PASSWORD", SYM(PASSWORD),0,0},
|
||||
{ "ON", SYM(ON),0,0},
|
||||
{ "OPEN", SYM(OPEN_SYM),0,0},
|
||||
{ "OPTIMIZE", SYM(OPTIMIZE),0,0},
|
||||
|
|
|
@ -53,14 +53,6 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
|
|||
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
|
||||
#define all_bits_set(A,B) ((A) & (B) != (B))
|
||||
|
||||
#ifndef LL
|
||||
#ifdef HAVE_LONG_LONG
|
||||
#define LL(A) A ## LL
|
||||
#else
|
||||
#define LL(A) A ## L
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
Configuration parameters
|
||||
****************************************************************************/
|
||||
|
|
|
@ -2555,8 +2555,7 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts)
|
|||
for (r = it++; r; r = it++)
|
||||
{
|
||||
rev_ranges.push_front(r);
|
||||
if (not_read_after_key && range_reads_after_key(r) ||
|
||||
test_if_null_range(r,used_key_parts))
|
||||
if (not_read_after_key && range_reads_after_key(r))
|
||||
{
|
||||
it.rewind(); // Reset range
|
||||
error = HA_ERR_UNSUPPORTED;
|
||||
|
@ -2717,6 +2716,7 @@ bool QUICK_SELECT_DESC::range_reads_after_key(QUICK_RANGE *range_arg)
|
|||
|
||||
/* True if we are reading over a key that may have a NULL value */
|
||||
|
||||
#ifdef NOT_USED
|
||||
bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range_arg,
|
||||
uint used_key_parts)
|
||||
{
|
||||
|
@ -2762,6 +2762,7 @@ bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range_arg,
|
|||
return 1; // Covers null part
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
@ -100,7 +100,9 @@ public:
|
|||
private:
|
||||
int cmp_prev(QUICK_RANGE *range);
|
||||
bool range_reads_after_key(QUICK_RANGE *range);
|
||||
#ifdef NOT_USED
|
||||
bool test_if_null_range(QUICK_RANGE *range, uint used_key_parts);
|
||||
#endif
|
||||
void reset(void) { next=0; rev_it.rewind(); }
|
||||
List<QUICK_RANGE> rev_ranges;
|
||||
List_iterator<QUICK_RANGE> rev_it;
|
||||
|
|
|
@ -1671,7 +1671,8 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
|
|||
*/
|
||||
ulong log_name_extension;
|
||||
char log_name_tmp[FN_REFLEN]; //make a char[] from String
|
||||
char *end= strmake(log_name_tmp, log_name->ptr(), min(log_name->length(), FN_REFLEN-1));
|
||||
char *end= strmake(log_name_tmp, log_name->ptr(), min(log_name->length(),
|
||||
FN_REFLEN-1));
|
||||
char *p= fn_ext(log_name_tmp);
|
||||
char *p_end;
|
||||
if (!*p || log_pos<0)
|
||||
|
@ -1756,15 +1757,14 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
|
|||
error= -1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
error=0;
|
||||
error=0;
|
||||
event_count++;
|
||||
}
|
||||
|
||||
err:
|
||||
pthread_mutex_unlock(&data_lock);
|
||||
DBUG_PRINT("exit",("killed: %d abort: %d slave_running: %d \
|
||||
improper_arguments: %d timed_out: %d",
|
||||
improper_arguments: %d timed_out: %d",
|
||||
(int) thd->killed,
|
||||
(int) (init_abort_pos_wait != abort_pos_wait),
|
||||
(int) mi->slave_running,
|
||||
|
|
|
@ -2252,8 +2252,6 @@ mysql_execute_command(void)
|
|||
net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
|
||||
break;
|
||||
}
|
||||
if (lower_case_table_names)
|
||||
casedn_str(lex->name);
|
||||
/*
|
||||
If in a slave thread :
|
||||
CREATE DATABASE DB was certainly not preceded by USE DB.
|
||||
|
|
|
@ -4555,6 +4555,11 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
|
|||
{
|
||||
if ((error=(*join_tab->next_select)(join,join_tab+1,0)) < 0)
|
||||
return error;
|
||||
/*
|
||||
Test if this was a SELECT DISTINCT query on a table that
|
||||
was not in the field list; In this case we can abort if
|
||||
we found a row, as no new rows can be added to the result.
|
||||
*/
|
||||
if (not_used_in_distinct && found_records != join->found_records)
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -579,7 +579,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
|||
insert_values update delete truncate rename
|
||||
show describe load alter optimize flush
|
||||
reset purge begin commit rollback slave master_def master_defs
|
||||
repair restore backup analyze check
|
||||
repair restore backup analyze check start
|
||||
field_list field_list_item field_spec kill
|
||||
select_item_list select_item values_list no_braces
|
||||
limit_clause delete_limit_clause fields opt_values values
|
||||
|
@ -657,6 +657,7 @@ verb_clause:
|
|||
| select
|
||||
| set
|
||||
| slave
|
||||
| start
|
||||
| show
|
||||
| truncate
|
||||
| handler
|
||||
|
@ -1328,6 +1329,11 @@ slave:
|
|||
lex->type = 0;
|
||||
};
|
||||
|
||||
start:
|
||||
START_SYM TRANSACTION_SYM { Lex->sql_command = SQLCOM_BEGIN;}
|
||||
{}
|
||||
;
|
||||
|
||||
slave_thread_opts:
|
||||
slave_thread_opt
|
||||
| slave_thread_opts ',' slave_thread_opt;
|
||||
|
@ -1999,7 +2005,7 @@ sum_expr:
|
|||
{ $$=new Item_sum_and($3); }
|
||||
| BIT_OR '(' in_sum_expr ')'
|
||||
{ $$=new Item_sum_or($3); }
|
||||
| COUNT_SYM '(' '*' ')'
|
||||
| COUNT_SYM '(' opt_all '*' ')'
|
||||
{ $$=new Item_sum_count(new Item_int((int32) 0L,1)); }
|
||||
| COUNT_SYM '(' in_sum_expr ')'
|
||||
{ $$=new Item_sum_count($3); }
|
||||
|
@ -2017,11 +2023,12 @@ sum_expr:
|
|||
{ $$=new Item_sum_sum($3); };
|
||||
|
||||
in_sum_expr:
|
||||
opt_all
|
||||
{ Select->in_sum_expr++; }
|
||||
expr
|
||||
{
|
||||
Select->in_sum_expr--;
|
||||
$$=$2;
|
||||
$$=$3;
|
||||
};
|
||||
|
||||
cast_type:
|
||||
|
@ -2092,19 +2099,22 @@ opt_pad:
|
|||
join_table_list:
|
||||
'(' join_table_list ')' { $$=$2; }
|
||||
| join_table { $$=$1; }
|
||||
| join_table_list ',' join_table_list { $$=$3; }
|
||||
| join_table_list normal_join join_table_list { $$=$3; }
|
||||
| join_table_list STRAIGHT_JOIN join_table_list
|
||||
{ $$=$3 ; $$->straight=1; }
|
||||
| join_table_list INNER_SYM JOIN_SYM join_table_list ON expr
|
||||
{ add_join_on($4,$6); $$=$4; }
|
||||
| join_table_list INNER_SYM JOIN_SYM join_table_list
|
||||
| join_table_list normal_join join_table_list ON expr
|
||||
{ add_join_on($3,$5); $$=$3; }
|
||||
| join_table_list normal_join join_table_list
|
||||
USING
|
||||
{
|
||||
SELECT_LEX *sel=Select;
|
||||
sel->db1=$1->db; sel->table1=$1->alias;
|
||||
sel->db2=$4->db; sel->table2=$4->alias;
|
||||
sel->db2=$3->db; sel->table2=$3->alias;
|
||||
}
|
||||
USING '(' using_list ')'
|
||||
{ add_join_on($4,$8); $$=$4; }
|
||||
'(' using_list ')'
|
||||
{ add_join_on($3,$7); $$=$3; }
|
||||
|
||||
| join_table_list LEFT opt_outer JOIN_SYM join_table_list ON expr
|
||||
{ add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
|
||||
| join_table_list LEFT opt_outer JOIN_SYM join_table_list
|
||||
|
@ -2133,9 +2143,10 @@ join_table_list:
|
|||
{ add_join_natural($1,$4); $$=$4; };
|
||||
|
||||
normal_join:
|
||||
',' {}
|
||||
| JOIN_SYM {}
|
||||
| CROSS JOIN_SYM {};
|
||||
JOIN_SYM {}
|
||||
| INNER_SYM JOIN_SYM {}
|
||||
| CROSS JOIN_SYM {}
|
||||
;
|
||||
|
||||
join_table:
|
||||
{
|
||||
|
@ -2232,6 +2243,10 @@ opt_table_alias:
|
|||
| table_alias ident
|
||||
{ $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); };
|
||||
|
||||
opt_all:
|
||||
/* empty */
|
||||
| ALL
|
||||
;
|
||||
|
||||
where_clause:
|
||||
/* empty */ { Select->where= 0; }
|
||||
|
|
31
sql/table.cc
31
sql/table.cc
|
@ -95,11 +95,11 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
|
|||
|
||||
if (my_read(file,(byte*) head,64,MYF(MY_NABP))) goto err_not_open;
|
||||
if (head[0] != (uchar) 254 || head[1] != 1 ||
|
||||
(head[2] != FRM_VER && head[2] > FRM_VER+2))
|
||||
(head[2] != FRM_VER && head[2] != FRM_VER+1 && head[2] != FRM_VER+3))
|
||||
goto err_not_open; /* purecov: inspected */
|
||||
new_field_pack_flag=head[27];
|
||||
new_frm_ver= (head[2] - FRM_VER);
|
||||
field_pack_length= new_frm_ver < 2 ? 11 : 15;
|
||||
field_pack_length= new_frm_ver < 2 ? 11 : 17;
|
||||
|
||||
error=3;
|
||||
if (!(pos=get_form_pos(file,head,(TYPELIB*) 0)))
|
||||
|
@ -154,7 +154,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
|
|||
|
||||
for (i=0 ; i < keys ; i++, keyinfo++)
|
||||
{
|
||||
if (new_frm_ver == 2)
|
||||
if (new_frm_ver == 3)
|
||||
{
|
||||
keyinfo->flags= (uint) uint2korr(strpos) ^ HA_NOSAME;
|
||||
keyinfo->key_length= (uint) uint2korr(strpos+2);
|
||||
|
@ -343,28 +343,37 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
|
|||
|
||||
for (i=0 ; i < outparam->fields; i++, strpos+=field_pack_length, field_ptr++)
|
||||
{
|
||||
uint pack_flag= uint2korr(strpos+6);
|
||||
uint interval_nr= (uint) strpos[10];
|
||||
uint pack_flag, interval_nr, unireg_type, recpos, field_length;
|
||||
enum_field_types field_type;
|
||||
|
||||
if (new_frm_ver == 2)
|
||||
if (new_frm_ver == 3)
|
||||
{
|
||||
/* new frm file in 4.1 */
|
||||
field_type=(enum_field_types) (uint) strpos[11];
|
||||
field_length= uint2korr(strpos+3);
|
||||
recpos= uint3korr(strpos+5);
|
||||
pack_flag= uint2korr(strpos+8);
|
||||
unireg_type= (uint) strpos[10];
|
||||
interval_nr= (uint) strpos[12];
|
||||
field_type= (enum_field_types) (uint) strpos[13];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* old frm file */
|
||||
field_length= (uint) strpos[3];
|
||||
recpos= uint2korr(strpos+4),
|
||||
pack_flag= uint2korr(strpos+6);
|
||||
unireg_type= (uint) strpos[8];
|
||||
interval_nr= (uint) strpos[10];
|
||||
field_type= (enum_field_types) f_packtype(pack_flag);
|
||||
}
|
||||
|
||||
*field_ptr=reg_field=
|
||||
make_field(record+uint2korr(strpos+4),
|
||||
(uint32) strpos[3], // field_length
|
||||
make_field(record+recpos,
|
||||
(uint32) field_length,
|
||||
null_pos,null_bit,
|
||||
pack_flag,
|
||||
field_type,
|
||||
(Field::utype) MTYP_TYPENR((uint) strpos[8]),
|
||||
(Field::utype) MTYP_TYPENR(unireg_type),
|
||||
(interval_nr ?
|
||||
outparam->intervals+interval_nr-1 :
|
||||
(TYPELIB*) 0),
|
||||
|
@ -1215,7 +1224,7 @@ db_type get_table_type(const char *name)
|
|||
error=my_read(file,(byte*) head,4,MYF(MY_NABP));
|
||||
my_close(file,MYF(0));
|
||||
if (error || head[0] != (uchar) 254 || head[1] != 1 ||
|
||||
(head[2] != FRM_VER && head[2] != FRM_VER+1))
|
||||
(head[2] != FRM_VER && head[2] != FRM_VER+1 && head[2] != FRM_VER+3))
|
||||
DBUG_RETURN(DB_TYPE_UNKNOWN);
|
||||
DBUG_RETURN(ha_checktype((enum db_type) (uint) *(head+3)));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue