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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4d45ad98
Commit
4d45ad98
authored
Oct 15, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mashka.mysql.fi:/home/my/mysql-4.0
parents
33e5f4ed
84d9d980
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
33 deletions
+86
-33
include/mysql.h
include/mysql.h
+3
-0
libmysql/libmysql.c
libmysql/libmysql.c
+2
-2
mysql-test/r/create.result
mysql-test/r/create.result
+16
-0
mysql-test/t/create.test
mysql-test/t/create.test
+37
-12
mysys/my_chsize.c
mysys/my_chsize.c
+7
-6
sql/handler.h
sql/handler.h
+9
-9
sql/slave.cc
sql/slave.cc
+2
-0
sql/sql_class.h
sql/sql_class.h
+2
-2
sql/sql_insert.cc
sql/sql_insert.cc
+1
-2
sql/sql_table.cc
sql/sql_table.cc
+7
-0
No files found.
include/mysql.h
View file @
4d45ad98
...
...
@@ -60,6 +60,9 @@ typedef int my_socket;
extern
unsigned
int
mysql_port
;
extern
char
*
mysql_unix_port
;
#define CLIENT_NET_READ_TIMEOUT 365*24*3600
/* Timeout on read */
#define CLIENT_NET_WRITE_TIMEOUT 365*24*3600
/* Timeout on write */
#ifdef __NETWARE__
#pragma pack(push, 8)
/* 8 byte alignment */
#endif
...
...
libmysql/libmysql.c
View file @
4d45ad98
...
...
@@ -64,8 +64,8 @@ uint mysql_port=0;
my_string
mysql_unix_port
=
0
;
ulong
net_buffer_length
=
8192
;
ulong
max_allowed_packet
=
1024L
*
1024L
*
1024L
;
ulong
net_read_timeout
=
NET_READ_TIMEOUT
;
ulong
net_write_timeout
=
NET_WRITE_TIMEOUT
;
ulong
net_read_timeout
=
CLIENT_
NET_READ_TIMEOUT
;
ulong
net_write_timeout
=
CLIENT_
NET_WRITE_TIMEOUT
;
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS)
...
...
mysql-test/r/create.result
View file @
4d45ad98
...
...
@@ -200,3 +200,19 @@ select * from t1;
0 1 2
0 0 1
drop table t1;
create table t1 (a int not null, b int, primary key (a));
insert into t1 values (1,1);
create table if not exists t1 select 2;
select * from t1;
a b
1 1
0 2
create table if not exists t1 select 3 as 'a',4 as 'b';
create table if not exists t1 select 3 as 'a',3 as 'b';
Duplicate entry '3' for key 1
select * from t1;
a b
1 1
0 2
3 4
drop table t1;
mysql-test/t/create.test
View file @
4d45ad98
...
...
@@ -18,21 +18,30 @@ drop table if exists t1;
# Test of some CREATE TABLE'S that should fail
#
!
$
1146
create
table
t2
type
=
heap
select
*
from
t1
;
!
$
1146
create
table
t2
select
auto
+
1
from
t1
;
--
error
1146
create
table
t2
type
=
heap
select
*
from
t1
;
--
error
1146
create
table
t2
select
auto
+
1
from
t1
;
drop
table
if
exists
t1
,
t2
;
!
$
1167
create
table
t1
(
b
char
(
0
)
not
null
,
index
(
b
));
!
$
1164
create
table
t1
(
a
int
not
null
auto_increment
,
primary
key
(
a
))
type
=
heap
;
!
$
1163
create
table
t1
(
a
int
not
null
,
b
text
)
type
=
heap
;
--
error
1167
create
table
t1
(
b
char
(
0
)
not
null
,
index
(
b
));
--
error
1164
create
table
t1
(
a
int
not
null
auto_increment
,
primary
key
(
a
))
type
=
heap
;
--
error
1163
create
table
t1
(
a
int
not
null
,
b
text
)
type
=
heap
;
drop
table
if
exists
t1
;
!
$
1164
create
table
t1
(
ordid
int
(
8
)
not
null
auto_increment
,
ord
varchar
(
50
)
not
null
,
primary
key
(
ord
,
ordid
))
type
=
heap
;
--
error
1164
create
table
t1
(
ordid
int
(
8
)
not
null
auto_increment
,
ord
varchar
(
50
)
not
null
,
primary
key
(
ord
,
ordid
))
type
=
heap
;
--
error
1044
,
1
create
table
not_existing_database
.
test
(
a
int
);
!
$
1103
create
table
`a/a`
(
a
int
);
!
$
1103
create
table
`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`
(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
int
);
!
$
1059
create
table
a
(
`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`
int
);
--
error
1103
create
table
`a/a`
(
a
int
);
--
error
1103
create
table
`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`
(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
int
);
--
error
1059
create
table
a
(
`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`
int
);
#
# test of dummy table names
...
...
@@ -123,9 +132,12 @@ drop table t1;
#
create
table
t1
(
k1
varchar
(
2
),
k2
int
,
primary
key
(
k1
,
k2
));
insert
into
t1
values
(
"a"
,
1
),
(
"b"
,
2
);
!
$
1048
insert
into
t1
values
(
"c"
,
NULL
);
!
$
1048
insert
into
t1
values
(
NULL
,
3
);
!
$
1048
insert
into
t1
values
(
NULL
,
NULL
);
--
error
1048
insert
into
t1
values
(
"c"
,
NULL
);
--
error
1048
insert
into
t1
values
(
NULL
,
3
);
--
error
1048
insert
into
t1
values
(
NULL
,
NULL
);
drop
table
t1
;
#
...
...
@@ -154,3 +166,16 @@ create table if not exists t1 select 1;
select
*
from
t1
;
drop
table
t1
;
#
# Test create table if not exists with duplicate key error
#
create
table
t1
(
a
int
not
null
,
b
int
,
primary
key
(
a
));
insert
into
t1
values
(
1
,
1
);
create
table
if
not
exists
t1
select
2
;
select
*
from
t1
;
create
table
if
not
exists
t1
select
3
as
'a'
,
4
as
'b'
;
--
error
1062
create
table
if
not
exists
t1
select
3
as
'a'
,
3
as
'b'
;
select
*
from
t1
;
drop
table
t1
;
mysys/my_chsize.c
View file @
4d45ad98
...
...
@@ -51,16 +51,17 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
#if defined(HAVE_SETFILEPOINTER)
/* This is for the moment only true on windows */
{
long
is_success
;
HANDLE
win_file
=
(
HANDLE
)
_get_osfhandle
(
fd
);
long
length_low
,
length_high
;
length_low
=
(
long
)
(
ulong
)
newlength
;
length_high
=
(
long
)
((
ulonglong
)
newlength
>>
32
);
i
f
(
SetFilePointer
(
win_file
,
length_low
,
&
length_high
,
FILE_BEGIN
))
{
if
(
SetEndOfFile
(
win_file
))
DBUG_RETURN
(
0
);
}
my_errno
=
errno
;
i
s_success
=
SetFilePointer
(
win_file
,
length_low
,
&
length_high
,
FILE_BEGIN
);
if
(
is_success
==
-
1
&&
(
my_errno
=
GetLastError
())
!=
NO_ERROR
)
goto
err
;
if
(
SetEndOfFile
(
win_file
))
DBUG_RETURN
(
0
);
my_errno
=
GetLastError
()
;
goto
err
;
}
#elif defined(HAVE_FTRUNCATE)
...
...
sql/handler.h
View file @
4d45ad98
...
...
@@ -149,21 +149,21 @@ enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
typedef
struct
st_ha_create_information
{
ulong
table_options
;
enum
db_type
db_type
;
enum
row_type
row_type
;
ulong
avg_row_length
;
ulonglong
max_rows
,
min_rows
;
ulonglong
auto_increment_value
;
char
*
comment
,
*
password
;
char
*
data_file_name
,
*
index_file_name
;
uint
options
;
/* OR of HA_CREATE_ options */
uint
raid_type
,
raid_chunks
;
ulonglong
max_rows
,
min_rows
;
ulonglong
auto_increment_value
;
ulong
table_options
;
ulong
avg_row_length
;
ulong
raid_chunksize
;
bool
if_not_exists
;
ulong
used_fields
;
SQL_LIST
merge_list
;
enum
db_type
db_type
;
enum
row_type
row_type
;
uint
options
;
/* OR of HA_CREATE_ options */
uint
raid_type
,
raid_chunks
;
uint
merge_insert_method
;
bool
table_existed
;
/* 1 in create if table existed */
}
HA_CREATE_INFO
;
...
...
sql/slave.cc
View file @
4d45ad98
...
...
@@ -2719,6 +2719,8 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
RPL_LOG_NAME
,
llstr
(
rli
->
master_log_pos
,
llbuff
));
err:
/* Free temporary tables etc */
thd
->
cleanup
();
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
query
=
thd
->
db
=
0
;
// extra safety
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
...
...
sql/sql_class.h
View file @
4d45ad98
...
...
@@ -708,7 +708,6 @@ class select_create: public select_insert {
HA_CREATE_INFO
*
create_info
;
MYSQL_LOCK
*
lock
;
Field
**
field
;
my_bool
do_not_drop
;
public:
select_create
(
const
char
*
db_name
,
const
char
*
table_name
,
HA_CREATE_INFO
*
create_info_par
,
...
...
@@ -717,7 +716,7 @@ class select_create: public select_insert {
List
<
Item
>
&
select_fields
,
enum_duplicates
duplic
)
:
select_insert
(
NULL
,
&
select_fields
,
duplic
),
db
(
db_name
),
name
(
table_name
),
extra_fields
(
&
fields_par
),
keys
(
&
keys_par
),
create_info
(
create_info_par
),
lock
(
0
)
,
do_not_drop
(
0
)
create_info
(
create_info_par
),
lock
(
0
)
{}
int
prepare
(
List
<
Item
>
&
list
);
bool
send_data
(
List
<
Item
>
&
values
);
...
...
@@ -725,6 +724,7 @@ class select_create: public select_insert {
void
abort
();
};
class
select_union
:
public
select_result
{
public:
TABLE
*
table
;
...
...
sql/sql_insert.cc
View file @
4d45ad98
...
...
@@ -1440,7 +1440,6 @@ select_create::prepare(List<Item> &values)
if
(
table
->
fields
<
values
.
elements
)
{
do_not_drop
=
1
;
my_printf_error
(
ER_WRONG_VALUE_COUNT_ON_ROW
,
ER
(
ER_WRONG_VALUE_COUNT_ON_ROW
),
MYF
(
0
),
1
);
...
...
@@ -1528,7 +1527,7 @@ void select_create::abort()
enum
db_type
table_type
=
table
->
db_type
;
if
(
!
table
->
tmp_table
)
hash_delete
(
&
open_cache
,(
byte
*
)
table
);
if
(
!
do_not_drop
)
if
(
!
create_info
->
table_existed
)
quick_rm_table
(
table_type
,
db
,
name
);
table
=
0
;
}
...
...
sql/sql_table.cc
View file @
4d45ad98
...
...
@@ -728,7 +728,10 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
&&
find_temporary_table
(
thd
,
db
,
table_name
))
{
if
(
create_info
->
options
&
HA_LEX_CREATE_IF_NOT_EXISTS
)
{
create_info
->
table_existed
=
1
;
// Mark that table existed
DBUG_RETURN
(
0
);
}
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
table_name
);
DBUG_RETURN
(
-
1
);
}
...
...
@@ -739,13 +742,17 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
if
(
create_info
->
options
&
HA_LEX_CREATE_IF_NOT_EXISTS
)
{
create_info
->
table_existed
=
1
;
// Mark that table existed
DBUG_RETURN
(
0
);
}
my_error
(
ER_TABLE_EXISTS_ERROR
,
MYF
(
0
),
table_name
);
DBUG_RETURN
(
-
1
);
}
}
thd
->
proc_info
=
"creating table"
;
create_info
->
table_existed
=
0
;
// Mark that table is created
if
(
thd
->
sql_mode
&
MODE_NO_DIR_IN_CREATE
)
create_info
->
data_file_name
=
create_info
->
index_file_name
=
0
;
...
...
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