Commit 4b1a877b authored by Sinisa@sinisa.nasamreza.org's avatar Sinisa@sinisa.nasamreza.org

Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.0

into sinisa.nasamreza.org:/mnt/work/mysql-4.0
parents 15f26dd5 6c033b98
......@@ -2213,11 +2213,11 @@ Storage: same as TINYINT.
@strong{DATE}
@itemize @bullet
@item
Storage: fixed-length series of binary integers, always three bytes
long.
Storage: 3 byte integer, low byte first.
Packed as: 'day + month*32 + year*16*32'
@item
Example: a DATE column containing '0001-01-01' looks like:@*
@code{hexadecimal 21 02 00}
Example: a DATE column containing '1962-01-02' looks like:@*
@code{hexadecimal 22 54 0F}
@end itemize
@strong{DATETIME}
......@@ -2236,16 +2236,19 @@ Example: a DATETIME column for '0001-01-01 01:01:01' looks like:@*
@strong{TIME}
@itemize @bullet
@item
Storage: a value offset from 8385959, always three bytes long.
Storage: 3 bytes, low byte first.
This is stored as seconds: days*24*3600+hours*3600+minutes*60+seconds
@item
Example: a TIME column containing '01:01:01' looks like:@*
@code{hexadecimal 75 27 00}
Example: a TIME column containing '1 02:03:04' (1 day 2 hour 3 minutes and 4 seconds) looks like:@*
@code{hexadecimal 58 6E 01}
@end itemize
@strong{TIMESTAMP}
@itemize @bullet
@item
Storage: four bytes long (NOTE TO SELF: not figured out)
Storage: 4 bytes, low byte first.
Stored as unix @code{time()}, which is seconds since the Epoch
(00:00:00 UTC, January 1, 1970).
@item
Example: a TIMESTAMP column containing '2003-01-01 01:01:01' looks like:@*
@code{hexadecimal 4D AE 12 23}
......
......@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>
const char *VER= "12.19";
const char *VER= "12.20";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
......@@ -919,6 +919,7 @@ static bool add_line(String &buffer,char *line,char *in_string)
uchar inchar;
char buff[80],*pos,*out;
COMMANDS *com;
my_bool in_comment= 0;
if (!line[0] && buffer.is_empty())
return 0;
......@@ -978,7 +979,7 @@ static bool add_line(String &buffer,char *line,char *in_string)
continue;
}
}
else if (inchar == ';' && !*in_string)
else if (inchar == ';' && !*in_string && !in_comment)
{ // ';' is end of command
if (out != line)
buffer.append(line,(uint) (out-line)); // Add this line
......@@ -1009,6 +1010,13 @@ static bool add_line(String &buffer,char *line,char *in_string)
else if (!*in_string && (inchar == '\'' || inchar == '"'))
*in_string=(char) inchar;
*out++ = (char) inchar;
if (inchar == '*' && !*in_string)
{
if (pos != line && pos[-1] == '/')
in_comment= 1;
else if (in_comment && pos[1] == '/')
in_comment= 0;
}
}
}
if (out != line || !buffer.is_empty())
......
......@@ -22,17 +22,13 @@
#include <errno.h>
#include <screen.h>
#include <limits.h>
#include <nks/synch.h>
#include <nks/thread.h>
#include <signal.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <nks/errno.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <nks/time.h>
#include <pthread.h>
#include <termios.h>
......@@ -48,6 +44,9 @@
#define HAVE_PTHREAD_YIELD_ZERO_ARG 1
#define HAVE_BROKEN_REALPATH 1
/* include the old function apis */
#define USE_OLD_FUNCTIONS 1
/* no case sensitivity */
#define FN_NO_CASE_SENCE 1
......
......@@ -366,14 +366,18 @@ typedef struct st_sort_info
SORT_KEY_BLOCKS *key_block,*key_block_end;
/* sync things*/
uint got_error, threads_running;
#ifdef THREAD
pthread_mutex_t mutex;
pthread_cond_t cond;
#endif
} SORT_INFO;
typedef struct st_mi_sort_param
{
#ifdef THREAD
pthread_t thr;
#endif
IO_CACHE read_cache, tempfile, tempfile_for_exceptions;
DYNAMIC_ARRAY buffpek;
ulonglong unique[MI_MAX_KEY_SEG+1];
......
......@@ -2109,7 +2109,7 @@ err:
Threaded repair of table using sorting
SYNOPSIS
mi_repair_by_sort_r()
mi_repair_parallel()
param Repair parameters
info MyISAM handler to repair
name Name of table (for warnings)
......@@ -2128,6 +2128,9 @@ err:
int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
const char * name, int rep_quick)
{
#ifndef THREAD
return mi_repair_by_sort(param, info, name, rep_quick);
#else
int got_error;
uint i,key, total_key_length, istep;
ulong rec_length;
......@@ -2489,6 +2492,7 @@ err:
share->pack.header_length=0;
}
DBUG_RETURN(got_error);
#endif /* THREAD */
}
/* Read next record and return next key */
......
......@@ -275,6 +275,7 @@ static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys,
} /* find_all_keys */
#ifdef THREAD
/* Search after all keys and place them in a temp. file */
pthread_handler_decl(thr_find_all_keys,arg)
......@@ -542,6 +543,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
my_free((gptr) mergebuf,MYF(MY_ALLOW_ZERO_PTR));
return got_error;
}
#endif /* THREAD */
/* Write all keys in memory to file for later merge */
......
drop table if exists t1;
CREATE TABLE t1 (
ChargeID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
ChargeID int(10) unsigned NOT NULL auto_increment,
ServiceID int(10) unsigned DEFAULT '0' NOT NULL,
ChargeDate date DEFAULT '0000-00-00' NOT NULL,
ChargeAmount decimal(20,2) DEFAULT '0.00' NOT NULL,
......
......@@ -148,3 +148,26 @@ select * from t1;
if('2002'='2002','Y','N')
Y
drop table if exists t1;
SET SESSION table_type="heap";
SELECT @@table_type;
@@table_type
HEAP
CREATE TABLE t1 (a int not null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) TYPE=HEAP
drop table t1;
SET SESSION table_type="gemini";
SELECT @@table_type;
@@table_type
GEMINI
CREATE TABLE t1 (a int not null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM
SET SESSION table_type=default;
drop table t1;
......@@ -11,7 +11,7 @@ INSERT INTO t1 VALUES (2,2,2,'','0000-00-00');
INSERT INTO t1 VALUES (2,1,1,'','0000-00-00');
INSERT INTO t1 VALUES (3,3,3,'','0000-00-00');
CREATE TABLE t2 (
userID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
userID int(10) unsigned NOT NULL auto_increment,
niName char(15),
passwd char(8),
mail char(50),
......@@ -51,7 +51,7 @@ userid MIN(t1.score+0.0)
2 2.0
drop table test.t1,test.t2;
CREATE TABLE t1 (
PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
PID int(10) unsigned NOT NULL auto_increment,
payDate date DEFAULT '0000-00-00' NOT NULL,
recDate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
URID int(10) unsigned DEFAULT '0' NOT NULL,
......@@ -74,7 +74,7 @@ SELECT COUNT(P.URID),SUM(P.amount),P.method, MIN(PP.recdate+0) > 19980501000000
Can't group on 'IsNew'
drop table t1;
CREATE TABLE t1 (
cid mediumint(9) DEFAULT '0' NOT NULL auto_increment,
cid mediumint(9) NOT NULL auto_increment,
firstname varchar(32) DEFAULT '' NOT NULL,
surname varchar(32) DEFAULT '' NOT NULL,
PRIMARY KEY (cid)
......@@ -82,7 +82,7 @@ PRIMARY KEY (cid)
INSERT INTO t1 VALUES (1,'That','Guy');
INSERT INTO t1 VALUES (2,'Another','Gent');
CREATE TABLE t2 (
call_id mediumint(8) DEFAULT '0' NOT NULL auto_increment,
call_id mediumint(8) NOT NULL auto_increment,
contact_id mediumint(8) DEFAULT '0' NOT NULL,
PRIMARY KEY (call_id),
KEY contact_id (contact_id)
......@@ -102,7 +102,7 @@ cid CONCAT(firstname, ' ', surname) COUNT(call_id)
drop table t1,t2;
unlock tables;
CREATE TABLE t1 (
bug_id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
bug_id mediumint(9) NOT NULL auto_increment,
groupset bigint(20) DEFAULT '0' NOT NULL,
assigned_to mediumint(9) DEFAULT '0' NOT NULL,
bug_file_loc text,
......
......@@ -235,7 +235,7 @@ INSERT INTO t2 VALUES (11410,11410,131,0);
INSERT INTO t2 VALUES (11416,11416,32767,0);
INSERT INTO t2 VALUES (11409,0,0,0);
CREATE TABLE t3 (
id int(11) DEFAULT '0' NOT NULL auto_increment,
id int(11) NOT NULL auto_increment,
dni_pasaporte char(16) DEFAULT '' NOT NULL,
idPla int(11) DEFAULT '0' NOT NULL,
cod_asig int(11) DEFAULT '0' NOT NULL,
......@@ -248,7 +248,7 @@ UNIQUE dni_pasaporte_2 (dni_pasaporte,idPla,cod_asig,any,quatrimestre)
);
INSERT INTO t3 VALUES (1,'11111111',1,10362,98,1,'M');
CREATE TABLE t4 (
id int(11) DEFAULT '0' NOT NULL auto_increment,
id int(11) NOT NULL auto_increment,
papa int(11) DEFAULT '0' NOT NULL,
fill int(11) DEFAULT '0' NOT NULL,
idPla int(11) DEFAULT '0' NOT NULL,
......@@ -285,7 +285,7 @@ fill idPla
10362 NULL
drop table t1,t2,t3,test.t4;
CREATE TABLE t1 (
id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
id smallint(5) unsigned NOT NULL auto_increment,
name char(60) DEFAULT '' NOT NULL,
PRIMARY KEY (id)
);
......@@ -293,7 +293,7 @@ INSERT INTO t1 VALUES (1,'Antonio Paz');
INSERT INTO t1 VALUES (2,'Lilliana Angelovska');
INSERT INTO t1 VALUES (3,'Thimble Smith');
CREATE TABLE t2 (
id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
id smallint(5) unsigned NOT NULL auto_increment,
owner smallint(5) unsigned DEFAULT '0' NOT NULL,
name char(60),
PRIMARY KEY (id)
......@@ -383,15 +383,15 @@ id str
2 NULL
drop table t1;
CREATE TABLE t1 (
t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t1_id bigint(21) NOT NULL auto_increment,
PRIMARY KEY (t1_id)
);
CREATE TABLE t2 (
t2_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t2_id bigint(21) NOT NULL auto_increment,
PRIMARY KEY (t2_id)
);
CREATE TABLE t3 (
t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t3_id bigint(21) NOT NULL auto_increment,
PRIMARY KEY (t3_id)
);
CREATE TABLE t4 (
......
......@@ -15,7 +15,7 @@ INSERT INTO t1 VALUES (2,6,'60671515','Y');
INSERT INTO t1 VALUES (2,7,'60671569','Y');
INSERT INTO t1 VALUES (2,3,'dd','Y');
CREATE TABLE t2 (
id int(6) DEFAULT '0' NOT NULL auto_increment,
id int(6) NOT NULL auto_increment,
description varchar(40) NOT NULL,
idform varchar(40),
ordre int(6) unsigned DEFAULT '0' NOT NULL,
......
......@@ -564,3 +564,15 @@ show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
drop table t1;
drop table if exists t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
select * from t1 into outfile "query_caceh.out.file";
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
drop table t1;
......@@ -315,7 +315,7 @@ Incorrect sub part key. The used key part isn't a string, the used length is lon
create table t1 (a text, key (a(255)));
drop table t1;
CREATE TABLE t1 (
t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t1_id bigint(21) NOT NULL auto_increment,
_field_72 varchar(128) DEFAULT '' NOT NULL,
_field_95 varchar(32),
_field_115 tinyint(4) DEFAULT '0' NOT NULL,
......@@ -339,7 +339,7 @@ INSERT INTO t2 VALUES (1,1);
INSERT INTO t2 VALUES (2,1);
INSERT INTO t2 VALUES (2,2);
CREATE TABLE t3 (
t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t3_id bigint(21) NOT NULL auto_increment,
_field_131 varchar(128),
_field_133 tinyint(4) DEFAULT '0' NOT NULL,
_field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
......@@ -367,7 +367,7 @@ PRIMARY KEY (seq_0_id,seq_1_id)
INSERT INTO t4 VALUES (1,1);
INSERT INTO t4 VALUES (2,1);
CREATE TABLE t5 (
t5_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t5_id bigint(21) NOT NULL auto_increment,
_field_149 tinyint(4),
_field_156 varchar(128) DEFAULT '' NOT NULL,
_field_157 varchar(128) DEFAULT '' NOT NULL,
......@@ -394,7 +394,7 @@ INSERT INTO t6 VALUES (1,1);
INSERT INTO t6 VALUES (1,2);
INSERT INTO t6 VALUES (2,2);
CREATE TABLE t7 (
t7_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t7_id bigint(21) NOT NULL auto_increment,
_field_143 tinyint(4),
_field_165 varchar(32),
_field_166 smallint(6) DEFAULT '0' NOT NULL,
......
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) DEFAULT '0' NOT NULL auto_increment,
id int(11) NOT NULL auto_increment,
datatype_id int(11) DEFAULT '0' NOT NULL,
minvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
maxvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
......
drop table if exists t1,t2,t3;
CREATE TABLE t1 (
auto int(5) unsigned DEFAULT 0 NOT NULL auto_increment,
auto int(5) unsigned NOT NULL auto_increment,
string char(10) default "hello",
tiny tinyint(4) DEFAULT '0' NOT NULL ,
short smallint(6) DEFAULT '1' NOT NULL ,
......@@ -129,7 +129,7 @@ auto new_field new_blob_col date_field
15 new 4294967295 0000-00-00
16 new NULL NULL
CREATE TABLE t2 (
auto int(5) unsigned NOT NULL DEFAULT 0 auto_increment,
auto int(5) unsigned NOT NULL auto_increment,
string char(20),
mediumblob_col mediumblob not null,
new_field char(2),
......
......@@ -96,7 +96,7 @@ KEY k4 (assignment),
KEY ticket (ticket)
) TYPE=MyISAM;
INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');
alter table t1 change lfdnr lfdnr int(10) unsigned default 0 not null auto_increment;
alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment;
update t1 set status=1 where type='Open';
select status from t1;
status
......
......@@ -4,7 +4,7 @@
drop table if exists t1;
CREATE TABLE t1 (
ChargeID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
ChargeID int(10) unsigned NOT NULL auto_increment,
ServiceID int(10) unsigned DEFAULT '0' NOT NULL,
ChargeDate date DEFAULT '0000-00-00' NOT NULL,
ChargeAmount decimal(20,2) DEFAULT '0.00' NOT NULL,
......
......@@ -102,3 +102,20 @@ drop table t1;
create table t1 select if('2002'='2002','Y','N');
select * from t1;
drop table if exists t1;
#
# Test default table type
#
SET SESSION table_type="heap";
SELECT @@table_type;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
# Test what happens when using a non existing table type
SET SESSION table_type="gemini";
SELECT @@table_type;
CREATE TABLE t1 (a int not null);
show create table t1;
SET SESSION table_type=default;
drop table t1;
......@@ -17,7 +17,7 @@ INSERT INTO t1 VALUES (2,1,1,'','0000-00-00');
INSERT INTO t1 VALUES (3,3,3,'','0000-00-00');
CREATE TABLE t2 (
userID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
userID int(10) unsigned NOT NULL auto_increment,
niName char(15),
passwd char(8),
mail char(50),
......@@ -47,7 +47,7 @@ drop table test.t1,test.t2;
#
CREATE TABLE t1 (
PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
PID int(10) unsigned NOT NULL auto_increment,
payDate date DEFAULT '0000-00-00' NOT NULL,
recDate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
URID int(10) unsigned DEFAULT '0' NOT NULL,
......@@ -79,7 +79,7 @@ drop table t1;
#
CREATE TABLE t1 (
cid mediumint(9) DEFAULT '0' NOT NULL auto_increment,
cid mediumint(9) NOT NULL auto_increment,
firstname varchar(32) DEFAULT '' NOT NULL,
surname varchar(32) DEFAULT '' NOT NULL,
PRIMARY KEY (cid)
......@@ -88,7 +88,7 @@ INSERT INTO t1 VALUES (1,'That','Guy');
INSERT INTO t1 VALUES (2,'Another','Gent');
CREATE TABLE t2 (
call_id mediumint(8) DEFAULT '0' NOT NULL auto_increment,
call_id mediumint(8) NOT NULL auto_increment,
contact_id mediumint(8) DEFAULT '0' NOT NULL,
PRIMARY KEY (call_id),
KEY contact_id (contact_id)
......@@ -114,7 +114,7 @@ unlock tables;
#
CREATE TABLE t1 (
bug_id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
bug_id mediumint(9) NOT NULL auto_increment,
groupset bigint(20) DEFAULT '0' NOT NULL,
assigned_to mediumint(9) DEFAULT '0' NOT NULL,
bug_file_loc text,
......
......@@ -168,7 +168,7 @@ INSERT INTO t2 VALUES (11416,11416,32767,0);
INSERT INTO t2 VALUES (11409,0,0,0);
CREATE TABLE t3 (
id int(11) DEFAULT '0' NOT NULL auto_increment,
id int(11) NOT NULL auto_increment,
dni_pasaporte char(16) DEFAULT '' NOT NULL,
idPla int(11) DEFAULT '0' NOT NULL,
cod_asig int(11) DEFAULT '0' NOT NULL,
......@@ -183,7 +183,7 @@ CREATE TABLE t3 (
INSERT INTO t3 VALUES (1,'11111111',1,10362,98,1,'M');
CREATE TABLE t4 (
id int(11) DEFAULT '0' NOT NULL auto_increment,
id int(11) NOT NULL auto_increment,
papa int(11) DEFAULT '0' NOT NULL,
fill int(11) DEFAULT '0' NOT NULL,
idPla int(11) DEFAULT '0' NOT NULL,
......@@ -210,7 +210,7 @@ drop table t1,t2,t3,test.t4;
#
CREATE TABLE t1 (
id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
id smallint(5) unsigned NOT NULL auto_increment,
name char(60) DEFAULT '' NOT NULL,
PRIMARY KEY (id)
);
......@@ -219,7 +219,7 @@ INSERT INTO t1 VALUES (2,'Lilliana Angelovska');
INSERT INTO t1 VALUES (3,'Thimble Smith');
CREATE TABLE t2 (
id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment,
id smallint(5) unsigned NOT NULL auto_increment,
owner smallint(5) unsigned DEFAULT '0' NOT NULL,
name char(60),
PRIMARY KEY (id)
......@@ -257,15 +257,15 @@ drop table t1;
#
CREATE TABLE t1 (
t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t1_id bigint(21) NOT NULL auto_increment,
PRIMARY KEY (t1_id)
);
CREATE TABLE t2 (
t2_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t2_id bigint(21) NOT NULL auto_increment,
PRIMARY KEY (t2_id)
);
CREATE TABLE t3 (
t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t3_id bigint(21) NOT NULL auto_increment,
PRIMARY KEY (t3_id)
);
CREATE TABLE t4 (
......
......@@ -23,7 +23,7 @@ INSERT INTO t1 VALUES (2,7,'60671569','Y');
INSERT INTO t1 VALUES (2,3,'dd','Y');
CREATE TABLE t2 (
id int(6) DEFAULT '0' NOT NULL auto_increment,
id int(6) NOT NULL auto_increment,
description varchar(40) NOT NULL,
idform varchar(40),
ordre int(6) unsigned DEFAULT '0' NOT NULL,
......
......@@ -407,3 +407,16 @@ show status like "Qcache_queries_in_cache";
load data infile '../../std_data/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
drop table t1;
#
# INTO OUTFILE/DUMPFILE test
#
drop table if exists t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
show status like "Qcache_queries_in_cache";
select * from t1 into outfile "query_caceh.out.file";
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
show status like "Qcache_queries_in_cache";
drop table t1;
\ No newline at end of file
......@@ -96,7 +96,7 @@ drop table t1;
#
CREATE TABLE t1 (
t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t1_id bigint(21) NOT NULL auto_increment,
_field_72 varchar(128) DEFAULT '' NOT NULL,
_field_95 varchar(32),
_field_115 tinyint(4) DEFAULT '0' NOT NULL,
......@@ -127,7 +127,7 @@ INSERT INTO t2 VALUES (2,1);
INSERT INTO t2 VALUES (2,2);
CREATE TABLE t3 (
t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t3_id bigint(21) NOT NULL auto_increment,
_field_131 varchar(128),
_field_133 tinyint(4) DEFAULT '0' NOT NULL,
_field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
......@@ -162,7 +162,7 @@ INSERT INTO t4 VALUES (1,1);
INSERT INTO t4 VALUES (2,1);
CREATE TABLE t5 (
t5_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t5_id bigint(21) NOT NULL auto_increment,
_field_149 tinyint(4),
_field_156 varchar(128) DEFAULT '' NOT NULL,
_field_157 varchar(128) DEFAULT '' NOT NULL,
......@@ -194,7 +194,7 @@ INSERT INTO t6 VALUES (1,2);
INSERT INTO t6 VALUES (2,2);
CREATE TABLE t7 (
t7_id bigint(21) DEFAULT '0' NOT NULL auto_increment,
t7_id bigint(21) NOT NULL auto_increment,
_field_143 tinyint(4),
_field_165 varchar(32),
_field_166 smallint(6) DEFAULT '0' NOT NULL,
......
......@@ -2,7 +2,7 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) DEFAULT '0' NOT NULL auto_increment,
id int(11) NOT NULL auto_increment,
datatype_id int(11) DEFAULT '0' NOT NULL,
minvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
maxvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
......
......@@ -5,7 +5,7 @@
drop table if exists t1,t2,t3;
CREATE TABLE t1 (
auto int(5) unsigned DEFAULT 0 NOT NULL auto_increment,
auto int(5) unsigned NOT NULL auto_increment,
string char(10) default "hello",
tiny tinyint(4) DEFAULT '0' NOT NULL ,
short smallint(6) DEFAULT '1' NOT NULL ,
......@@ -91,7 +91,7 @@ select auto,new_field,new_blob_col,date_field from t1 ;
# check with old syntax
#
CREATE TABLE t2 (
auto int(5) unsigned NOT NULL DEFAULT 0 auto_increment,
auto int(5) unsigned NOT NULL auto_increment,
string char(20),
mediumblob_col mediumblob not null,
new_field char(2),
......
......@@ -72,7 +72,7 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');
alter table t1 change lfdnr lfdnr int(10) unsigned default 0 not null auto_increment;
alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment;
update t1 set status=1 where type='Open';
select status from t1;
drop table t1;
......
#! /bin/sh
# debug
#set -x
# stop on errors
set -e
# repository direcotry
repo_dir=`pwd`
# show usage
show_usage()
{
cat << EOF
usage: create-patch
Creates a patch file between the latest revision of the current tree
and the latest revision not create by \$BK_USER.
EOF
exit 0;
}
if test $1 || test -z $BK_USER
then
show_usage
fi
echo "starting patch..."
echo "user: $BK_USER"
# check for bk and repo_dir
bk help > /dev/null
repo_dir=`bk root $repo_dir`
cd $repo_dir
# determine version
version=`grep -e "AM_INIT_AUTOMAKE(mysql, .*)" < configure.in | sed -e "s/AM_INIT_AUTOMAKE(mysql, \(.*\))/\1/"`
echo "version: $version"
# user revision
user_rev=`bk changes -e -n -d':REV:' | head -1`
echo "latest revision: $user_rev"
# tree revision
tree_rev=`bk changes -e -n -d':REV:' -U$BK_USER | head -1`
echo "latest non-$BK_USER revision: $tree_rev"
# create patch
patch="$repo_dir/../$BK_USER-$version.patch"
echo "creating \"$patch\"..."
bk export -tpatch -r$tree_rev..$user_rev > $patch
#! /bin/sh
# WINE_BUILD_DIR, BUILD_DIR, and VERSION must be changed before compiling
# WINE_BUILD_DIR, BUILD_DIR, and VERSION must be correct before compiling
# This values are normally changed by the nwbootstrap script
# the default for WINE_BUILD_DIR is "F:/mydev"
# the default is "F:/mydev"
export MYDEV="WINE_BUILD_DIR"
export MWCNWx86Includes="$MYDEV/libc/include"
......@@ -12,16 +12,16 @@ export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib"
export WINEPATH="$MYDEV/mw/bin"
# the default for BUILD_DIR is "$HOME/mydev"
# the default added path is "$HOME/mydev/mysql-x.x-x/netware/BUILD"
export PATH="$PATH:BUILD_DIR/mysql-VERSION/netware/BUILD"
export AR='mwldnlm'
export AR_FLAGS='-type library -o'
export AS='mwasmnlm'
export CC='mwccnlm -gccincludes'
export CFLAGS='-dialect c -proc 686 -bool on -relax_pointers -DUSE_OLD_FUNCTIONS'
export CFLAGS='-dialect c -proc 686 -relax_pointers'
export CXX='mwccnlm -gccincludes'
export CXXFLAGS='-dialect c++ -proc 686 -bool on -relax_pointers'
export CXXFLAGS='-dialect c++ -proc 686 -bool on -wchar_t on -relax_pointers -D_WCHAR_T'
export LD='mwldnlm'
export LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -flags pseudopreemption'
export RANLIB=:
......
......@@ -129,7 +129,7 @@ else
fi
echo "creating ChangeLog..."
bk changes -v -r$rev > $target_dir/ChangeLog
bk changes -v -r$rev..$revision > $target_dir/ChangeLog
# add the latest manual
if test -d $doc_dir
......
......@@ -28,11 +28,12 @@ netware_build_files = client/mysql.def client/mysqladmin.def \
client/mysqlshow.def client/mysqltest.def \
extra/mysql_install.def extra/my_print_defaults.def \
extra/perror.def extra/replace.def \
extra/resolveip.def isam/isamchk.def \
extra/resolveip.def extra/comp_err.def \
isam/isamchk.def \
isam/isamlog.def isam/pack_isam.def \
libmysqld/libmysqld.def myisam/myisamchk.def \
myisam/myisamlog.def myisam/myisampack.def \
sql/mysqld.def sql/mysqld.xdc
sql/mysqld.def
link_sources:
set -x; \
......
#------------------------------------------------------------------------------
# MySQL Error File Compiler
#------------------------------------------------------------------------------
MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Error File Compiler"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -6,5 +6,6 @@ COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved
DESCRIPTION "MySQL ISAM Table Check Tool"
VERSION 4, 0
STACKSIZE 65536
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL ISAM Table Log Tool"
VERSION 4, 0
DEBUG
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -7,4 +7,5 @@ COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved
DESCRIPTION "MySQL Client Library"
VERSION 4, 0
AUTOUNLOAD
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -21,7 +21,7 @@
#include <dirent.h>
#include <string.h>
#include <screen.h>
#include <nks/vm.h>
#include <proc.h>
#include <ctype.h>
#include <sys/stat.h>
#include <fcntl.h>
......@@ -54,18 +54,16 @@
Init an argument list.
******************************************************************************/
void _init_args(arg_list *al)
void init_args(arg_list_t *al)
{
int i;
*al = malloc(sizeof(arg_list_t));
ASSERT(al != NULL);
(*al)->argc = 0;
al->argc = 0;
al->size = ARG_BUF;
al->argv = malloc(al->size * sizeof(char *));
ASSERT(al->argv != NULL);
for(i = 0; i < ARG_MAX; i++)
{
(*al)->argv[i] = NULL;
}
return;
}
/******************************************************************************
......@@ -75,49 +73,66 @@ void _init_args(arg_list *al)
Add an argument to a list.
******************************************************************************/
void add_arg(arg_list al, char *format, ...)
void add_arg(arg_list_t *al, char *format, ...)
{
va_list ap;
char temp[PATH_MAX];
ASSERT(al != NULL);
ASSERT(al->argc < ARG_MAX);
al->argv[al->argc] = malloc(PATH_MAX);
ASSERT(al->argv[al->argc] != NULL);
// increase size
if (al->argc >= al->size)
{
al->size += ARG_BUF;
al->argv = realloc(al->argv, al->size * sizeof(char *));
ASSERT(al->argv != NULL);
}
if (format)
{
va_start(ap, format);
vsprintf(al->argv[al->argc], format, ap);
vsprintf(temp, format, ap);
va_end(ap);
al->argv[al->argc] = malloc(strlen(temp)+1);
ASSERT(al->argv[al->argc] != NULL);
strcpy(al->argv[al->argc], temp);
++(al->argc);
}
else
{
al->argv[al->argc] = NULL;
}
return;
}
/******************************************************************************
_free_args()
free_args()
Free an argument list.
******************************************************************************/
void _free_args(arg_list *al)
void free_args(arg_list_t *al)
{
int i;
ASSERT(al != NULL);
ASSERT(*al != NULL);
for(i = 0; i < (*al)->argc; i++)
for(i = 0; i < al->argc; i++)
{
ASSERT((*al)->argv[i] != NULL);
free((*al)->argv[i]);
(*al)->argv[i] = NULL;
ASSERT(al->argv[i] != NULL);
free(al->argv[i]);
al->argv[i] = NULL;
}
free(*al);
*al = NULL;
free(al->argv);
al->argc = 0;
al->argv = NULL;
return;
}
/******************************************************************************
......@@ -167,7 +182,7 @@ int sleep_until_file_exists(char *pid_file)
******************************************************************************/
int wait_for_server_start(char *bin_dir, char *user, char *password, int port)
{
arg_list al;
arg_list_t al;
int err, i;
char mysqladmin_file[PATH_MAX];
char trash[PATH_MAX];
......@@ -177,27 +192,27 @@ int wait_for_server_start(char *bin_dir, char *user, char *password, int port)
snprintf(trash, PATH_MAX, "/tmp/trash.out");
// args
init_args(al);
add_arg(al, "%s", mysqladmin_file);
add_arg(al, "--no-defaults");
add_arg(al, "--port=%u", port);
add_arg(al, "--user=%s", user);
add_arg(al, "--password=%s", password);
add_arg(al, "--silent");
add_arg(al, "-O");
add_arg(al, "connect_timeout=10");
add_arg(al, "-w");
add_arg(al, "--host=localhost");
add_arg(al, "ping");
init_args(&al);
add_arg(&al, "%s", mysqladmin_file);
add_arg(&al, "--no-defaults");
add_arg(&al, "--port=%u", port);
add_arg(&al, "--user=%s", user);
add_arg(&al, "--password=%s", password);
add_arg(&al, "--silent");
add_arg(&al, "-O");
add_arg(&al, "connect_timeout=10");
add_arg(&al, "-w");
add_arg(&al, "--host=localhost");
add_arg(&al, "ping");
// NetWare does not support the connect timeout in the TCP/IP stack
// -- we will try the ping multiple times
for(i = 0; (i < TRY_MAX)
&& (err = spawn(mysqladmin_file, al, TRUE, NULL,
&& (err = spawn(mysqladmin_file, &al, TRUE, NULL,
trash, NULL)); i++) sleep(1);
// free args
free_args(al);
free_args(&al);
return err;
}
......@@ -206,70 +221,52 @@ int wait_for_server_start(char *bin_dir, char *user, char *password, int port)
spawn()
Spawn the given file with the given arguments.
Spawn the given path with the given arguments.
******************************************************************************/
int spawn(char *file, arg_list al, int join, char *input,
int spawn(char *path, arg_list_t *al, int join, char *input,
char *output, char *error)
{
NXNameSpec_t name;
NXExecEnvSpec_t env;
NXVmId_t vm, ignore;
int result;
// name
name.ssType = NX_OBJ_FILE;
name.ssPathCtx = 0;
name.ssPath = file;
// env
env.esArgc = al->argc;
env.esArgv = al->argv;
env.esEnv = NULL;
env.esStdin.ssPathCtx = 0;
env.esStdout.ssPathCtx = 0;
env.esStderr.ssPathCtx = 0;
if (input == NULL)
{
env.esStdin.ssType = NX_OBJ_DEFAULT;
env.esStdin.ssPath = NULL;
}
else
{
env.esStdin.ssType = NX_OBJ_FILE;
env.esStdin.ssPath = input;
}
pid_t pid;
int result = 0;
wiring_t wiring = { FD_UNUSED, FD_UNUSED, FD_UNUSED };
unsigned long flags = PROC_CURRENT_SPACE | PROC_INHERIT_CWD;
if (output == NULL)
{
env.esStdout.ssType = NX_OBJ_DEFAULT;
env.esStdout.ssPath = NULL;
}
else
{
env.esStdout.ssType = NX_OBJ_FILE;
env.esStdout.ssPath = output;
}
// open wiring
if (input)
wiring.infd = open(input, O_RDONLY);
if (output)
wiring.outfd = open(output, O_WRONLY | O_CREAT | O_TRUNC);
if (error)
wiring.errfd = open(error, O_WRONLY | O_CREAT | O_TRUNC);
// procve requires a NULL
add_arg(al, NULL);
if (error == NULL)
// go
pid = procve(path, flags, NULL, &wiring, NULL, NULL, 0,
NULL, (const char **)al->argv);
if (pid == -1)
{
env.esStderr.ssType = NX_OBJ_DEFAULT;
env.esStderr.ssPath = NULL;
result = -1;
}
else
else if (join)
{
env.esStderr.ssType = NX_OBJ_FILE;
env.esStderr.ssPath = error;
waitpid(pid, &result, 0);
}
result = NXVmSpawn(&name, &env, NX_VM_SAME_ADDRSPACE | NX_VM_INHERIT_ENV, &vm);
// close wiring
if (wiring.infd != -1)
close(wiring.infd);
if (!result && join)
{
NXVmJoin(vm, &ignore, &result);
}
if (wiring.outfd != -1)
close(wiring.outfd);
if (wiring.errfd != -1)
close(wiring.errfd);
return result;
}
......@@ -284,7 +281,7 @@ int spawn(char *file, arg_list al, int join, char *input,
int stop_server(char *bin_dir, char *user, char *password, int port,
char *pid_file)
{
arg_list al;
arg_list_t al;
int err, i, argc = 0;
char mysqladmin_file[PATH_MAX];
char trash[PATH_MAX];
......@@ -294,18 +291,18 @@ int stop_server(char *bin_dir, char *user, char *password, int port,
snprintf(trash, PATH_MAX, "/tmp/trash.out");
// args
init_args(al);
add_arg(al, "%s", mysqladmin_file);
add_arg(al, "--no-defaults");
add_arg(al, "--port=%u", port);
add_arg(al, "--user=%s", user);
add_arg(al, "--password=%s", password);
add_arg(al, "-O");
add_arg(al, "shutdown_timeout=20");
add_arg(al, "shutdown");
init_args(&al);
add_arg(&al, "%s", mysqladmin_file);
add_arg(&al, "--no-defaults");
add_arg(&al, "--port=%u", port);
add_arg(&al, "--user=%s", user);
add_arg(&al, "--password=%s", password);
add_arg(&al, "-O");
add_arg(&al, "shutdown_timeout=20");
add_arg(&al, "shutdown");
// spawn
if ((err = spawn(mysqladmin_file, al, TRUE, NULL,
if ((err = spawn(mysqladmin_file, &al, TRUE, NULL,
trash, NULL)) == 0)
{
sleep_until_file_deleted(pid_file);
......@@ -324,7 +321,7 @@ int stop_server(char *bin_dir, char *user, char *password, int port,
}
// free args
free_args(al);
free_args(&al);
return err;
}
......
......@@ -34,12 +34,9 @@
******************************************************************************/
#define ARG_MAX 50
#define ARG_BUF 10
#define TRY_MAX 5
#define init_args(al) _init_args(&al);
#define free_args(al) _free_args(&al);
/******************************************************************************
structures
......@@ -50,9 +47,11 @@ typedef struct
{
int argc;
char *argv[ARG_MAX];
char **argv;
size_t size;
} arg_list_t, * arg_list;
} arg_list_t;
/******************************************************************************
......@@ -66,18 +65,23 @@ typedef struct
******************************************************************************/
void _init_args(arg_list *);
void add_arg(arg_list, char *, ...);
void _free_args(arg_list *);
void init_args(arg_list_t *);
void add_arg(arg_list_t *, char *, ...);
void free_args(arg_list_t *);
int sleep_until_file_exists(char *);
int sleep_until_file_deleted(char *);
int wait_for_server_start(char *, char *, char *, int);
int spawn(char *, arg_list, int, char *, char *, char *);
int spawn(char *, arg_list_t *, int, char *, char *, char *);
int stop_server(char *, char *, char *, int, char *);
pid_t get_server_pid(char *);
void kill_server(pid_t pid);
void del_tree(char *);
int removef(char *, ...);
void get_basedir(char *, char *);
#endif /* _MY_MANAGE */
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Print Defaults Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -6,5 +6,6 @@ COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved
DESCRIPTION "MySQL MyISAM Table Check Tool"
VERSION 4, 0
STACKSIZE 65536
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL MyISAM Table Log Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL MyISAM Table Pack Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -7,5 +7,6 @@ COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved
DESCRIPTION "MySQL Monitor"
VERSION 4, 0
MULTIPLE
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Install Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -24,6 +24,7 @@
#include <strings.h>
#include <getopt.h>
#include <screen.h>
#include <errno.h>
#include "my_config.h"
#include "my_manage.h"
......@@ -51,7 +52,7 @@ char default_option[PATH_MAX];
void start_defaults(int, char*[]);
void finish_defaults();
void read_defaults(arg_list);
void read_defaults(arg_list_t *);
void parse_args(int, char*[]);
void get_options(int, char*[]);
void create_paths();
......@@ -151,9 +152,9 @@ void finish_defaults()
Read the defaults.
******************************************************************************/
void read_defaults(arg_list pal)
void read_defaults(arg_list_t *pal)
{
arg_list al;
arg_list_t al;
char defaults_file[PATH_MAX];
char mydefaults[PATH_MAX];
char line[PATH_MAX];
......@@ -167,15 +168,15 @@ void read_defaults(arg_list pal)
snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir);
// args
init_args(al);
add_arg(al, mydefaults);
if (default_option[0]) add_arg(al, default_option);
add_arg(al, "mysqld");
add_arg(al, "mysql_install_db");
init_args(&al);
add_arg(&al, mydefaults);
if (default_option[0]) add_arg(&al, default_option);
add_arg(&al, "mysqld");
add_arg(&al, "mysql_install_db");
spawn(mydefaults, al, TRUE, NULL, defaults_file, NULL);
spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL);
free_args(al);
free_args(&al);
// gather defaults
if((fp = fopen(defaults_file, "r")) != NULL)
......@@ -267,17 +268,17 @@ void parse_args(int argc, char *argv[])
******************************************************************************/
void get_options(int argc, char *argv[])
{
arg_list al;
arg_list_t al;
// start defaults
start_defaults(argc, argv);
// default file arguments
init_args(al);
add_arg(al, "dummy");
read_defaults(al);
parse_args(al->argc, al->argv);
free_args(al);
init_args(&al);
add_arg(&al, "ignore");
read_defaults(&al);
parse_args(al.argc, al.argv);
free_args(&al);
// command-line arguments
parse_args(argc, argv);
......@@ -323,7 +324,7 @@ void create_paths()
******************************************************************************/
int mysql_install_db(int argc, char *argv[])
{
arg_list al;
arg_list_t al;
int i, j, err;
char skip;
......@@ -336,8 +337,8 @@ int mysql_install_db(int argc, char *argv[])
};
// args
init_args(al);
add_arg(al, "%s", mysqld);
init_args(&al);
add_arg(&al, "%s", mysqld);
// parent args
for(i = 1; i < argc; i++)
......@@ -354,19 +355,19 @@ int mysql_install_db(int argc, char *argv[])
}
}
if (!skip) add_arg(al, "%s", argv[i]);
if (!skip) add_arg(&al, "%s", argv[i]);
}
add_arg(al, "--bootstrap");
add_arg(al, "--skip-grant-tables");
add_arg(al, "--skip-innodb");
add_arg(al, "--skip-bdb");
add_arg(&al, "--bootstrap");
add_arg(&al, "--skip-grant-tables");
add_arg(&al, "--skip-innodb");
add_arg(&al, "--skip-bdb");
// spawn mysqld
err = spawn(mysqld, al, TRUE, sql_file, out_log, err_log);
err = spawn(mysqld, &al, TRUE, sql_file, out_log, err_log);
// free args
free_args(al);
free_args(&al);
return err;
}
......@@ -384,6 +385,9 @@ int main(int argc, char **argv)
// check for an autoclose option
if (!autoclose) setscreenmode(SCR_NO_MODE);
// header
printf("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
// create paths
create_paths();
......@@ -391,6 +395,7 @@ int main(int argc, char **argv)
if (mysql_install_db(argc, argv))
{
printf("ERROR - The database creation failed!\n");
printf(" %s\n", strerror(errno));
printf("See the following log for more infomration:\n");
printf("\t%s\n\n", err_log);
exit(-1);
......
......@@ -6,5 +6,6 @@ SCREENNAME "MySQL Install"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Initial Database Installer"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
This diff is collapsed.
......@@ -7,4 +7,5 @@ SCREENNAME "MySQL Test Run"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Test Run"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -6,5 +6,6 @@ SCREENNAME "MySQL Admin"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Admin Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Binary Log Dump Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Check Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -2,11 +2,11 @@
# MySQL Server
#------------------------------------------------------------------------------
MODULE libc.nlm
XDCDATA mysqld.xdc
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Database Server"
VERSION 4, 0
MULTIPLE
STACKSIZE 65536
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -60,7 +60,7 @@ void vlog(char *, va_list);
void log(char *, ...);
void start_defaults(int, char*[]);
void finish_defaults();
void read_defaults(arg_list);
void read_defaults(arg_list_t *);
void parse_args(int, char*[]);
void get_options(int, char*[]);
void check_data_vol();
......@@ -249,9 +249,9 @@ void finish_defaults()
Read the defaults.
******************************************************************************/
void read_defaults(arg_list pal)
void read_defaults(arg_list_t *pal)
{
arg_list al;
arg_list_t al;
char defaults_file[PATH_MAX];
char mydefaults[PATH_MAX];
char line[PATH_MAX];
......@@ -265,17 +265,17 @@ void read_defaults(arg_list pal)
snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir);
// args
init_args(al);
add_arg(al, mydefaults);
if (default_option[0]) add_arg(al, default_option);
add_arg(al, "mysqld");
add_arg(al, "server");
add_arg(al, "mysqld_safe");
add_arg(al, "safe_mysqld");
init_args(&al);
add_arg(&al, mydefaults);
if (default_option[0]) add_arg(&al, default_option);
add_arg(&al, "mysqld");
add_arg(&al, "server");
add_arg(&al, "mysqld_safe");
add_arg(&al, "safe_mysqld");
spawn(mydefaults, al, TRUE, NULL, defaults_file, NULL);
spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL);
free_args(al);
free_args(&al);
// gather defaults
if((fp = fopen(defaults_file, "r")) != NULL)
......@@ -405,17 +405,17 @@ void parse_args(int argc, char *argv[])
******************************************************************************/
void get_options(int argc, char *argv[])
{
arg_list al;
arg_list_t al;
// start defaults
start_defaults(argc, argv);
// default file arguments
init_args(al);
add_arg(al, "ignore");
read_defaults(al);
parse_args(al->argc, al->argv);
free_args(al);
init_args(&al);
add_arg(&al, "ignore");
read_defaults(&al);
parse_args(al.argc, al.argv);
free_args(&al);
// command-line arguments
parse_args(argc, argv);
......@@ -504,7 +504,7 @@ void check_setup()
******************************************************************************/
void check_tables()
{
arg_list al;
arg_list_t al;
char mycheck[PATH_MAX];
char table[PATH_MAX];
char db[PATH_MAX];
......@@ -549,21 +549,21 @@ void check_tables()
snprintf(mycheck, PATH_MAX, "%s/bin/myisamchk", basedir);
// args
init_args(al);
add_arg(al, mycheck);
add_arg(al, "--silent");
add_arg(al, "--force");
add_arg(al, "--fast");
add_arg(al, "--medium-check");
add_arg(al, "-O");
add_arg(al, "key_buffer=64M");
add_arg(al, "-O");
add_arg(al, "sort_buffer=64M");
add_arg(al, table);
spawn(mycheck, al, TRUE, NULL, NULL, NULL);
free_args(al);
init_args(&al);
add_arg(&al, mycheck);
add_arg(&al, "--silent");
add_arg(&al, "--force");
add_arg(&al, "--fast");
add_arg(&al, "--medium-check");
add_arg(&al, "-O");
add_arg(&al, "key_buffer=64M");
add_arg(&al, "-O");
add_arg(&al, "sort_buffer=64M");
add_arg(&al, table);
spawn(mycheck, &al, TRUE, NULL, NULL, NULL);
free_args(&al);
}
else if (strindex(table, ".ism"))
{
......@@ -573,17 +573,17 @@ void check_tables()
snprintf(mycheck, PATH_MAX, "%s/bin/isamchk", basedir);
// args
init_args(al);
add_arg(al, mycheck);
add_arg(al, "--silent");
add_arg(al, "--force");
add_arg(al, "-O");
add_arg(al, "sort_buffer=64M");
add_arg(al, table);
init_args(&al);
add_arg(&al, mycheck);
add_arg(&al, "--silent");
add_arg(&al, "--force");
add_arg(&al, "-O");
add_arg(&al, "sort_buffer=64M");
add_arg(&al, table);
spawn(mycheck, al, TRUE, NULL, NULL, NULL);
spawn(mycheck, &al, TRUE, NULL, NULL, NULL);
free_args(al);
free_args(&al);
}
}
}
......@@ -599,7 +599,7 @@ void check_tables()
******************************************************************************/
void mysql_start(int argc, char *argv[])
{
arg_list al;
arg_list_t al;
int i, j, err;
struct stat info;
time_t cal;
......@@ -619,8 +619,8 @@ void mysql_start(int argc, char *argv[])
};
// args
init_args(al);
add_arg(al, "%s", mysqld);
init_args(&al);
add_arg(&al, "%s", mysqld);
// parent args
for(i = 1; i < argc; i++)
......@@ -637,7 +637,7 @@ void mysql_start(int argc, char *argv[])
}
}
if (!skip) add_arg(al, "%s", argv[i]);
if (!skip) add_arg(&al, "%s", argv[i]);
}
// spawn
......@@ -653,7 +653,7 @@ void mysql_start(int argc, char *argv[])
log("mysql started : %s\n", stamp);
// spawn mysqld
spawn(mysqld, al, TRUE, NULL, NULL, err_log);
spawn(mysqld, &al, TRUE, NULL, NULL, err_log);
}
while (!stat(pid_file, &info));
......@@ -664,7 +664,7 @@ void mysql_start(int argc, char *argv[])
log("mysql stopped : %s\n\n", stamp);
// free args
free_args(al);
free_args(&al);
}
/******************************************************************************
......
......@@ -6,5 +6,7 @@ SCREENNAME "MySQL Database Server"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Database Server Monitor"
VERSION 4, 0
MULTIPLE
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Dump Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Import Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -6,5 +6,6 @@ SCREENNAME "MySQL Show"
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Show Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Test Case Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL ISAM Table Pack Tool"
VERSION 4, 0
DEBUG
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Error Code Description Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL Text Replacement Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -5,5 +5,6 @@ MODULE libc.nlm
COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
DESCRIPTION "MySQL IP/Hostname Resolve Tool"
VERSION 4, 0
XDCDATA ../netware/mysql.xdc
#DEBUG
......@@ -2178,6 +2178,20 @@ report("views","views",
save_config_data('foreign_key',$result,"foreign keys");
}
if ($limits{'foreign_key'} eq 'yes')
{
report("allows to update of foreign key values",'foreign_update',
"create table crash_me1 (a int not null primary key)",
"create table crash_me2 (a int not null," .
" foreign key (a) references crash_me1 (a))",
"insert into crash_me1 values (1)",
"insert into crash_me2 values (1)",
"update crash_me1 set a = 2", ## <- must fail
"drop table crash_me2 $drop_attr",
"drop table crash_me1 $drop_attr"
);
}
report("Create SCHEMA","create_schema",
"create schema crash_schema create table crash_q (a int) ".
"create table crash_q2(b int)",
......
......@@ -121,8 +121,15 @@ handler *get_new_handler(TABLE *table, enum db_type db_type)
#endif
case DB_TYPE_HEAP:
return new ha_heap(table);
case DB_TYPE_MYISAM:
default: // should never happen
{
enum db_type def=(enum db_type) current_thd->variables.table_type;
/* Try first with 'default table type' */
if (db_type != def)
return get_new_handler(table, def);
}
/* Fall back to MyISAM */
case DB_TYPE_MYISAM:
return new ha_myisam(table);
case DB_TYPE_MRG_MYISAM:
return new ha_myisammrg(table);
......
......@@ -1373,8 +1373,10 @@ String *Item_func_database::val_str(String *str)
String *Item_func_user::val_str(String *str)
{
// TODO: make USER() replicate properly (currently it is replicated to "")
THD *thd=current_thd;
if (str->copy((const char*) thd->user,(uint) strlen(thd->user)) ||
if (!(thd->user) || // for system threads (e.g. replication SQL thread)
str->copy((const char*) thd->user,(uint) strlen(thd->user)) ||
str->append('@') ||
str->append(thd->host ? thd->host : thd->ip ? thd->ip : ""))
return &empty_string;
......
This diff is collapsed.
......@@ -499,7 +499,10 @@ check_connections(THD *thd)
thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
/* Cut very long hostnames to avoid possible overflows */
if (thd->host)
{
thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0;
thd->host_or_ip= thd->host;
}
if (connect_errors > max_connect_errors)
return(ER_HOST_IS_BLOCKED);
}
......@@ -2877,21 +2880,35 @@ bool add_field_to_list(char *field_name, enum_field_types type,
lex->col_list.empty();
}
if (default_value && default_value->type() == Item::NULL_ITEM)
if (default_value)
{
if (default_value->type() == Item::NULL_ITEM)
{
default_value=0;
if ((type_modifier & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) ==
NOT_NULL_FLAG)
{
net_printf(&thd->net,ER_INVALID_DEFAULT,field_name);
DBUG_RETURN(1);
}
default_value=0;
}
#ifdef MYSQL41000
else if (type_modifier & AUTO_INCREMENT_FLAG)
{
net_printf(&thd->net, ER_INVALID_DEFAULT, field_name);
DBUG_RETURN(1);
}
#endif
}
if (!(new_field=new create_field()))
DBUG_RETURN(1);
new_field->field=0;
new_field->field_name=field_name;
#ifdef MYSQL41000
new_field->def= default_value;
#else
new_field->def= (type_modifier & AUTO_INCREMENT_FLAG ? 0 : default_value);
#endif
new_field->flags= type_modifier;
new_field->unireg_check= (type_modifier & AUTO_INCREMENT_FLAG ?
Field::NEXT_NUMBER : Field::NONE);
......
......@@ -2450,13 +2450,17 @@ procedure_item:
opt_into:
INTO OUTFILE TEXT_STRING
{
if (!(Lex->exchange= new sql_exchange($3.str,0)))
THD *thd= current_thd;
thd->safe_to_cache_query= 0;
if (!(thd->lex.exchange= new sql_exchange($3.str,0)))
YYABORT;
}
opt_field_term opt_line_term
| INTO DUMPFILE TEXT_STRING
{
if (!(Lex->exchange= new sql_exchange($3.str,1)))
THD *thd= current_thd;
thd->safe_to_cache_query= 0;
if (!(thd->lex.exchange= new sql_exchange($3.str,1)))
YYABORT;
};
......
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