Commit 7f21a7a6 authored by monty@donna.mysql.fi's avatar monty@donna.mysql.fi

Fixed INSERT DELAYED with Innobase

Fix for shutdown on NT
Fixed bug when using wrong dates from blob field.
parent 3d19a5d4
jani@janikt.pp.saunalahti.fi monty@donna.mysql.fi
...@@ -14029,12 +14029,13 @@ adopt a consistent convention, such as always creating databases and ...@@ -14029,12 +14029,13 @@ adopt a consistent convention, such as always creating databases and
tables using lowercase names. tables using lowercase names.
One way to avoid this problem is to start @code{mysqld} with @code{-O One way to avoid this problem is to start @code{mysqld} with @code{-O
lower_case_table_names=1}. lower_case_table_names=1}. By default this option is 1 on windows and 0 on
Unix.
In this case @strong{MySQL} will on Windows/NT convert all table names If @code{lower_case_table_names} is 1 @strong{MySQL} will convert all
to lower case on storage and lookup. Note that you need to first table names to lower case on storage and lookup. Note that if you
convert your old table names to lower case before starting @code{mysqld} change this option, you need to first convert your old table names to
with this option. lower case before starting @code{mysqld}.
@cindex variables, user @cindex variables, user
@cindex user variables @cindex user variables
...@@ -42640,6 +42641,10 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. ...@@ -42640,6 +42641,10 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet @itemize @bullet
@item @item
Added @code{SQL_CALC_FOUND_ROWS} and @code{FOUND_ROWS()}. This make it
possible to know how many rows a query would have returned if one hadn't
used @code{LIMIT}.
@item
Changed output format of @code{SHOW OPEN TABLES}. Changed output format of @code{SHOW OPEN TABLES}.
@item @item
Allow @code{SELECT expression LIMIT ...}. Allow @code{SELECT expression LIMIT ...}.
...@@ -42738,6 +42743,13 @@ not yet 100% confident in this code. ...@@ -42738,6 +42743,13 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.37 @appendixsubsec Changes in release 3.23.37
@itemize @bullet @itemize @bullet
@item @item
Disabled @code{INSERT DELAYED} for tables that supports transactions.
@item
Fixed bug when using date functions on @code{TEXT}/@code{BLOB} column
with wrong date format.
@item
UDF's now also works on windows. (Patch by Ralph Mason)
@item
Fixed bug in @code{ALTER TABLE} and @code{LOAD DATA INFILE} that disabled Fixed bug in @code{ALTER TABLE} and @code{LOAD DATA INFILE} that disabled
key-sorting. These command should now be faster in most cases. key-sorting. These command should now be faster in most cases.
@item @item
...@@ -47974,6 +47986,16 @@ Change @code{INSERT ... SELECT} to use concurrent inserts. ...@@ -47974,6 +47986,16 @@ Change @code{INSERT ... SELECT} to use concurrent inserts.
Return the original field types() when doing @code{SELECT MIN(column) Return the original field types() when doing @code{SELECT MIN(column)
... GROUP BY}. ... GROUP BY}.
@item @item
Multiple result sets.
@item
Change the protocol to allow binary transfer of values. To do this
efficiently, we need to add an API to allow binding of variables.
@item
Add @code{PREPARE} of statements and sending of parameters to @code{mysqld}.
@item
Make it possible to specify @code{long_query_time} with a granularity
in microseconds.
@item
Add range checking to @code{MERGE} tables. Add range checking to @code{MERGE} tables.
@item @item
Port of @strong{MySQL} to BeOS. Port of @strong{MySQL} to BeOS.
...@@ -20,3 +20,6 @@ ...@@ -20,3 +20,6 @@
/* Version number of package */ /* Version number of package */
#define VERSION "0.90" #define VERSION "0.90"
/* No inlining because gcc broken on HP-UX */
/* #undef UNIV_MUST_NOT_INLINE */
...@@ -19,3 +19,6 @@ ...@@ -19,3 +19,6 @@
/* Version number of package */ /* Version number of package */
#undef VERSION #undef VERSION
/* No inlining because gcc broken on HP-UX */
#undef UNIV_MUST_NOT_INLINE
month(updated)
10
NULL
year(updated)
1999
NULL
...@@ -192,3 +192,7 @@ January ...@@ -192,3 +192,7 @@ January
monthname(date) monthname(date)
NULL NULL
January January
month(updated)
NULL
year(updated)
NULL
...@@ -445,5 +445,7 @@ i j ...@@ -445,5 +445,7 @@ i j
1 2 1 2
MIN(B) MAX(b) MIN(B) MAX(b)
1 1 1 1
a
1
table type possible_keys key key_len ref rows Extra table type possible_keys key key_len ref rows Extra
t1 range PRIMARY PRIMARY 4 NULL 1 where used t1 range PRIMARY PRIMARY 4 NULL 1 where used
drop table if exists db_crash;
CREATE TABLE df_crash (
updated text
) TYPE=MyISAM;
INSERT INTO df_crash VALUES ('1999-10-5');
insert into df_crash values ('');
select month(updated) from df_crash;
select year(updated) from df_crash;
drop table df_crash;
...@@ -119,3 +119,12 @@ insert into t2 values (2, "2000-01-01"); ...@@ -119,3 +119,12 @@ insert into t2 values (2, "2000-01-01");
select monthname(date) from t1 inner join t2 on t1.id = t2.id; select monthname(date) from t1 inner join t2 on t1.id = t2.id;
select monthname(date) from t1 inner join t2 on t1.id = t2.id order by t1.id; select monthname(date) from t1 inner join t2 on t1.id = t2.id order by t1.id;
drop table t1,t2; drop table t1,t2;
#
# Test bug with month() and year() on text fields with wrong information
CREATE TABLE t1 (updated text) TYPE=MyISAM;
INSERT INTO t1 VALUES ('');
SELECT month(updated) from t1;
SELECT year(updated) from t1;
drop table t1;
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# #
drop table if exists t1,t2; drop table if exists t1,t2;
create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innobase; create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb;
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
select id, code, name from t1 order by id; select id, code, name from t1 order by id;
...@@ -28,7 +28,7 @@ CREATE TABLE t1 ( ...@@ -28,7 +28,7 @@ CREATE TABLE t1 (
PRIMARY KEY (id), PRIMARY KEY (id),
KEY parent_id (parent_id), KEY parent_id (parent_id),
KEY level (level) KEY level (level)
) type=innobase; ) type=innodb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
update t1 set parent_id=parent_id+100; update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102; select * from t1 where parent_id=102;
...@@ -57,7 +57,7 @@ CREATE TABLE t1 ( ...@@ -57,7 +57,7 @@ CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL, gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id) PRIMARY KEY (gesuchnr,benutzer_id)
) type=innobase; ) type=innodb;
replace into t1 (gesuchnr,benutzer_id) values (2,1); replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1);
...@@ -69,7 +69,7 @@ drop table t1; ...@@ -69,7 +69,7 @@ drop table t1;
# test delete using hidden_primary_key # test delete using hidden_primary_key
# #
create table t1 (a int) type=innobase; create table t1 (a int) type=innodb;
insert into t1 values (1), (2); insert into t1 values (1), (2);
optimize table t1; optimize table t1;
delete from t1 where a = 1; delete from t1 where a = 1;
...@@ -77,7 +77,7 @@ select * from t1; ...@@ -77,7 +77,7 @@ select * from t1;
check table t1; check table t1;
drop table t1; drop table t1;
create table t1 (a int,b varchar(20)) type=innobase; create table t1 (a int,b varchar(20)) type=innodb;
insert into t1 values (1,""), (2,"testing"); insert into t1 values (1,""), (2,"testing");
delete from t1 where a = 1; delete from t1 where a = 1;
select * from t1; select * from t1;
...@@ -90,7 +90,7 @@ drop table t1; ...@@ -90,7 +90,7 @@ drop table t1;
# Test of reading on secondary key with may be null # Test of reading on secondary key with may be null
create table t1 (a int,b varchar(20),key(a)) type=innobase; create table t1 (a int,b varchar(20),key(a)) type=innodb;
insert into t1 values (1,""), (2,"testing"); insert into t1 values (1,""), (2,"testing");
select * from t1 where a = 1; select * from t1 where a = 1;
drop table t1; drop table t1;
...@@ -99,7 +99,7 @@ drop table t1; ...@@ -99,7 +99,7 @@ drop table t1;
# Test rollback # Test rollback
# #
create table t1 (n int not null primary key) type=innobase; create table t1 (n int not null primary key) type=innodb;
set autocommit=0; set autocommit=0;
insert into t1 values (4); insert into t1 values (4);
rollback; rollback;
...@@ -126,7 +126,7 @@ drop table t1; ...@@ -126,7 +126,7 @@ drop table t1;
# Testing transactions # Testing transactions
# #
create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=innobase; create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) type=innodb;
begin; begin;
insert into t1 values(1,'hamdouni'); insert into t1 values(1,'hamdouni');
select id as afterbegin_id,nom as afterbegin_nom from t1; select id as afterbegin_id,nom as afterbegin_nom from t1;
...@@ -144,7 +144,7 @@ drop table t1; ...@@ -144,7 +144,7 @@ drop table t1;
# Simple not autocommit test # Simple not autocommit test
# #
CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=innobase; CREATE TABLE t1 (id char(8) not null primary key, val int not null) type=innodb;
insert into t1 values ('pippo', 12); insert into t1 values ('pippo', 12);
-- error 1062 -- error 1062
insert into t1 values ('pippo', 12); # Gives error insert into t1 values ('pippo', 12); # Gives error
...@@ -167,12 +167,12 @@ set autocommit=1; ...@@ -167,12 +167,12 @@ set autocommit=1;
# The following simple tests failed at some point # The following simple tests failed at some point
# #
CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=innobase; CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) TYPE=innodb;
INSERT INTO t1 VALUES (1, 'Jochen'); INSERT INTO t1 VALUES (1, 'Jochen');
select * from t1; select * from t1;
drop table t1; drop table t1;
CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=innobase; CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) TYPE=innodb;
set autocommit=0; set autocommit=0;
INSERT INTO t1 SET _userid='marc@anyware.co.uk'; INSERT INTO t1 SET _userid='marc@anyware.co.uk';
COMMIT; COMMIT;
...@@ -191,7 +191,7 @@ CREATE TABLE t1 ( ...@@ -191,7 +191,7 @@ CREATE TABLE t1 (
ref_email varchar(100) DEFAULT '' NOT NULL, ref_email varchar(100) DEFAULT '' NOT NULL,
detail varchar(200), detail varchar(200),
PRIMARY KEY (user_id,ref_email) PRIMARY KEY (user_id,ref_email)
)type=innobase; )type=innodb;
INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
select * from t1 where user_id=10292; select * from t1 where user_id=10292;
...@@ -212,11 +212,11 @@ show index from t1; ...@@ -212,11 +212,11 @@ show index from t1;
drop table t1; drop table t1;
# #
# Test of ALTER TABLE and innobase tables # Test of ALTER TABLE and innodb tables
# #
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
alter table t1 type=innobase; alter table t1 type=innodb;
insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
select * from t1; select * from t1;
update t1 set col2='7' where col1='4'; update t1 set col2='7' where col1='4';
...@@ -228,10 +228,10 @@ select * from t1; ...@@ -228,10 +228,10 @@ select * from t1;
drop table t1; drop table t1;
# #
# INSERT INTO innobase tables # INSERT INTO innodb tables
# #
create table t1 (a int not null , b int, primary key (a)) type = innobase; create table t1 (a int not null , b int, primary key (a)) type = innodb;
create table t2 (a int not null , b int, primary key (a)) type = myisam; create table t2 (a int not null , b int, primary key (a)) type = myisam;
insert into t1 VALUES (1,3) , (2,3), (3,3); insert into t1 VALUES (1,3) , (2,3), (3,3);
select * from t1; select * from t1;
...@@ -255,7 +255,7 @@ CREATE TABLE t1 ( ...@@ -255,7 +255,7 @@ CREATE TABLE t1 (
passwd varchar(32) binary DEFAULT '' NOT NULL, passwd varchar(32) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE ggid (ggid) UNIQUE ggid (ggid)
) TYPE=innobase; ) TYPE=innodb;
insert into t1 (ggid,passwd) values ('test1','xxx'); insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy'); insert into t1 (ggid,passwd) values ('test2','yyy');
...@@ -293,7 +293,7 @@ CREATE TABLE t1 ( ...@@ -293,7 +293,7 @@ CREATE TABLE t1 (
approved datetime, approved datetime,
dummy_primary_key int(11) NOT NULL auto_increment, dummy_primary_key int(11) NOT NULL auto_increment,
PRIMARY KEY (dummy_primary_key) PRIMARY KEY (dummy_primary_key)
) TYPE=innobase; ) TYPE=innodb;
INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
...@@ -313,7 +313,7 @@ CREATE TABLE t1 ( ...@@ -313,7 +313,7 @@ CREATE TABLE t1 (
KEY (id), KEY (id),
KEY parent_id (parent_id), KEY parent_id (parent_id),
KEY level (level) KEY level (level)
) type=innobase; ) type=innodb;
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
INSERT INTO t1 values (179,5,2); INSERT INTO t1 values (179,5,2);
update t1 set parent_id=parent_id+100; update t1 set parent_id=parent_id+100;
...@@ -346,7 +346,7 @@ CREATE TABLE t1 ( ...@@ -346,7 +346,7 @@ CREATE TABLE t1 (
sca_sch_desc varchar(16), sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code), PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic) INDEX sca_pic (sca_pic)
) type = innobase ; ) type = innodb ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
select count(*) from t1 where sca_code = 'PD'; select count(*) from t1 where sca_code = 'PD';
...@@ -368,7 +368,7 @@ drop table t1; ...@@ -368,7 +368,7 @@ drop table t1;
# Test of opening table twice and timestamps # Test of opening table twice and timestamps
# #
set @a:=now(); set @a:=now();
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=innobase; CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) type=innodb;
insert into t1 (a) values(1),(2),(3); insert into t1 (a) values(1),(2),(3);
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
update t1 set a=5 where a=1; update t1 set a=5 where a=1;
...@@ -378,7 +378,7 @@ drop table t1; ...@@ -378,7 +378,7 @@ drop table t1;
# #
# Test with variable length primary key # Test with variable length primary key
# #
create table t1 (a varchar(100) not null, primary key(a), b int not null) type=innobase; create table t1 (a varchar(100) not null, primary key(a), b int not null) type=innodb;
insert into t1 values("hello",1),("world",2); insert into t1 values("hello",1),("world",2);
select * from t1 order by b desc; select * from t1 order by b desc;
optimize table t1; optimize table t1;
...@@ -388,7 +388,7 @@ drop table t1; ...@@ -388,7 +388,7 @@ drop table t1;
# #
# Test of create index with NULL columns # Test of create index with NULL columns
# #
create table t1 (i int, j int ) TYPE=innobase; create table t1 (i int, j int ) TYPE=innodb;
insert into t1 values (1,2); insert into t1 values (1,2);
select * from t1 where i=1 and j=2; select * from t1 where i=1 and j=2;
create index ax1 on t1 (i,j); create index ax1 on t1 (i,j);
...@@ -403,17 +403,29 @@ CREATE TABLE t1 ( ...@@ -403,17 +403,29 @@ CREATE TABLE t1 (
a int3 unsigned NOT NULL, a int3 unsigned NOT NULL,
b int1 unsigned NOT NULL, b int1 unsigned NOT NULL,
UNIQUE (a, b) UNIQUE (a, b)
) TYPE = innobase; ) TYPE = innodb;
INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (1, 1);
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
drop table t1; drop table t1;
#
# Test INSERT DELAYED
#
CREATE TABLE t1 (a int unsigned NOT NULL) type=innodb;
--error 1031
INSERT DELAYED INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
DROP TABLE t1;
# #
# Crash when using many tables (Test case by Jeremy D Zawodny) # Crash when using many tables (Test case by Jeremy D Zawodny)
# #
create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = Innobase; create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb;
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
explain select * from t1 where a > 0 and a < 50; explain select * from t1 where a > 0 and a < 50;
drop table t1; drop table t1;
...@@ -8,10 +8,12 @@ use Getopt::Long; ...@@ -8,10 +8,12 @@ use Getopt::Long;
$opt_help=$opt_version=$opt_verbose=$opt_force=0; $opt_help=$opt_version=$opt_verbose=$opt_force=0;
$opt_user=$opt_database=$opt_password=undef; $opt_user=$opt_database=$opt_password=undef;
$opt_host="localhost"; $opt_host="localhost";
$opt_socket="";
$opt_type="MYISAM"; $opt_type="MYISAM";
$opt_port=0;
$exit_status=0; $exit_status=0;
GetOptions("force","help","host=s","password=s","user=s","type=s","verbose","version") || GetOptions("force","help","host=s","password=s","user=s","type=s","verbose","version","socket=s", "port=i") ||
usage(0); usage(0);
usage($opt_version) if ($#ARGV < 0 || $opt_help || $opt_version); usage($opt_version) if ($#ARGV < 0 || $opt_help || $opt_version);
$opt_database=shift(@ARGV); $opt_database=shift(@ARGV);
...@@ -22,7 +24,17 @@ if (uc($opt_type) eq "HEAP") ...@@ -22,7 +24,17 @@ if (uc($opt_type) eq "HEAP")
exit(1); exit(1);
} }
$dbh = DBI->connect("DBI:mysql:$opt_database:$opt_host", $connect_opt="";
if ($opt_port)
{
$connect_opt.= ";port=$opt_port";
}
if (length($opt_socket))
{
$connect_opt.=";mysql_socket=$opt_socket";
}
$dbh = DBI->connect("DBI:mysql:$opt_database:${opt_host}$connect_opt",
$opt_user, $opt_user,
$opt_password, $opt_password,
{ PrintError => 0}) { PrintError => 0})
...@@ -96,6 +108,12 @@ Conversion of a MySQL tables to other table types. ...@@ -96,6 +108,12 @@ Conversion of a MySQL tables to other table types.
--password='password' --password='password'
Password for the current user. Password for the current user.
--port=port
TCP/IP port to connect to if host is not "localhost".
--socket='/path/to/socket'
Socket to connect with.
--type='table-type' --type='table-type'
Converts tables to the given table type (Default: $opt_type) Converts tables to the given table type (Default: $opt_type)
MySQL 3.23 supports at least the BDB, ISAM and MYISAM types. MySQL 3.23 supports at least the BDB, ISAM and MYISAM types.
......
...@@ -35,6 +35,9 @@ Innobase */ ...@@ -35,6 +35,9 @@ Innobase */
#define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1)) #define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1))
/* The following must be declared here so that we can handle SAFE_MUTEX */
pthread_mutex_t innobase_mutex;
#include "ha_innobase.h" #include "ha_innobase.h"
/* Store MySQL definition of 'byte': in Linux it is char while Innobase /* Store MySQL definition of 'byte': in Linux it is char while Innobase
...@@ -42,6 +45,9 @@ uses unsigned char */ ...@@ -42,6 +45,9 @@ uses unsigned char */
typedef byte mysql_byte; typedef byte mysql_byte;
#define INSIDE_HA_INNOBASE_CC #define INSIDE_HA_INNOBASE_CC
#ifdef SAFE_MUTEX
#undef pthread_mutex_t
#endif
/* Include necessary Innobase headers */ /* Include necessary Innobase headers */
extern "C" { extern "C" {
...@@ -91,8 +97,6 @@ ulong innobase_active_counter = 0; ...@@ -91,8 +97,6 @@ ulong innobase_active_counter = 0;
char* innobase_home = NULL; char* innobase_home = NULL;
pthread_mutex_t innobase_mutex;
static HASH innobase_open_tables; static HASH innobase_open_tables;
static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length, static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length,
...@@ -2601,14 +2605,19 @@ ha_innobase::update_table_comment( ...@@ -2601,14 +2605,19 @@ ha_innobase::update_table_comment(
{ {
uint length=strlen(comment); uint length=strlen(comment);
char *str=my_malloc(length + 100,MYF(0)); char *str=my_malloc(length + 100,MYF(0)), *pos;
if (!str) if (!str)
return (char*)comment; return (char*)comment;
sprintf(str, pos=str;
"%s; Innobase free: %lu kB", if (length)
comment, (ulong) innobase_get_free_space()); {
pos=strmov(str,comment);
*pos++=';';
*pos++=' ';
}
sprintf(pos, "Innobase free: %lu kB", (ulong) innobase_get_free_space());
return(str); return(str);
} }
......
...@@ -437,7 +437,7 @@ static void close_connections(void) ...@@ -437,7 +437,7 @@ static void close_connections(void)
#ifdef __NT__ #ifdef __NT__
if ( hPipe != INVALID_HANDLE_VALUE ) if ( hPipe != INVALID_HANDLE_VALUE )
{ {
HANDLE hTempPipe = hPipe; HANDLE hTempPipe = &hPipe;
DBUG_PRINT( "quit", ("Closing named pipes") ); DBUG_PRINT( "quit", ("Closing named pipes") );
hPipe = INVALID_HANDLE_VALUE; hPipe = INVALID_HANDLE_VALUE;
CancelIo( hTempPipe ); CancelIo( hTempPipe );
......
...@@ -225,7 +225,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, ...@@ -225,7 +225,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
break; break;
} }
} }
if (lock_type == TL_WRITE_DELAYED && ! table->file->has_transactions()) if (lock_type == TL_WRITE_DELAYED)
{ {
error=write_delayed(thd,table,duplic,query, thd->query_length, log_on); error=write_delayed(thd,table,duplic,query, thd->query_length, log_on);
query=0; query=0;
...@@ -888,6 +888,7 @@ static pthread_handler_decl(handle_delayed_insert,arg) ...@@ -888,6 +888,7 @@ static pthread_handler_decl(handle_delayed_insert,arg)
my_pthread_setspecific_ptr(THR_THD, thd) || my_pthread_setspecific_ptr(THR_THD, thd) ||
my_pthread_setspecific_ptr(THR_NET, &thd->net)) my_pthread_setspecific_ptr(THR_NET, &thd->net))
{ {
thd->fatal_error=1;
strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES)); strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES));
goto end; goto end;
} }
...@@ -906,6 +907,12 @@ static pthread_handler_decl(handle_delayed_insert,arg) ...@@ -906,6 +907,12 @@ static pthread_handler_decl(handle_delayed_insert,arg)
thd->fatal_error=1; // Abort waiting inserts thd->fatal_error=1; // Abort waiting inserts
goto end; goto end;
} }
if (di->table->file->has_transactions())
{
thd->fatal_error=1;
my_error(ER_ILLEGAL_HA, MYF(0), di->table_list->real_name);
goto end;
}
di->table->copy_blobs=1; di->table->copy_blobs=1;
/* One can now use this */ /* One can now use this */
......
...@@ -35,10 +35,28 @@ ...@@ -35,10 +35,28 @@
#endif #endif
#include "mysql_priv.h" #include "mysql_priv.h"
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
extern "C" extern "C"
{ {
#if defined(__WIN__)
void* dlsym(void* lib,const char* name)
{
return GetProcAddress((HMODULE)lib,name);
}
void* dlopen(const char* libname,int unused)
{
return LoadLibraryEx(libname,NULL,0);
}
void dlclose(void* lib)
{
FreeLibrary((HMODULE)lib);
}
#else
#include <dlfcn.h> #include <dlfcn.h>
#endif
#include <stdarg.h> #include <stdarg.h>
#include <hash.h> #include <hash.h>
} }
...@@ -62,6 +80,7 @@ static udf_func *add_udf(char *name, Item_result ret, char *dl, ...@@ -62,6 +80,7 @@ static udf_func *add_udf(char *name, Item_result ret, char *dl,
static void del_udf(udf_func *udf); static void del_udf(udf_func *udf);
static void *find_udf_dl(const char *dl); static void *find_udf_dl(const char *dl);
static void init_syms(udf_func *tmp) static void init_syms(udf_func *tmp)
{ {
char nm[MAX_FIELD_NAME+16],*end; char nm[MAX_FIELD_NAME+16],*end;
...@@ -232,7 +251,7 @@ static void del_udf(udf_func *udf) ...@@ -232,7 +251,7 @@ static void del_udf(udf_func *udf)
uint name_length=udf->name_length; uint name_length=udf->name_length;
udf->name=(char*) "*"; udf->name=(char*) "*";
udf->name_length=1; udf->name_length=1;
hash_update(&udf_hash,(byte*) udf,name,name_length); hash_update(&udf_hash,(byte*) udf,(byte*) name,name_length);
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -262,7 +281,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used) ...@@ -262,7 +281,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
/* TODO: This should be changed to reader locks someday! */ /* TODO: This should be changed to reader locks someday! */
pthread_mutex_lock(&THR_LOCK_udf); pthread_mutex_lock(&THR_LOCK_udf);
udf=(udf_func*) hash_search(&udf_hash,name, udf=(udf_func*) hash_search(&udf_hash,(byte*) name,
length ? length : (uint) strlen(name)); length ? length : (uint) strlen(name));
if (mark_used) if (mark_used)
udf->usage_count++; udf->usage_count++;
...@@ -304,7 +323,7 @@ static udf_func *add_udf(char *name, Item_result ret, char *dl, ...@@ -304,7 +323,7 @@ static udf_func *add_udf(char *name, Item_result ret, char *dl,
tmp->returns = ret; tmp->returns = ret;
tmp->type = type; tmp->type = type;
tmp->usage_count=1; tmp->usage_count=1;
if (hash_insert(&udf_hash,(char*) tmp)) if (hash_insert(&udf_hash,(byte*) tmp))
return 0; return 0;
using_udf_functions=1; using_udf_functions=1;
return tmp; return tmp;
...@@ -344,7 +363,7 @@ int mysql_create_function(THD *thd,udf_func *udf) ...@@ -344,7 +363,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
} }
pthread_mutex_lock(&THR_LOCK_udf); pthread_mutex_lock(&THR_LOCK_udf);
if (hash_search(&udf_hash,udf->name, udf->name_length)) if (hash_search(&udf_hash,(byte*) udf->name, udf->name_length))
{ {
net_printf(&thd->net, ER_UDF_EXISTS, udf->name); net_printf(&thd->net, ER_UDF_EXISTS, udf->name);
goto err; goto err;
...@@ -430,7 +449,7 @@ int mysql_drop_function(THD *thd,const char *udf_name) ...@@ -430,7 +449,7 @@ int mysql_drop_function(THD *thd,const char *udf_name)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
pthread_mutex_lock(&THR_LOCK_udf); pthread_mutex_lock(&THR_LOCK_udf);
if (!(udf=(udf_func*) hash_search(&udf_hash,udf_name, (uint) strlen(udf_name)))) if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name, (uint) strlen(udf_name))))
{ {
net_printf(&thd->net, ER_FUNCTION_NOT_DEFINED, udf_name); net_printf(&thd->net, ER_FUNCTION_NOT_DEFINED, udf_name);
goto err; goto err;
......
...@@ -428,15 +428,11 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date) ...@@ -428,15 +428,11 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
uint field_length,year_length,digits,i,number_of_fields,date[7]; uint field_length,year_length,digits,i,number_of_fields,date[7];
bool date_used=0; bool date_used=0;
const char *pos; const char *pos;
const char *end=str+length;
DBUG_ENTER("str_to_TIME"); DBUG_ENTER("str_to_TIME");
DBUG_PRINT("enter",("str: %.*s",length,str)); DBUG_PRINT("enter",("str: %.*s",length,str));
if(!str) for (; str != end && !isdigit(*str) ; str++) ; // Skipp garbage
DBUG_RETURN(TIMESTAMP_NONE);
const char *end=str+length;
for (; !isdigit(*str) && str != end ; str++) ; // Skip garbage
if (str == end) if (str == end)
DBUG_RETURN(TIMESTAMP_NONE); DBUG_RETURN(TIMESTAMP_NONE);
/* /*
...@@ -562,7 +558,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time) ...@@ -562,7 +558,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
uint state; uint state;
l_time->neg=0; l_time->neg=0;
for (; !isdigit(*str) && *str != '-' && str != end ; str++) for (; str != end && !isdigit(*str) && *str != '-' ; str++)
length--; length--;
if (str != end && *str == '-') if (str != end && *str == '-')
{ {
......
...@@ -598,7 +598,6 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape, ...@@ -598,7 +598,6 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape,
const char *end=ptr+ptr_length; const char *end=ptr+ptr_length;
char *min_org=min_str; char *min_org=min_str;
char *min_end=min_str+res_length; char *min_end=min_str+res_length;
char *tmp;
for (; ptr != end && min_str != min_end ; ptr++) for (; ptr != end && min_str != min_end ; ptr++)
{ {
...@@ -628,10 +627,6 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape, ...@@ -628,10 +627,6 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape,
} }
*min_length= *max_length = (uint) (min_str - min_org); *min_length= *max_length = (uint) (min_str - min_org);
/* Temporary fix for handling wild_one at end of string (key compression) */
// for (tmp= min_str ; tmp > min_org && tmp[-1] == '\0';)
// *--tmp=' ';
while (min_str != min_end) while (min_str != min_end)
*min_str++ = *max_str++ = ' '; // Because if key compression *min_str++ = *max_str++ = ' '; // Because if key compression
return 0; return 0;
......
...@@ -257,31 +257,6 @@ fi ...@@ -257,31 +257,6 @@ fi
%attr(755, root, root) /usr/share/mysql/ %attr(755, root, root) /usr/share/mysql/
%files client
%attr(755, root, root) /usr/bin/msql2mysql
%attr(755, root, root) /usr/bin/mysql
%attr(755, root, root) /usr/bin/mysqlaccess
%attr(755, root, root) /usr/bin/mysqladmin
%attr(755, root, root) /usr/bin/mysql_find_rows
%attr(755, root, root) /usr/bin/mysqldump
%attr(755, root, root) /usr/bin/mysqlimport
%attr(755, root, root) /usr/bin/mysqlshow
%attr(755, root, root) /usr/bin/mysqlbinlog
%attr(644, root, man) %doc /usr/man/man1/mysql.1*
%attr(644, root, man) %doc /usr/man/man1/isamchk.1*
%attr(644, root, man) %doc /usr/man/man1/isamlog.1*
%attr(644, root, man) %doc /usr/man/man1/mysql_zap.1*
%attr(644, root, man) %doc /usr/man/man1/mysqlaccess.1*
%attr(644, root, man) %doc /usr/man/man1/mysqladmin.1*
%attr(644, root, man) %doc /usr/man/man1/mysqld.1*
%attr(644, root, man) %doc /usr/man/man1/mysqld_multi.1*
%attr(644, root, man) %doc /usr/man/man1/mysqldump.1*
%attr(644, root, man) %doc /usr/man/man1/mysqlshow.1*
%attr(644, root, man) %doc /usr/man/man1/perror.1*
%attr(644, root, man) %doc /usr/man/man1/replace.1*
%attr(644, root, man) %doc /usr/man/man1/safe_mysqld.1*
%changelog %changelog
* 2000-04-01 Monty * 2000-04-01 Monty
......
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