Commit 75b628b8 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
parents 10a081a0 4ed0b1c2
......@@ -145,7 +145,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION ||
(mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION &&
host && strcmp(host,LOCAL_HOST)))
host && *host && strcmp(host,LOCAL_HOST)))
DBUG_RETURN(cli_mysql_real_connect(mysql, host, user,
passwd, db, port,
unix_socket, client_flag));
......
This diff is collapsed.
......@@ -19,7 +19,7 @@
#---- Please do not alter the following table definitions -------#
--disable_warnings
drop table if exists t1, t_many_col_types ;
drop table if exists t1, t9 ;
--enable_warnings
eval create table t1
......@@ -28,7 +28,7 @@ eval create table t1
primary key(a)
) engine = $type ;
eval create table t_many_col_types
eval create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......
......@@ -14,12 +14,12 @@
# several test cases.
#
# Please do not modify the structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# 't1' and 't9'.
#
# But you are encouraged to use these two tables within your statements
# whenever possible.
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
# (DELETE/UPDATE/...) whenever possible.
# t1 - very simple table
# t9 - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
......@@ -124,17 +124,48 @@ set @arg04=2;
--disable_warnings
drop table if exists t2;
--enable_warnings
# t2 will be of table type 'MYISAM'
create table t2 as select a,b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
--disable_info
select a,b from t1 where a = @arg00 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
select a,b from t1 order by a;
--disable_info
select a,b from t1 order by a ;
drop table t2 ;
# t2 is now of table type '$type'
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
#
# Test UPDATE with SUBQUERY in prepared mode
#
eval create table t2
(
a int, b varchar(30),
primary key(a)
) engine = $type ;
insert into t2(a,b) select a, b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
--disable_info
select a,b from t1 where a = @arg00 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
--disable_info
select a,b from t1 order by a ;
drop table t2 ;
## update with parameters in limit
......@@ -179,6 +210,46 @@ set @arg01='eight' ;
prepare stmt1 from 'insert into t1 values(?, ? )';
execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
# cases derived from client_test.c: test_null()
set @NULL= null ;
set @arg00= 'abc' ;
# execute must fail, because first column is primary key (-> not null)
--error 1048
execute stmt1 using @NULL, @NULL ;
--error 1048
execute stmt1 using @NULL, @NULL ;
--error 1048
execute stmt1 using @NULL, @arg00 ;
--error 1048
execute stmt1 using @NULL, @arg00 ;
let $1 = 2;
while ($1)
{
eval set @arg01= 10000 + $1 ;
execute stmt1 using @arg01, @arg00 ;
dec $1;
}
select * from t1 where a > 10000 order by a ;
delete from t1 where a > 10000 ;
let $1 = 2;
while ($1)
{
eval set @arg01= 10000 + $1 ;
execute stmt1 using @arg01, @NULL ;
dec $1;
}
select * from t1 where a > 10000 order by a ;
delete from t1 where a > 10000 ;
let $1 = 10;
while ($1)
{
eval set @arg01= 10000 + $1 ;
execute stmt1 using @arg01, @arg01 ;
dec $1;
}
select * from t1 where a > 10000 order by a ;
delete from t1 where a > 10000 ;
## insert with two rows in values part
set @arg00=81 ;
......@@ -208,6 +279,22 @@ set @arg01=1 ;
--error 1062
execute stmt1 using @arg00, @arg01;
## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '
# cases derived from client_test.c: test_bug3117()
--disable_warnings
drop table if exists t2 ;
--enable_warnings
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
eval create table t2 (id int auto_increment primary key)
ENGINE= $type ;
prepare stmt1 from ' select last_insert_id() ' ;
insert into t2 values (NULL) ;
execute stmt1 ;
insert into t2 values (NULL) ;
# bug#3117
execute stmt1 ;
drop table t2 ;
## many parameters
set @1000=1000 ;
set @x1000_2="x1000_2" ;
......@@ -237,3 +324,34 @@ delete from t1 where a >= 1000 ;
## replace
--error 1295
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
## multi table statements
--disable_query_log
select '------ multi table tests ------' as test_sequence ;
--enable_query_log
# cases derived from client_test.c: test_multi
delete from t1 ;
delete from t9 ;
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
insert into t9 (c1,c21)
values (1, 'one'), (2, 'two'), (3, 'three') ;
prepare stmt_delete from " delete t1, t9
from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
prepare stmt_update from " update t1, t9
set t1.b='updated', t9.c21='updated'
where t1.a=t9.c1 and t1.a=? ";
prepare stmt_select1 from " select a, b from t1 order by a" ;
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
set @arg00= 1 ;
let $1= 3 ;
while ($1)
{
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
execute stmt_select2 ;
set @arg00= @arg00 + 1 ;
dec $1 ;
}
......@@ -20,12 +20,12 @@
# several test cases.
#
# Please do not modify the structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# 't1' and 't9'.
#
# But you are encouraged to use these two tables within your statements
# (DELETE/UPDATE/...) whenever possible.
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
# t1 - very simple table
# t9 - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
......@@ -41,6 +41,11 @@
#-------- Please be very carefull when editing behind this line ----------#
--source include/ps_renew.inc
#
# add a NULL row to t1: this row is used only in this test
insert into t1 values(0,NULL) ;
## big insert select statements
set @duplicate='duplicate ' ;
set @1000=1000 ;
......
This diff is collapsed.
################ include/ps_renew.inc #################
# #
# renew the content of t1 and t_many_col_types #
# renew the content of t1 and t9 #
# #
#######################################################
......@@ -13,8 +13,8 @@ insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -23,7 +23,7 @@ set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -32,3 +32,4 @@ set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -15,7 +15,28 @@ let $type= 'MYISAM' ;
-- source include/ps_renew.inc
-- source include/ps_query.inc
# parameter in SELECT ... MATCH/AGAINST
# case derived from client_test.c: test_bug1500()
--disable_warnings
drop table if exists t2 ;
--enable_warnings
eval create table t2 (s varchar(25), fulltext(s))
ENGINE = $type ;
insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ;
commit ;
prepare stmt1 from ' select s from t2 where match (s) against (?) ' ;
set @arg00='Dogs' ;
execute stmt1 using @arg00 ;
prepare stmt1 from ' SELECT s FROM t2
where match (s) against (concat(?,''digger'')) ';
set @arg00='Grave' ;
execute stmt1 using @arg00 ;
drop table t2 ;
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t_many_col_types;
drop table t1, t9;
......@@ -19,5 +19,6 @@ let $type= 'InnoDB' ;
-- source include/ps_query.inc
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t_many_col_types;
drop table t1, t9;
......@@ -12,7 +12,7 @@ use test;
let $type= 'HEAP' ;
--disable_warnings
drop table if exists t1, t_many_col_types ;
drop table if exists t1, t9 ;
--enable_warnings
eval create table t1
(
......@@ -21,12 +21,12 @@ eval create table t1
) engine = $type ;
--disable_warnings
drop table if exists t_many_col_types;
drop table if exists t9;
--enable_warnings
# The used table type doesn't support BLOB/TEXT columns.
# (The server would send error 1163 .)
# So we use char(100) instead.
eval create table t_many_col_types
eval create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -44,5 +44,6 @@ eval create table t_many_col_types
-- source include/ps_query.inc
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t_many_col_types;
drop table t1, t9;
......@@ -12,13 +12,13 @@ use test;
--disable_warnings
drop table if exists t1, t1_1, t1_2,
t_many_col_types, t_many_col_types_1, t_many_col_types_2;
t9, t9_1, t9_2;
--enable_warnings
let $type= 'MYISAM' ;
-- source include/ps_create.inc
rename table t1 to t1_1, t_many_col_types to t_many_col_types_1 ;
rename table t1 to t1_1, t9 to t9_1 ;
-- source include/ps_create.inc
rename table t1 to t1_2, t_many_col_types to t_many_col_types_2 ;
rename table t1 to t1_2, t9 to t9_2 ;
create table t1
(
......@@ -26,7 +26,7 @@ create table t1
primary key(a)
) ENGINE = MERGE UNION=(t1_1,t1_2)
INSERT_METHOD=FIRST;
create table t_many_col_types
create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -38,7 +38,7 @@ create table t_many_col_types
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) ENGINE = MERGE UNION=(t_many_col_types_1,t_many_col_types_2)
) ENGINE = MERGE UNION=(t9_1,t9_2)
INSERT_METHOD=FIRST;
-- source include/ps_renew.inc
......@@ -47,16 +47,17 @@ INSERT_METHOD=FIRST;
# no test of ps_modify1, because insert .. select
# is not allowed on MERGE tables
# -- source include/ps_modify1.inc
-- source include/ps_conv.inc
# Lets's try the same tests with INSERT_METHOD=LAST
drop table t1, t_many_col_types ;
drop table t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) ENGINE = MERGE UNION=(t1_1,t1_2)
INSERT_METHOD=LAST;
create table t_many_col_types
create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -68,7 +69,7 @@ create table t_many_col_types
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) ENGINE = MERGE UNION=(t_many_col_types_1,t_many_col_types_2)
) ENGINE = MERGE UNION=(t9_1,t9_2)
INSERT_METHOD=LAST;
-- source include/ps_renew.inc
......@@ -77,6 +78,7 @@ INSERT_METHOD=LAST;
# no test of ps_modify1, because insert .. select
# is not allowed on MERGE tables
# -- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t1_1, t1_2,
t_many_col_types_1, t_many_col_types_2, t_many_col_types;
t9_1, t9_2, t9;
......@@ -18,5 +18,6 @@ let $type= 'BDB' ;
-- source include/ps_query.inc
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t_many_col_types;
drop table t1, t9;
This diff is collapsed.
......@@ -330,7 +330,6 @@ err:
*/
int ha_archive::write_row(byte * buf)
{
char *pos;
z_off_t written;
DBUG_ENTER("ha_archive::write_row");
......@@ -415,6 +414,7 @@ int ha_archive::get_row(byte *buf)
int read; // Bytes read, gzread() returns int
char *last;
size_t total_blob_length= 0;
Field_blob **field;
DBUG_ENTER("ha_archive::get_row");
read= gzread(archive, buf, table->reclength);
......@@ -428,7 +428,7 @@ int ha_archive::get_row(byte *buf)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
/* Calculate blob length, we use this for our buffer */
for (Field_blob **field=table->blob_field; *field ; field++)
for (field=table->blob_field; *field ; field++)
total_blob_length += (*field)->get_length();
/* Adjust our row buffer if we need be */
......@@ -436,7 +436,7 @@ int ha_archive::get_row(byte *buf)
last= (char *)buffer.ptr();
/* Loop through our blobs and read them */
for (Field_blob **field=table->blob_field; *field ; field++)
for (field=table->blob_field; *field ; field++)
{
size_t size= (*field)->get_length();
read= gzread(archive, last, size);
......
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