Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
53108977
Commit
53108977
authored
Dec 15, 2003
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
923422c2
217226f9
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
357 additions
and
94 deletions
+357
-94
client/mysql.cc
client/mysql.cc
+2
-2
client/mysqldump.c
client/mysqldump.c
+96
-7
configure.in
configure.in
+1
-1
include/my_global.h
include/my_global.h
+3
-0
myisam/mi_dbug.c
myisam/mi_dbug.c
+4
-0
mysql-test/r/have_met_timezone.require
mysql-test/r/have_met_timezone.require
+2
-2
mysql-test/r/insert.result
mysql-test/r/insert.result
+1
-1
mysql-test/r/loaddata.result
mysql-test/r/loaddata.result
+18
-0
mysql-test/r/lowercase_table.result
mysql-test/r/lowercase_table.result
+8
-2
mysql-test/r/mysqldump.result
mysql-test/r/mysqldump.result
+1
-1
mysql-test/r/timezone.result
mysql-test/r/timezone.result
+9
-6
mysql-test/std_data/loaddata3.dat
mysql-test/std_data/loaddata3.dat
+6
-0
mysql-test/std_data/loaddata4.dat
mysql-test/std_data/loaddata4.dat
+1
-0
mysql-test/t/insert.test
mysql-test/t/insert.test
+1
-1
mysql-test/t/loaddata.test
mysql-test/t/loaddata.test
+11
-0
mysql-test/t/lowercase_table.test
mysql-test/t/lowercase_table.test
+5
-2
mysql-test/t/mysqldump.test
mysql-test/t/mysqldump.test
+3
-0
mysql-test/t/timezone.test
mysql-test/t/timezone.test
+12
-6
sql/item.cc
sql/item.cc
+8
-0
sql/item.h
sql/item.h
+1
-3
sql/mysqld.cc
sql/mysqld.cc
+70
-22
sql/nt_servc.cc
sql/nt_servc.cc
+2
-2
sql/opt_range.cc
sql/opt_range.cc
+7
-8
sql/sql_base.cc
sql/sql_base.cc
+13
-0
sql/sql_class.h
sql/sql_class.h
+1
-1
sql/sql_load.cc
sql/sql_load.cc
+49
-14
sql/sql_parse.cc
sql/sql_parse.cc
+8
-5
sql/sql_update.cc
sql/sql_update.cc
+1
-1
strings/ctype-tis620.c
strings/ctype-tis620.c
+12
-6
support-files/mysql.server.sh
support-files/mysql.server.sh
+1
-1
No files found.
client/mysql.cc
View file @
53108977
...
@@ -574,8 +574,8 @@ static struct my_option my_long_options[] =
...
@@ -574,8 +574,8 @@ static struct my_option my_long_options[] =
0
,
1
},
0
,
1
},
{
"max_allowed_packet"
,
OPT_MAX_ALLOWED_PACKET
,
""
,
{
"max_allowed_packet"
,
OPT_MAX_ALLOWED_PACKET
,
""
,
(
gptr
*
)
&
max_allowed_packet
,
(
gptr
*
)
&
max_allowed_packet
,
0
,
GET_ULONG
,
(
gptr
*
)
&
max_allowed_packet
,
(
gptr
*
)
&
max_allowed_packet
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
16
*
1024L
*
1024L
,
4096
,
2
*
1024
*
1024L
*
1024L
,
MALLOC_OVERHEAD
,
REQUIRED_ARG
,
16
*
1024L
*
1024L
,
4096
,
(
longlong
)
2
*
1024L
*
1024L
*
1024L
,
1024
,
0
},
MALLOC_OVERHEAD
,
1024
,
0
},
{
"net_buffer_length"
,
OPT_NET_BUFFER_LENGTH
,
""
,
{
"net_buffer_length"
,
OPT_NET_BUFFER_LENGTH
,
""
,
(
gptr
*
)
&
net_buffer_length
,
(
gptr
*
)
&
net_buffer_length
,
0
,
GET_ULONG
,
(
gptr
*
)
&
net_buffer_length
,
(
gptr
*
)
&
net_buffer_length
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
16384
,
1024
,
512
*
1024
*
1024L
,
MALLOC_OVERHEAD
,
1024
,
0
},
REQUIRED_ARG
,
16384
,
1024
,
512
*
1024
*
1024L
,
MALLOC_OVERHEAD
,
1024
,
0
},
...
...
client/mysqldump.c
View file @
53108977
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
** Added --single-transaction option 06/06/2002 by Peter Zaitsev
** Added --single-transaction option 06/06/2002 by Peter Zaitsev
*/
*/
#define DUMP_VERSION "9.
09
"
#define DUMP_VERSION "9.
10
"
#include <my_global.h>
#include <my_global.h>
#include <my_sys.h>
#include <my_sys.h>
...
@@ -236,8 +236,8 @@ static struct my_option my_long_options[] =
...
@@ -236,8 +236,8 @@ static struct my_option my_long_options[] =
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"max_allowed_packet"
,
OPT_MAX_ALLOWED_PACKET
,
""
,
{
"max_allowed_packet"
,
OPT_MAX_ALLOWED_PACKET
,
""
,
(
gptr
*
)
&
max_allowed_packet
,
(
gptr
*
)
&
max_allowed_packet
,
0
,
(
gptr
*
)
&
max_allowed_packet
,
(
gptr
*
)
&
max_allowed_packet
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
24
*
1024
*
1024
,
4096
,
1024
*
1024L
*
1024L
,
GET_ULONG
,
REQUIRED_ARG
,
24
*
1024
*
1024
,
4096
,
MALLOC_OVERHEAD
,
1024
,
0
},
(
longlong
)
2L
*
1024L
*
1024L
*
1024L
,
MALLOC_OVERHEAD
,
1024
,
0
},
{
"net_buffer_length"
,
OPT_NET_BUFFER_LENGTH
,
""
,
{
"net_buffer_length"
,
OPT_NET_BUFFER_LENGTH
,
""
,
(
gptr
*
)
&
net_buffer_length
,
(
gptr
*
)
&
net_buffer_length
,
0
,
(
gptr
*
)
&
net_buffer_length
,
(
gptr
*
)
&
net_buffer_length
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
1024
*
1024L
-
1025
,
4096
,
16
*
1024L
*
1024L
,
GET_ULONG
,
REQUIRED_ARG
,
1024
*
1024L
-
1025
,
4096
,
16
*
1024L
*
1024L
,
...
@@ -262,6 +262,8 @@ static int dump_databases(char **);
...
@@ -262,6 +262,8 @@ static int dump_databases(char **);
static
int
dump_all_databases
();
static
int
dump_all_databases
();
static
char
*
quote_name
(
const
char
*
name
,
char
*
buff
,
my_bool
force
);
static
char
*
quote_name
(
const
char
*
name
,
char
*
buff
,
my_bool
force
);
static
void
print_quoted_xml
(
FILE
*
output
,
char
*
fname
,
char
*
str
,
uint
len
);
static
void
print_quoted_xml
(
FILE
*
output
,
char
*
fname
,
char
*
str
,
uint
len
);
static
const
char
*
check_if_ignore_table
(
const
char
*
table_name
);
static
void
print_version
(
void
)
static
void
print_version
(
void
)
{
{
...
@@ -564,6 +566,23 @@ static char *quote_name(const char *name, char *buff, my_bool force)
...
@@ -564,6 +566,23 @@ static char *quote_name(const char *name, char *buff, my_bool force)
}
/* quote_name */
}
/* quote_name */
static
char
*
quote_for_like
(
const
char
*
name
,
char
*
buff
)
{
char
*
to
=
buff
;
*
to
++=
'\''
;
while
(
*
name
)
{
if
(
*
name
==
'\''
||
*
name
==
'_'
||
*
name
==
'\\'
||
*
name
==
'%'
)
*
to
++=
'\\'
;
*
to
++=
*
name
++
;
}
to
[
0
]
=
'\''
;
to
[
1
]
=
0
;
return
buff
;
}
/*
/*
getStructure -- retrievs database structure, prints out corresponding
getStructure -- retrievs database structure, prints out corresponding
CREATE statement and fills out insert_pat.
CREATE statement and fills out insert_pat.
...
@@ -590,7 +609,8 @@ static uint getTableStructure(char *table, char* db)
...
@@ -590,7 +609,8 @@ static uint getTableStructure(char *table, char* db)
if
(
verbose
)
if
(
verbose
)
fprintf
(
stderr
,
"-- Retrieving table structure for table %s...
\n
"
,
table
);
fprintf
(
stderr
,
"-- Retrieving table structure for table %s...
\n
"
,
table
);
sprintf
(
insert_pat
,
"SET OPTION SQL_QUOTE_SHOW_CREATE=%d"
,
(
opt_quoted
||
opt_keywords
));
sprintf
(
insert_pat
,
"SET OPTION SQL_QUOTE_SHOW_CREATE=%d"
,
(
opt_quoted
||
opt_keywords
));
result_table
=
quote_name
(
table
,
table_buff
,
1
);
result_table
=
quote_name
(
table
,
table_buff
,
1
);
opt_quoted_table
=
quote_name
(
table
,
table_buff2
,
0
);
opt_quoted_table
=
quote_name
(
table
,
table_buff2
,
0
);
if
(
!
mysql_query
(
sock
,
insert_pat
))
if
(
!
mysql_query
(
sock
,
insert_pat
))
...
@@ -819,7 +839,9 @@ static uint getTableStructure(char *table, char* db)
...
@@ -819,7 +839,9 @@ static uint getTableStructure(char *table, char* db)
/* Get MySQL specific create options */
/* Get MySQL specific create options */
if
(
create_options
)
if
(
create_options
)
{
{
sprintf
(
buff
,
"show table status like %s"
,
result_table
);
char
show_name_buff
[
FN_REFLEN
];
sprintf
(
buff
,
"show table status like %s"
,
quote_for_like
(
table
,
show_name_buff
));
if
(
mysql_query
(
sock
,
buff
))
if
(
mysql_query
(
sock
,
buff
))
{
{
if
(
mysql_errno
(
sock
)
!=
ER_PARSE_ERROR
)
if
(
mysql_errno
(
sock
)
!=
ER_PARSE_ERROR
)
...
@@ -924,11 +946,23 @@ static void dumpTable(uint numFields, char *table)
...
@@ -924,11 +946,23 @@ static void dumpTable(uint numFields, char *table)
MYSQL_FIELD
*
field
;
MYSQL_FIELD
*
field
;
MYSQL_ROW
row
;
MYSQL_ROW
row
;
ulong
rownr
,
row_break
,
total_length
,
init_length
;
ulong
rownr
,
row_break
,
total_length
,
init_length
;
const
char
*
table_type
;
if
(
verbose
)
fprintf
(
stderr
,
"-- Sending SELECT query...
\n
"
);
result_table
=
quote_name
(
table
,
table_buff
,
1
);
result_table
=
quote_name
(
table
,
table_buff
,
1
);
opt_quoted_table
=
quote_name
(
table
,
table_buff2
,
0
);
opt_quoted_table
=
quote_name
(
table
,
table_buff2
,
0
);
/* Check table type */
if
((
table_type
=
check_if_ignore_table
(
table
)))
{
if
(
verbose
)
fprintf
(
stderr
,
"-- Skipping data for table '%s' because it's of type %s
\n
"
,
table
,
table_type
);
return
;
}
if
(
verbose
)
fprintf
(
stderr
,
"-- Sending SELECT query...
\n
"
);
if
(
path
)
if
(
path
)
{
{
char
filename
[
FN_REFLEN
],
tmp_path
[
FN_REFLEN
];
char
filename
[
FN_REFLEN
],
tmp_path
[
FN_REFLEN
];
...
@@ -1434,6 +1468,61 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
...
@@ -1434,6 +1468,61 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
}
/* print_value */
}
/* print_value */
/*
Check if we the table is one of the table types that should be ignored:
MRG_ISAM, MRG_MYISAM
SYNOPSIS
check_if_ignore_table()
table_name Table name to check
GLOBAL VARIABLES
sock MySQL socket
verbose Write warning messages
RETURN
0 Table should be backuped
# Type of table (that should be skipped)
*/
static
const
char
*
check_if_ignore_table
(
const
char
*
table_name
)
{
char
buff
[
FN_REFLEN
+
80
],
show_name_buff
[
FN_REFLEN
];
MYSQL_RES
*
res
;
MYSQL_ROW
row
;
const
char
*
result
=
0
;
sprintf
(
buff
,
"show table status like %s"
,
quote_for_like
(
table_name
,
show_name_buff
));
if
(
mysql_query
(
sock
,
buff
))
{
if
(
mysql_errno
(
sock
)
!=
ER_PARSE_ERROR
)
{
/* If old MySQL version */
if
(
verbose
)
fprintf
(
stderr
,
"-- Warning: Couldn't get status information for table %s (%s)
\n
"
,
table_name
,
mysql_error
(
sock
));
return
0
;
/* assume table is ok */
}
}
if
(
!
(
res
=
mysql_store_result
(
sock
))
||
!
(
row
=
mysql_fetch_row
(
res
)))
{
fprintf
(
stderr
,
"Error: Couldn't read status information for table %s (%s)
\n
"
,
table_name
,
mysql_error
(
sock
));
if
(
res
)
mysql_free_result
(
res
);
return
0
;
/* assume table is ok */
}
if
(
strcmp
(
row
[
1
],
(
result
=
"MRG_MyISAM"
))
&&
strcmp
(
row
[
1
],
(
result
=
"MRG_ISAM"
)))
result
=
0
;
mysql_free_result
(
res
);
return
result
;
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
MYSQL_ROW
row
;
MYSQL_ROW
row
;
...
...
configure.in
View file @
53108977
...
@@ -733,7 +733,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
...
@@ -733,7 +733,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h
\
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h
\
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h
\
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h
\
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h
\
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h
\
sys/ioctl.h malloc.h sys/malloc.h
)
sys/ioctl.h malloc.h sys/malloc.h
linux/config.h
)
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# Check for system libraries. Adds the library to $LIBS
# Check for system libraries. Adds the library to $LIBS
...
...
include/my_global.h
View file @
53108977
...
@@ -267,6 +267,9 @@ C_MODE_END
...
@@ -267,6 +267,9 @@ C_MODE_END
#endif
#endif
#ifdef HAVE_ATOMIC_ADD
#ifdef HAVE_ATOMIC_ADD
#define __SMP__
#define __SMP__
#ifdef HAVE_LINUX_CONFIG_H
#include <linux/config.h>
/* May define CONFIG_SMP */
#endif
#ifndef CONFIG_SMP
#ifndef CONFIG_SMP
#define CONFIG_SMP
#define CONFIG_SMP
#endif
#endif
...
...
myisam/mi_dbug.c
View file @
53108977
...
@@ -137,6 +137,10 @@ void _mi_print_key(FILE *stream, register MI_KEYSEG *keyseg,
...
@@ -137,6 +137,10 @@ void _mi_print_key(FILE *stream, register MI_KEYSEG *keyseg,
{
{
uint
tmp_length
;
uint
tmp_length
;
get_key_length
(
tmp_length
,
key
);
get_key_length
(
tmp_length
,
key
);
/*
The following command sometimes gives a warning from valgrind.
Not yet sure if the bug is in valgrind, glibc or mysqld
*/
VOID
(
fprintf
(
stream
,
"%.*s"
,(
int
)
tmp_length
,
key
));
VOID
(
fprintf
(
stream
,
"%.*s"
,(
int
)
tmp_length
,
key
));
key
+=
tmp_length
;
key
+=
tmp_length
;
break
;
break
;
...
...
mysql-test/r/have_met_timezone.require
View file @
53108977
Variable_name Value
FROM_UNIXTIME(24*3600)
timezone MET
1970-01-02 01:00:00
mysql-test/r/insert.result
View file @
53108977
...
@@ -71,7 +71,7 @@ drop table t1;
...
@@ -71,7 +71,7 @@ drop table t1;
create table t1 (email varchar(50));
create table t1 (email varchar(50));
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
insert
delayed
into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
select * from t2;
select * from t2;
id t2
id t2
1 mysql.com
1 mysql.com
...
...
mysql-test/r/loaddata.result
View file @
53108977
...
@@ -26,3 +26,21 @@ Field 3,'Field 4|
...
@@ -26,3 +26,21 @@ Field 3,'Field 4|
|Field 5' ,'Field 6| NULL
|Field 5' ,'Field 6| NULL
|Field 6| | 'Field 7'|
|Field 6| | 'Field 7'|
drop table t1;
drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
select * from t1;
a b
1 row 1
2 row 2
0 1234567890
3 row 3
0 1234567890
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
select * from t1;
a b
1 row 1
2 row 2
3 row 3
0
drop table t1;
mysql-test/r/lowercase_table.result
View file @
53108977
drop table if exists t1,t2,t3;
drop table if exists t1,t2,t3
,t4,T1
;
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
create table t4 (id int primary key, Word varchar(40) not null);
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
INSERT INTO T4 VALUES(1,'match');
SELECT * FROM t1;
SELECT * FROM t1;
id Word
id Word
1 a
1 a
...
@@ -12,6 +14,9 @@ id
...
@@ -12,6 +14,9 @@ id
SELECT T2.id from t1 as T2 LIMIT 1;
SELECT T2.id from t1 as T2 LIMIT 1;
id
id
1
1
SELECT * from t1 left join t4 on (test.t1.id= TEST.t4.id) where TEST.t1.id >= test.t4.id;
id Word id Word
1 a 1 match
SELECT T2.id from t1 as t2 LIMIT 1;
SELECT T2.id from t1 as t2 LIMIT 1;
Unknown table 'T2' in field list
Unknown table 'T2' in field list
RENAME TABLE T1 TO T2;
RENAME TABLE T1 TO T2;
...
@@ -20,7 +25,8 @@ ALTER TABLE T2 RENAME T3;
...
@@ -20,7 +25,8 @@ ALTER TABLE T2 RENAME T3;
show tables like 't_';
show tables like 't_';
Tables_in_test (t_)
Tables_in_test (t_)
t3
t3
drop table t3;
t4
drop table t3,t4;
create table t1 (a int);
create table t1 (a int);
select count(*) from T1;
select count(*) from T1;
count(*)
count(*)
...
...
mysql-test/r/mysqldump.result
View file @
53108977
...
@@ -32,6 +32,6 @@ CREATE TABLE t1 (
...
@@ -32,6 +32,6 @@ CREATE TABLE t1 (
a double default NULL
a double default NULL
) TYPE=MyISAM;
) TYPE=MyISAM;
INSERT INTO t1 VALUES (
NULL
);
INSERT INTO t1 VALUES (
RES
);
DROP TABLE t1;
DROP TABLE t1;
mysql-test/r/timezone.result
View file @
53108977
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
show variables like "timezone";
Variable_name Value
timezone MET
select @a:=FROM_UNIXTIME(1);
@a:=FROM_UNIXTIME(1)
1970-01-01 01:00:01
select unix_timestamp(@a);
unix_timestamp(@a)
1
CREATE TABLE t1 (ts int);
CREATE TABLE t1 (ts int);
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00'));
INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00'));
...
@@ -23,9 +32,3 @@ ts from_unixtime(ts)
...
@@ -23,9 +32,3 @@ ts from_unixtime(ts)
1048989599 2003-03-30 03:59:59
1048989599 2003-03-30 03:59:59
1048989601 2003-03-30 04:00:01
1048989601 2003-03-30 04:00:01
DROP TABLE t1;
DROP TABLE t1;
select @a:=FROM_UNIXTIME(1);
@a:=FROM_UNIXTIME(1)
1970-01-01 01:00:01
select unix_timestamp(@a);
unix_timestamp(@a)
1
mysql-test/std_data/loaddata3.dat
0 → 100644
View file @
53108977
number row data
1 row 1
2 row 2
error 12345678901234567890123456789012345678901234567890
3 row 3
wrong end 12345678901234567890123456789012345678901234567890
mysql-test/std_data/loaddata4.dat
0 → 100644
View file @
53108977
test row data 1 row 1 2 row 2 3 row 3
mysql-test/t/insert.test
View file @
53108977
...
@@ -68,7 +68,7 @@ drop table t1;
...
@@ -68,7 +68,7 @@ drop table t1;
create
table
t1
(
email
varchar
(
50
));
create
table
t1
(
email
varchar
(
50
));
insert
into
t1
values
(
'sasha@mysql.com'
),(
'monty@mysql.com'
),(
'foo@hotmail.com'
),(
'foo@aol.com'
),(
'bar@aol.com'
);
insert
into
t1
values
(
'sasha@mysql.com'
),(
'monty@mysql.com'
),(
'foo@hotmail.com'
),(
'foo@aol.com'
),(
'bar@aol.com'
);
create
table
t2
(
id
int
not
null
auto_increment
primary
key
,
t2
varchar
(
50
),
unique
(
t2
));
create
table
t2
(
id
int
not
null
auto_increment
primary
key
,
t2
varchar
(
50
),
unique
(
t2
));
insert
into
t2
(
t2
)
select
distinct
substring
(
email
,
locate
(
'@'
,
email
)
+
1
)
from
t1
;
insert
delayed
into
t2
(
t2
)
select
distinct
substring
(
email
,
locate
(
'@'
,
email
)
+
1
)
from
t1
;
select
*
from
t2
;
select
*
from
t2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
...
...
mysql-test/t/loaddata.test
View file @
53108977
...
@@ -18,3 +18,14 @@ create table t1 (a text, b text);
...
@@ -18,3 +18,14 @@ create table t1 (a text, b text);
load
data
infile
'../../std_data/loaddata2.dat'
into
table
t1
fields
terminated
by
','
enclosed
by
''''
;
load
data
infile
'../../std_data/loaddata2.dat'
into
table
t1
fields
terminated
by
','
enclosed
by
''''
;
select
concat
(
'|'
,
a
,
'|'
),
concat
(
'|'
,
b
,
'|'
)
from
t1
;
select
concat
(
'|'
,
a
,
'|'
),
concat
(
'|'
,
b
,
'|'
)
from
t1
;
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
a
int
,
b
char
(
10
));
load
data
infile
'../../std_data/loaddata3.dat'
into
table
t1
fields
terminated
by
''
enclosed
by
''
ignore
1
lines
;
select
*
from
t1
;
truncate
table
t1
;
load
data
infile
'../../std_data/loaddata4.dat'
into
table
t1
fields
terminated
by
''
enclosed
by
''
lines
terminated
by
''
ignore
1
lines
;
# The empty line last comes from the end line field in the file
select
*
from
t1
;
drop
table
t1
;
mysql-test/t/lowercase_table.test
View file @
53108977
...
@@ -2,19 +2,22 @@
...
@@ -2,19 +2,22 @@
# Test of --lower-case-table-names
# Test of --lower-case-table-names
#
#
drop
table
if
exists
t1
,
t2
,
t3
;
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
T1
;
create
table
T1
(
id
int
primary
key
,
Word
varchar
(
40
)
not
null
,
Index
(
Word
));
create
table
T1
(
id
int
primary
key
,
Word
varchar
(
40
)
not
null
,
Index
(
Word
));
create
table
t4
(
id
int
primary
key
,
Word
varchar
(
40
)
not
null
);
INSERT
INTO
T1
VALUES
(
1
,
'a'
),
(
2
,
'b'
),
(
3
,
'c'
);
INSERT
INTO
T1
VALUES
(
1
,
'a'
),
(
2
,
'b'
),
(
3
,
'c'
);
INSERT
INTO
T4
VALUES
(
1
,
'match'
);
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
SELECT
T1
.
id
from
T1
LIMIT
1
;
SELECT
T1
.
id
from
T1
LIMIT
1
;
SELECT
T2
.
id
from
t1
as
T2
LIMIT
1
;
SELECT
T2
.
id
from
t1
as
T2
LIMIT
1
;
SELECT
*
from
t1
left
join
t4
on
(
test
.
t1
.
id
=
TEST
.
t4
.
id
)
where
TEST
.
t1
.
id
>=
test
.
t4
.
id
;
--
error
1109
--
error
1109
SELECT
T2
.
id
from
t1
as
t2
LIMIT
1
;
SELECT
T2
.
id
from
t1
as
t2
LIMIT
1
;
RENAME
TABLE
T1
TO
T2
;
RENAME
TABLE
T1
TO
T2
;
ALTER
TABLE
T2
ADD
new_col
int
not
null
;
ALTER
TABLE
T2
ADD
new_col
int
not
null
;
ALTER
TABLE
T2
RENAME
T3
;
ALTER
TABLE
T2
RENAME
T3
;
show
tables
like
't_'
;
show
tables
like
't_'
;
drop
table
t3
;
drop
table
t3
,
t4
;
#
#
# Test alias
# Test alias
...
...
mysql-test/t/mysqldump.test
View file @
53108977
...
@@ -25,5 +25,8 @@ DROP TABLE t1;
...
@@ -25,5 +25,8 @@ DROP TABLE t1;
CREATE
TABLE
t1
(
a
double
);
CREATE
TABLE
t1
(
a
double
);
INSERT
INTO
t1
VALUES
(
-
9
e999999
);
INSERT
INTO
t1
VALUES
(
-
9
e999999
);
# The following replaces is here because some systems replaces the above
# double with '-inf' and others with MAX_DOUBLE
--
replace_result
(
-
1.79769313486232e+308
)
(
RES
)
(
NULL
)
(
RES
)
--
exec
$MYSQL_DUMP
--
skip
-
comments
test
t1
--
exec
$MYSQL_DUMP
--
skip
-
comments
test
t1
DROP
TABLE
t1
;
DROP
TABLE
t1
;
mysql-test/t/timezone.test
View file @
53108977
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
--
require
r
/
have_met_timezone
.
require
--
require
r
/
have_met_timezone
.
require
disable_query_log
;
disable_query_log
;
s
how
variables
like
"timezone"
;
s
elect
FROM_UNIXTIME
(
24
*
3600
)
;
enable_query_log
;
enable_query_log
;
# Initialization
# Initialization
...
@@ -11,6 +11,17 @@ enable_query_log;
...
@@ -11,6 +11,17 @@ enable_query_log;
DROP
TABLE
IF
EXISTS
t1
;
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
--
enable_warnings
show
variables
like
"timezone"
;
#
# Test unix timestamp
#
select
@
a
:=
FROM_UNIXTIME
(
1
);
select
unix_timestamp
(
@
a
);
#
# Test of some values, including some with daylight saving time
#
CREATE
TABLE
t1
(
ts
int
);
CREATE
TABLE
t1
(
ts
int
);
INSERT
INTO
t1
(
ts
)
VALUES
(
Unix_timestamp
(
'2002-10-27 01:00'
));
INSERT
INTO
t1
(
ts
)
VALUES
(
Unix_timestamp
(
'2002-10-27 01:00'
));
...
@@ -27,8 +38,3 @@ INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 04:00:01'));
...
@@ -27,8 +38,3 @@ INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 04:00:01'));
SELECT
ts
,
from_unixtime
(
ts
)
FROM
t1
;
SELECT
ts
,
from_unixtime
(
ts
)
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Test unix timestamp
#
select
@
a
:=
FROM_UNIXTIME
(
1
);
select
unix_timestamp
(
@
a
);
sql/item.cc
View file @
53108977
...
@@ -117,6 +117,14 @@ bool Item::get_time(TIME *ltime)
...
@@ -117,6 +117,14 @@ bool Item::get_time(TIME *ltime)
return
0
;
return
0
;
}
}
Item_ident
::
Item_ident
(
const
char
*
db_name_par
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
:
db_name
(
db_name_par
),
table_name
(
table_name_par
),
field_name
(
field_name_par
)
{
name
=
(
char
*
)
field_name_par
;
}
Item_field
::
Item_field
(
Field
*
f
)
:
Item_ident
(
NullS
,
f
->
table_name
,
f
->
field_name
)
Item_field
::
Item_field
(
Field
*
f
)
:
Item_ident
(
NullS
,
f
->
table_name
,
f
->
field_name
)
{
{
set_field
(
f
);
set_field
(
f
);
...
...
sql/item.h
View file @
53108977
...
@@ -119,9 +119,7 @@ public:
...
@@ -119,9 +119,7 @@ public:
const
char
*
table_name
;
const
char
*
table_name
;
const
char
*
field_name
;
const
char
*
field_name
;
Item_ident
(
const
char
*
db_name_par
,
const
char
*
table_name_par
,
Item_ident
(
const
char
*
db_name_par
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
const
char
*
field_name_par
);
:
db_name
(
db_name_par
),
table_name
(
table_name_par
),
field_name
(
field_name_par
)
{
name
=
(
char
*
)
field_name_par
;
}
const
char
*
full_name
()
const
;
const
char
*
full_name
()
const
;
unsigned
int
size_of
()
{
return
sizeof
(
*
this
);}
unsigned
int
size_of
()
{
return
sizeof
(
*
this
);}
};
};
...
...
sql/mysqld.cc
View file @
53108977
...
@@ -500,6 +500,8 @@ static uint set_maximum_open_files(uint max_file_limit);
...
@@ -500,6 +500,8 @@ static uint set_maximum_open_files(uint max_file_limit);
static
ulong
find_bit_type
(
const
char
*
x
,
TYPELIB
*
bit_lib
);
static
ulong
find_bit_type
(
const
char
*
x
,
TYPELIB
*
bit_lib
);
static
void
clean_up
(
bool
print_message
);
static
void
clean_up
(
bool
print_message
);
static
void
clean_up_mutexes
(
void
);
static
void
clean_up_mutexes
(
void
);
static
int
test_if_case_insensitive
(
const
char
*
dir_name
);
static
void
create_pid_file
();
/****************************************************************************
/****************************************************************************
** Code to end mysqld
** Code to end mysqld
...
@@ -1459,17 +1461,7 @@ static void start_signal_handler(void)
...
@@ -1459,17 +1461,7 @@ static void start_signal_handler(void)
{
{
// Save vm id of this process
// Save vm id of this process
if
(
!
opt_bootstrap
)
if
(
!
opt_bootstrap
)
{
create_pid_file
();
File
pidFile
;
if
((
pidFile
=
my_create
(
pidfile_name
,
0664
,
O_WRONLY
|
O_TRUNC
,
MYF
(
MY_WME
)))
>=
0
)
{
char
buff
[
21
];
sprintf
(
buff
,
"%lu
\n
"
,(
ulong
)
getpid
());
(
void
)
my_write
(
pidFile
,
buff
,
strlen
(
buff
),
MYF
(
MY_WME
));
(
void
)
my_close
(
pidFile
,
MYF
(
0
));
}
}
// no signal handler
// no signal handler
}
}
...
@@ -1753,17 +1745,8 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
...
@@ -1753,17 +1745,8 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
/* Save pid to this process (or thread on Linux) */
/* Save pid to this process (or thread on Linux) */
if
(
!
opt_bootstrap
)
if
(
!
opt_bootstrap
)
{
create_pid_file
();
File
pidFile
;
if
((
pidFile
=
my_create
(
pidfile_name
,
0664
,
O_WRONLY
|
O_TRUNC
,
MYF
(
MY_WME
)))
>=
0
)
{
char
buff
[
21
];
sprintf
(
buff
,
"%lu"
,(
ulong
)
getpid
());
(
void
)
my_write
(
pidFile
,
buff
,
strlen
(
buff
),
MYF
(
MY_WME
));
(
void
)
my_close
(
pidFile
,
MYF
(
0
));
}
}
#ifdef HAVE_STACK_TRACE_ON_SEGV
#ifdef HAVE_STACK_TRACE_ON_SEGV
if
(
opt_do_pstack
)
if
(
opt_do_pstack
)
{
{
...
@@ -4963,6 +4946,17 @@ static void fix_paths(void)
...
@@ -4963,6 +4946,17 @@ static void fix_paths(void)
if
(
!
(
slave_load_tmpdir
=
(
char
*
)
my_strdup
(
mysql_tmpdir
,
MYF
(
MY_FAE
))))
if
(
!
(
slave_load_tmpdir
=
(
char
*
)
my_strdup
(
mysql_tmpdir
,
MYF
(
MY_FAE
))))
exit
(
1
);
exit
(
1
);
}
}
/*
Ensure that lower_case_table_names is set on system where we have case
insensitive names. If this is not done the users MyISAM tables will
get corrupted if accesses with names of different case.
*/
if
(
!
lower_case_table_names
&&
test_if_case_insensitive
(
mysql_real_data_home
)
==
1
)
{
sql_print_error
(
"Warning: Setting lower_case_table_names=1 becasue file system %s is case insensitve"
,
mysql_real_data_home
);
}
}
}
...
@@ -5096,6 +5090,60 @@ skipp: ;
...
@@ -5096,6 +5090,60 @@ skipp: ;
}
/* find_bit_type */
}
/* find_bit_type */
/*
Check if file system used for databases is case insensitive
SYNOPSIS
test_if_case_sensitive()
dir_name Directory to test
RETURN
-1 Don't know (Test failed)
0 File system is case sensitive
1 File system is case insensitive
*/
static
int
test_if_case_insensitive
(
const
char
*
dir_name
)
{
int
result
=
0
;
File
file
;
char
buff
[
FN_REFLEN
],
buff2
[
FN_REFLEN
];
MY_STAT
stat_info
;
fn_format
(
buff
,
glob_hostname
,
dir_name
,
".lower-test"
,
MY_UNPACK_FILENAME
|
MY_REPLACE_EXT
|
MY_REPLACE_DIR
);
fn_format
(
buff2
,
glob_hostname
,
dir_name
,
".LOWER-TEST"
,
MY_UNPACK_FILENAME
|
MY_REPLACE_EXT
|
MY_REPLACE_DIR
);
(
void
)
my_delete
(
buff2
,
MYF
(
0
));
if
((
file
=
my_create
(
buff
,
0666
,
O_RDWR
,
MYF
(
0
)))
<
0
)
{
sql_print_error
(
"Warning: Can't create test file %s"
,
buff
);
return
-
1
;
}
my_close
(
file
,
MYF
(
0
));
if
(
my_stat
(
buff2
,
&
stat_info
,
MYF
(
0
)))
result
=
1
;
// Can access file
(
void
)
my_delete
(
buff
,
MYF
(
MY_WME
));
return
result
;
}
/* Create file to store pid number */
static
void
create_pid_file
()
{
File
file
;
if
((
file
=
my_create
(
pidfile_name
,
0664
,
O_WRONLY
|
O_TRUNC
,
MYF
(
MY_WME
)))
>=
0
)
{
char
buff
[
21
];
sprintf
(
buff
,
"%lu
\n
"
,(
ulong
)
getpid
());
(
void
)
my_write
(
file
,
buff
,
strlen
(
buff
),
MYF
(
MY_WME
));
(
void
)
my_close
(
file
,
MYF
(
0
));
}
}
/*****************************************************************************
/*****************************************************************************
Instantiate templates
Instantiate templates
*****************************************************************************/
*****************************************************************************/
...
...
sql/nt_servc.cc
View file @
53108977
...
@@ -496,9 +496,9 @@ BOOL NTService::IsService(LPCSTR ServiceName)
...
@@ -496,9 +496,9 @@ BOOL NTService::IsService(LPCSTR ServiceName)
BOOL
ret_value
=
FALSE
;
BOOL
ret_value
=
FALSE
;
SC_HANDLE
service
,
scm
;
SC_HANDLE
service
,
scm
;
if
(
scm
=
OpenSCManager
(
0
,
0
,
SC_MANAGER_ENUMERATE_SERVICE
))
if
(
(
scm
=
OpenSCManager
(
0
,
0
,
SC_MANAGER_ENUMERATE_SERVICE
)
))
{
{
if
((
service
=
OpenService
(
scm
,
ServiceName
,
SERVICE_
ALL_ACCES
S
)))
if
((
service
=
OpenService
(
scm
,
ServiceName
,
SERVICE_
QUERY_STATU
S
)))
{
{
ret_value
=
TRUE
;
ret_value
=
TRUE
;
CloseServiceHandle
(
service
);
CloseServiceHandle
(
service
);
...
...
sql/opt_range.cc
View file @
53108977
...
@@ -1062,7 +1062,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
...
@@ -1062,7 +1062,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if
(
field
->
key_type
()
==
HA_KEYTYPE_VARTEXT
)
if
(
field
->
key_type
()
==
HA_KEYTYPE_VARTEXT
)
copies
=
2
;
copies
=
2
;
str
=
str2
=
(
char
*
)
alloc_root
(
param
->
mem_root
,
str
=
str2
=
(
char
*
)
alloc_root
(
param
->
mem_root
,
(
key_part
->
part_length
+
maybe_null
)
*
copies
);
(
key_part
->
part_length
+
maybe_null
)
*
copies
+
1
);
if
(
!
str
)
if
(
!
str
)
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
if
(
maybe_null
)
if
(
maybe_null
)
...
@@ -1078,16 +1078,15 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
...
@@ -1078,16 +1078,15 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
uint
length
=
uint2korr
(
str
+
maybe_null
);
uint
length
=
uint2korr
(
str
+
maybe_null
);
char
*
end
;
char
*
end
;
str2
=
str
+
key_part
->
part_length
+
maybe_null
;
str2
=
str
+
key_part
->
part_length
+
maybe_null
;
/* remove end space
. The 2 is for the packed length
*/
/* remove end space */
while
(
length
>
0
&&
str
[
length
+
2
+
maybe_null
-
1
]
==
' '
)
while
(
length
>
0
&&
str
[
length
+
HA_KEY_BLOB_LENGTH
+
maybe_null
-
1
]
==
' '
)
length
--
;
length
--
;
int2store
(
str
+
maybe_null
,
length
);
int2store
(
str
+
maybe_null
,
length
);
/* Create key that is space filled */
/* Create key that is space filled */
memcpy
(
str2
,
str
,
length
+
2
+
maybe_null
);
memcpy
(
str2
,
str
,
length
+
HA_KEY_BLOB_LENGTH
+
maybe_null
);
end
=
str2
+
maybe_null
+
key_part
->
part_length
;
bfill
(
str2
+
length
+
HA_KEY_BLOB_LENGTH
+
maybe_null
,
for
(
char
*
pos
=
str2
+
2
+
length
+
maybe_null
;
pos
<
end
;
pos
++
)
key_part
->
part_length
-
length
-
HA_KEY_BLOB_LENGTH
,
' '
);
*
pos
++=
' '
;
int2store
(
str2
+
maybe_null
,
key_part
->
part_length
-
HA_KEY_BLOB_LENGTH
);
int2store
(
str2
+
maybe_null
,
key_part
->
part_length
);
}
}
if
(
!
(
tree
=
new
SEL_ARG
(
field
,
str
,
str2
)))
if
(
!
(
tree
=
new
SEL_ARG
(
field
,
str
,
str2
)))
DBUG_RETURN
(
0
);
// out of memory
DBUG_RETURN
(
0
);
// out of memory
...
...
sql/sql_base.cc
View file @
53108977
...
@@ -1721,6 +1721,19 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
...
@@ -1721,6 +1721,19 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
const
char
*
table_name
=
item
->
table_name
;
const
char
*
table_name
=
item
->
table_name
;
const
char
*
name
=
item
->
field_name
;
const
char
*
name
=
item
->
field_name
;
uint
length
=
(
uint
)
strlen
(
name
);
uint
length
=
(
uint
)
strlen
(
name
);
char
name_buff
[
NAME_LEN
+
1
];
if
(
db
&&
lower_case_table_names
)
{
/*
convert database to lower case for comparision.
We can't do this in Item_field as this would change the
'name' of the item which may be used in the select list
*/
strmake
(
name_buff
,
db
,
sizeof
(
name_buff
)
-
1
);
casedn_str
(
name_buff
);
db
=
name_buff
;
}
if
(
table_name
)
if
(
table_name
)
{
/* Qualified field */
{
/* Qualified field */
...
...
sql/sql_class.h
View file @
53108977
...
@@ -608,7 +608,7 @@ public:
...
@@ -608,7 +608,7 @@ public:
String
*
field_term
,
*
enclosed
,
*
line_term
,
*
line_start
,
*
escaped
;
String
*
field_term
,
*
enclosed
,
*
line_term
,
*
line_start
,
*
escaped
;
bool
opt_enclosed
;
bool
opt_enclosed
;
bool
dumpfile
;
bool
dumpfile
;
u
int
skip_lines
;
u
long
skip_lines
;
sql_exchange
(
char
*
name
,
bool
dumpfile_flag
);
sql_exchange
(
char
*
name
,
bool
dumpfile_flag
);
~
sql_exchange
()
{}
~
sql_exchange
()
{}
};
};
...
...
sql/sql_load.cc
View file @
53108977
...
@@ -71,10 +71,11 @@ public:
...
@@ -71,10 +71,11 @@ public:
};
};
static
int
read_fixed_length
(
THD
*
thd
,
COPY_INFO
&
info
,
TABLE
*
table
,
static
int
read_fixed_length
(
THD
*
thd
,
COPY_INFO
&
info
,
TABLE
*
table
,
List
<
Item
>
&
fields
,
READ_INFO
&
read_info
);
List
<
Item
>
&
fields
,
READ_INFO
&
read_info
,
ulong
skip_lines
);
static
int
read_sep_field
(
THD
*
thd
,
COPY_INFO
&
info
,
TABLE
*
table
,
static
int
read_sep_field
(
THD
*
thd
,
COPY_INFO
&
info
,
TABLE
*
table
,
List
<
Item
>
&
fields
,
READ_INFO
&
read_info
,
List
<
Item
>
&
fields
,
READ_INFO
&
read_info
,
String
&
enclosed
);
String
&
enclosed
,
ulong
skip_lines
);
int
mysql_load
(
THD
*
thd
,
sql_exchange
*
ex
,
TABLE_LIST
*
table_list
,
int
mysql_load
(
THD
*
thd
,
sql_exchange
*
ex
,
TABLE_LIST
*
table_list
,
...
@@ -85,14 +86,15 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -85,14 +86,15 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
File
file
;
File
file
;
TABLE
*
table
;
TABLE
*
table
;
int
error
;
int
error
;
String
*
field_term
=
ex
->
field_term
,
*
escaped
=
ex
->
escaped
,
String
*
field_term
=
ex
->
field_term
,
*
escaped
=
ex
->
escaped
;
*
enclosed
=
ex
->
enclosed
;
String
*
enclosed
=
ex
->
enclosed
;
bool
is_fifo
=
0
;
bool
is_fifo
=
0
;
LOAD_FILE_INFO
lf_info
;
LOAD_FILE_INFO
lf_info
;
char
*
db
=
table_list
->
db
;
// This is never null
char
*
db
=
table_list
->
db
;
// This is never null
/* If no current database, use database where table is located */
/* If no current database, use database where table is located */
char
*
tdb
=
thd
->
db
?
thd
->
db
:
db
;
char
*
tdb
=
thd
->
db
?
thd
->
db
:
db
;
bool
transactional_table
,
log_delayed
;
bool
transactional_table
,
log_delayed
;
ulong
skip_lines
=
ex
->
skip_lines
;
DBUG_ENTER
(
"mysql_load"
);
DBUG_ENTER
(
"mysql_load"
);
#ifdef EMBEDDED_LIBRARY
#ifdef EMBEDDED_LIBRARY
...
@@ -235,16 +237,18 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -235,16 +237,18 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
thd
->
count_cuted_fields
=
1
;
/* calc cuted fields */
thd
->
count_cuted_fields
=
1
;
/* calc cuted fields */
thd
->
cuted_fields
=
0L
;
thd
->
cuted_fields
=
0L
;
if
(
ex
->
line_term
->
length
()
&&
field_term
->
length
())
/* Skip lines if there is a line terminator */
if
(
ex
->
line_term
->
length
())
{
{
// ex->skip_lines needs to be preserved for logging
/* ex->skip_lines needs to be preserved for logging */
uint
skip_lines
=
ex
->
skip_lines
;
while
(
skip_lines
>
0
)
while
(
skip_lines
--
)
{
{
skip_lines
--
;
if
(
read_info
.
next_line
())
if
(
read_info
.
next_line
())
break
;
break
;
}
}
}
}
if
(
!
(
error
=
test
(
read_info
.
error
)))
if
(
!
(
error
=
test
(
read_info
.
error
)))
{
{
uint
save_time_stamp
=
table
->
time_stamp
;
uint
save_time_stamp
=
table
->
time_stamp
;
...
@@ -260,9 +264,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -260,9 +264,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table
->
file
->
deactivate_non_unique_index
((
ha_rows
)
0
);
table
->
file
->
deactivate_non_unique_index
((
ha_rows
)
0
);
table
->
copy_blobs
=
1
;
table
->
copy_blobs
=
1
;
if
(
!
field_term
->
length
()
&&
!
enclosed
->
length
())
if
(
!
field_term
->
length
()
&&
!
enclosed
->
length
())
error
=
read_fixed_length
(
thd
,
info
,
table
,
fields
,
read_info
);
error
=
read_fixed_length
(
thd
,
info
,
table
,
fields
,
read_info
,
skip_lines
);
else
else
error
=
read_sep_field
(
thd
,
info
,
table
,
fields
,
read_info
,
*
enclosed
);
error
=
read_sep_field
(
thd
,
info
,
table
,
fields
,
read_info
,
*
enclosed
,
skip_lines
);
if
(
table
->
file
->
extra
(
HA_EXTRA_NO_CACHE
))
if
(
table
->
file
->
extra
(
HA_EXTRA_NO_CACHE
))
error
=
1
;
/* purecov: inspected */
error
=
1
;
/* purecov: inspected */
if
(
table
->
file
->
activate_all_index
(
thd
))
if
(
table
->
file
->
activate_all_index
(
thd
))
...
@@ -271,7 +277,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -271,7 +277,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table
->
time_stamp
=
save_time_stamp
;
table
->
time_stamp
=
save_time_stamp
;
table
->
next_number_field
=
0
;
table
->
next_number_field
=
0
;
}
}
if
(
file
>=
0
)
my_close
(
file
,
MYF
(
0
));
if
(
file
>=
0
)
my_close
(
file
,
MYF
(
0
));
free_blobs
(
table
);
/* if pack_blob was used */
free_blobs
(
table
);
/* if pack_blob was used */
table
->
copy_blobs
=
0
;
table
->
copy_blobs
=
0
;
thd
->
count_cuted_fields
=
0
;
/* Don`t calc cuted fields */
thd
->
count_cuted_fields
=
0
;
/* Don`t calc cuted fields */
...
@@ -369,7 +376,7 @@ err:
...
@@ -369,7 +376,7 @@ err:
static
int
static
int
read_fixed_length
(
THD
*
thd
,
COPY_INFO
&
info
,
TABLE
*
table
,
List
<
Item
>
&
fields
,
read_fixed_length
(
THD
*
thd
,
COPY_INFO
&
info
,
TABLE
*
table
,
List
<
Item
>
&
fields
,
READ_INFO
&
read_info
)
READ_INFO
&
read_info
,
ulong
skip_lines
)
{
{
List_iterator_fast
<
Item
>
it
(
fields
);
List_iterator_fast
<
Item
>
it
(
fields
);
Item_field
*
sql_field
;
Item_field
*
sql_field
;
...
@@ -388,6 +395,17 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
...
@@ -388,6 +395,17 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
my_error
(
ER_SERVER_SHUTDOWN
,
MYF
(
0
));
my_error
(
ER_SERVER_SHUTDOWN
,
MYF
(
0
));
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
if
(
skip_lines
)
{
/*
We could implement this with a simple seek if:
- We are not using DATA INFILE LOCAL
- escape character is ""
- line starting prefix is ""
*/
skip_lines
--
;
continue
;
}
it
.
rewind
();
it
.
rewind
();
byte
*
pos
=
read_info
.
row_start
;
byte
*
pos
=
read_info
.
row_start
;
#ifdef HAVE_purify
#ifdef HAVE_purify
...
@@ -444,7 +462,7 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
...
@@ -444,7 +462,7 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
static
int
static
int
read_sep_field
(
THD
*
thd
,
COPY_INFO
&
info
,
TABLE
*
table
,
read_sep_field
(
THD
*
thd
,
COPY_INFO
&
info
,
TABLE
*
table
,
List
<
Item
>
&
fields
,
READ_INFO
&
read_info
,
List
<
Item
>
&
fields
,
READ_INFO
&
read_info
,
String
&
enclosed
)
String
&
enclosed
,
ulong
skip_lines
)
{
{
List_iterator_fast
<
Item
>
it
(
fields
);
List_iterator_fast
<
Item
>
it
(
fields
);
Item_field
*
sql_field
;
Item_field
*
sql_field
;
...
@@ -494,6 +512,12 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
...
@@ -494,6 +512,12 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
}
}
if
(
read_info
.
error
)
if
(
read_info
.
error
)
break
;
break
;
if
(
skip_lines
)
{
if
(
!--
skip_lines
)
thd
->
cuted_fields
=
0L
;
// Reset warnings
continue
;
}
if
(
sql_field
)
if
(
sql_field
)
{
// Last record
{
// Last record
if
(
sql_field
==
(
Item_field
*
)
fields
.
head
())
if
(
sql_field
==
(
Item_field
*
)
fields
.
head
())
...
@@ -821,7 +845,18 @@ found_eof:
...
@@ -821,7 +845,18 @@ found_eof:
}
}
/*
/*
** One can't use fixed length with multi-byte charset **
Read a row with fixed length.
NOTES
The row may not be fixed size on disk if there are escape
characters in the file.
IMPLEMENTATION NOTE
One can't use fixed length with multi-byte charset **
RETURN
0 ok
1 error
*/
*/
int
READ_INFO
::
read_fixed_length
()
int
READ_INFO
::
read_fixed_length
()
...
...
sql/sql_parse.cc
View file @
53108977
...
@@ -1971,12 +1971,11 @@ mysql_execute_command(void)
...
@@ -1971,12 +1971,11 @@ mysql_execute_command(void)
case
SQLCOM_REPLACE_SELECT
:
case
SQLCOM_REPLACE_SELECT
:
case
SQLCOM_INSERT_SELECT
:
case
SQLCOM_INSERT_SELECT
:
{
{
{
/*
/*
Check that we have modify privileges for the first table and
Check that we have modify privileges for the first table and
select privileges for the rest
select privileges for the rest
*/
*/
{
ulong
privilege
=
(
lex
->
sql_command
==
SQLCOM_INSERT_SELECT
?
ulong
privilege
=
(
lex
->
sql_command
==
SQLCOM_INSERT_SELECT
?
INSERT_ACL
:
INSERT_ACL
|
DELETE_ACL
);
INSERT_ACL
:
INSERT_ACL
|
DELETE_ACL
);
TABLE_LIST
*
save_next
=
tables
->
next
;
TABLE_LIST
*
save_next
=
tables
->
next
;
...
@@ -1989,6 +1988,10 @@ mysql_execute_command(void)
...
@@ -1989,6 +1988,10 @@ mysql_execute_command(void)
if
((
res
=
check_table_access
(
thd
,
SELECT_ACL
,
save_next
)))
if
((
res
=
check_table_access
(
thd
,
SELECT_ACL
,
save_next
)))
goto
error
;
goto
error
;
}
}
/* Fix lock for first table */
if
(
tables
->
lock_type
==
TL_WRITE_DELAYED
)
tables
->
lock_type
==
TL_WRITE
;
/* Don't unlock tables until command is written to binary log */
/* Don't unlock tables until command is written to binary log */
select_lex
->
options
|=
SELECT_NO_UNLOCK
;
select_lex
->
options
|=
SELECT_NO_UNLOCK
;
...
...
sql/sql_update.cc
View file @
53108977
...
@@ -440,7 +440,7 @@ multi_update::multi_update(THD *thd_arg, TABLE_LIST *table_list,
...
@@ -440,7 +440,7 @@ multi_update::multi_update(THD *thd_arg, TABLE_LIST *table_list,
:
all_tables
(
table_list
),
update_tables
(
0
),
thd
(
thd_arg
),
tmp_tables
(
0
),
:
all_tables
(
table_list
),
update_tables
(
0
),
thd
(
thd_arg
),
tmp_tables
(
0
),
updated
(
0
),
found
(
0
),
fields
(
field_list
),
values
(
value_list
),
updated
(
0
),
found
(
0
),
fields
(
field_list
),
values
(
value_list
),
table_count
(
0
),
copy_field
(
0
),
handle_duplicates
(
handle_duplicates_arg
),
table_count
(
0
),
copy_field
(
0
),
handle_duplicates
(
handle_duplicates_arg
),
do_update
(
1
),
trans_safe
(
0
)
do_update
(
1
),
trans_safe
(
0
)
,
transactional_tables
(
1
)
{}
{}
...
...
strings/ctype-tis620.c
View file @
53108977
...
@@ -538,7 +538,9 @@ int my_strnncoll_tis620(const uchar * s1, int len1, const uchar * s2, int len2)
...
@@ -538,7 +538,9 @@ int my_strnncoll_tis620(const uchar * s1, int len1, const uchar * s2, int len2)
tc1
=
thai2sortable
(
s1
,
len1
);
tc1
=
thai2sortable
(
s1
,
len1
);
tc2
=
thai2sortable
(
s2
,
len2
);
tc2
=
thai2sortable
(
s2
,
len2
);
i
=
strcmp
((
char
*
)
tc1
,
(
char
*
)
tc2
);
i
=
strcmp
((
char
*
)
tc1
,
(
char
*
)
tc2
);
if
(
tc1
!=
s1
)
free
(
tc1
);
free
(
tc1
);
if
(
tc2
!=
s2
)
free
(
tc2
);
free
(
tc2
);
return
i
;
return
i
;
}
}
...
@@ -555,6 +557,7 @@ int my_strnxfrm_tis620(uchar * dest, const uchar * src, int len, int srclen)
...
@@ -555,6 +557,7 @@ int my_strnxfrm_tis620(uchar * dest, const uchar * src, int len, int srclen)
tmp
=
thai2sortable
(
src
,
srclen
);
tmp
=
thai2sortable
(
src
,
srclen
);
set_if_smaller
(
bufSize
,(
uint
)
len
);
set_if_smaller
(
bufSize
,(
uint
)
len
);
memcpy
((
uchar
*
)
dest
,
tmp
,
bufSize
);
memcpy
((
uchar
*
)
dest
,
tmp
,
bufSize
);
if
(
tmp
!=
src
)
free
(
tmp
);
free
(
tmp
);
return
(
int
)
bufSize
;
return
(
int
)
bufSize
;
}
}
...
@@ -570,7 +573,9 @@ int my_strcoll_tis620(const uchar * s1, const uchar * s2)
...
@@ -570,7 +573,9 @@ int my_strcoll_tis620(const uchar * s1, const uchar * s2)
tc1
=
thai2sortable
(
s1
,
(
int
)
strlen
((
char
*
)
s1
));
tc1
=
thai2sortable
(
s1
,
(
int
)
strlen
((
char
*
)
s1
));
tc2
=
thai2sortable
(
s2
,
(
int
)
strlen
((
char
*
)
s2
));
tc2
=
thai2sortable
(
s2
,
(
int
)
strlen
((
char
*
)
s2
));
i
=
strcmp
((
char
*
)
tc1
,
(
char
*
)
tc2
);
i
=
strcmp
((
char
*
)
tc1
,
(
char
*
)
tc2
);
if
(
tc1
!=
s1
)
free
(
tc1
);
free
(
tc1
);
if
(
tc2
!=
s2
)
free
(
tc2
);
free
(
tc2
);
return
i
;
return
i
;
}
}
...
@@ -587,6 +592,7 @@ int my_strxfrm_tis620(uchar * dest, const uchar * src, int len)
...
@@ -587,6 +592,7 @@ int my_strxfrm_tis620(uchar * dest, const uchar * src, int len)
bufSize
=
(
uint
)
buffsize
((
char
*
)
src
);
bufSize
=
(
uint
)
buffsize
((
char
*
)
src
);
tmp
=
thai2sortable
(
src
,
len
);
tmp
=
thai2sortable
(
src
,
len
);
memcpy
((
uchar
*
)
dest
,
tmp
,
bufSize
);
memcpy
((
uchar
*
)
dest
,
tmp
,
bufSize
);
if
(
tmp
!=
src
)
free
(
tmp
);
free
(
tmp
);
return
bufSize
;
return
bufSize
;
}
}
...
...
support-files/mysql.server.sh
View file @
53108977
...
@@ -145,7 +145,7 @@ case "$mode" in
...
@@ -145,7 +145,7 @@ case "$mode" in
then
then
# Give extra arguments to mysqld with the my.cnf file. This script may
# Give extra arguments to mysqld with the my.cnf file. This script may
# be overwritten at next upgrade.
# be overwritten at next upgrade.
$bindir
/mysqld_safe
--datadir
=
$datadir
--pid-file
=
$pid_file
&
$bindir
/mysqld_safe
--datadir
=
$datadir
--pid-file
=
$pid_file
>
/dev/null 2>&1
&
# Make lock for RedHat / SuSE
# Make lock for RedHat / SuSE
if
test
-w
/var/lock/subsys
if
test
-w
/var/lock/subsys
then
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment