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
47cd41b0
Commit
47cd41b0
authored
Nov 27, 2008
by
Horst Hunger
Browse files
Options
Browse Files
Download
Plain Diff
due to merge.
parents
e6f9a2e1
302152fc
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
250 additions
and
2 deletions
+250
-2
extra/perror.c
extra/perror.c
+38
-2
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+6
-0
mysql-test/r/perror-win.result
mysql-test/r/perror-win.result
+5
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+30
-0
mysql-test/t/innodb_mysql.test
mysql-test/t/innodb_mysql.test
+10
-0
mysql-test/t/perror-win.test
mysql-test/t/perror-win.test
+11
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+36
-0
sql/field.cc
sql/field.cc
+2
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/sql_base.cc
sql/sql_base.cc
+3
-0
sql/sql_update.cc
sql/sql_update.cc
+26
-0
tests/mysql_client_test.c
tests/mysql_client_test.c
+82
-0
No files found.
extra/perror.c
View file @
47cd41b0
...
...
@@ -185,11 +185,36 @@ static const char *get_ha_error_msg(int code)
}
#if defined(__WIN__)
static
my_bool
print_win_error_msg
(
DWORD
error
,
my_bool
verbose
)
{
LPTSTR
s
;
if
(
FormatMessage
(
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
error
,
0
,
(
LPTSTR
)
&
s
,
0
,
NULL
))
{
if
(
verbose
)
printf
(
"Win32 error code %d: %s"
,
error
,
s
);
else
puts
(
s
);
LocalFree
(
s
);
return
0
;
}
return
1
;
}
#endif
int
main
(
int
argc
,
char
*
argv
[])
{
int
error
,
code
,
found
;
const
char
*
msg
;
char
*
unknown_error
=
0
;
#if defined(__WIN__)
my_bool
skip_win_message
=
0
;
#endif
MY_INIT
(
argv
[
0
]);
if
(
get_options
(
&
argc
,
&
argv
))
...
...
@@ -293,9 +318,20 @@ int main(int argc,char *argv[])
}
if
(
!
found
)
{
fprintf
(
stderr
,
"Illegal error code: %d
\n
"
,
code
);
error
=
1
;
#if defined(__WIN__)
if
(
!
(
skip_win_message
=
!
print_win_error_msg
((
DWORD
)
code
,
verbose
)))
{
#endif
fprintf
(
stderr
,
"Illegal error code: %d
\n
"
,
code
);
error
=
1
;
#if defined(__WIN__)
}
#endif
}
#if defined(__WIN__)
if
(
!
skip_win_message
)
print_win_error_msg
((
DWORD
)
code
,
verbose
);
#endif
}
}
...
...
mysql-test/r/innodb_mysql.result
View file @
47cd41b0
...
...
@@ -1677,3 +1677,9 @@ select @@session.sql_log_bin, @@session.binlog_format, @@session.tx_isolation;
CREATE TABLE t1 ( a INT ) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
CREATE INDEX i1 on t1 (a(3));
SELECT * FROM t1 WHERE a = 'abcde';
a
DROP TABLE t1;
mysql-test/r/perror-win.result
0 → 100644
View file @
47cd41b0
MySQL error code 150: Foreign key constraint is incorrectly formed
Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
OS error code 23: Too many open files in system
Win32 error code 23: Data error (cyclic redundancy check).
Win32 error code 15000: The specified channel path is invalid.
mysql-test/r/subselect.result
View file @
47cd41b0
...
...
@@ -4448,4 +4448,34 @@ SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT
a incorrect
1 1
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (id int);
CREATE TABLE t2 (id int, c int);
INSERT INTO t1 (id) VALUES (1);
INSERT INTO t2 (id) VALUES (1);
INSERT INTO t1 (id) VALUES (1);
INSERT INTO t2 (id) VALUES (1);
CREATE VIEW v1 AS
SELECT t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
UPDATE v1 SET c=1;
CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CHECK OPTION failed 'test.v2'
INSERT INTO v2(a,b) VALUES (1,2);
SELECT * FROM v1;
c
1
1
1
1
2
2
CREATE VIEW v3 AS
SELECT t2.c AS c FROM t2
WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
DELETE FROM v3;
DROP VIEW v1,v2,v3;
DROP TABLE t1,t2;
End of 5.1 tests.
mysql-test/t/innodb_mysql.test
View file @
47cd41b0
...
...
@@ -43,3 +43,13 @@ CREATE TABLE t1 ( a INT ) ENGINE=InnoDB;
INSERT
INTO
t1
VALUES
(
1
);
DROP
TABLE
t1
;
#
# Bug#37284 Crash in Field_string::type()
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
CREATE
TABLE
t1
(
a
char
(
50
))
ENGINE
=
InnoDB
;
CREATE
INDEX
i1
on
t1
(
a
(
3
));
SELECT
*
FROM
t1
WHERE
a
=
'abcde'
;
DROP
TABLE
t1
;
mysql-test/t/perror-win.test
0 → 100644
View file @
47cd41b0
# Windows-specific tests
--
source
include
/
windows
.
inc
--
require
r
/
have_perror
.
require
disable_query_log
;
eval
select
LENGTH
(
"
$MY_PERROR
"
)
>
0
as
"have_perror"
;
enable_query_log
;
--
exec
$MY_PERROR
150
--
exec
$MY_PERROR
23
--
exec
$MY_PERROR
15000
mysql-test/t/subselect.test
View file @
47cd41b0
...
...
@@ -3355,4 +3355,40 @@ SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT
SELECT
t1
.
a
,
(
SELECT
1
FROM
t2
WHERE
t2
.
b
=
t3
.
c
AND
t2
.
c
=
t1
.
a
ORDER
BY
t2
.
d
LIMIT
1
)
AS
incorrect
FROM
t1
,
t3
WHERE
t3
.
b
=
t1
.
a
;
DROP
TABLE
t1
,
t2
,
t3
;
#
# Bug#37460 Assertion failed:
# !table->file || table->file->inited == handler::NONE
#
CREATE
TABLE
t1
(
id
int
);
CREATE
TABLE
t2
(
id
int
,
c
int
);
INSERT
INTO
t1
(
id
)
VALUES
(
1
);
INSERT
INTO
t2
(
id
)
VALUES
(
1
);
INSERT
INTO
t1
(
id
)
VALUES
(
1
);
INSERT
INTO
t2
(
id
)
VALUES
(
1
);
CREATE
VIEW
v1
AS
SELECT
t2
.
c
AS
c
FROM
t1
,
t2
WHERE
t1
.
id
=
t2
.
id
AND
1
IN
(
SELECT
id
FROM
t1
)
WITH
CHECK
OPTION
;
UPDATE
v1
SET
c
=
1
;
CREATE
VIEW
v2
(
a
,
b
)
AS
SELECT
t2
.
id
,
t2
.
c
AS
c
FROM
t1
,
t2
WHERE
t1
.
id
=
t2
.
id
AND
1
IN
(
SELECT
id
FROM
t1
)
WITH
CHECK
OPTION
;
--
error
1369
INSERT
INTO
v2
(
a
,
b
)
VALUES
(
2
,
2
);
INSERT
INTO
v2
(
a
,
b
)
VALUES
(
1
,
2
);
SELECT
*
FROM
v1
;
CREATE
VIEW
v3
AS
SELECT
t2
.
c
AS
c
FROM
t2
WHERE
1
IN
(
SELECT
id
FROM
t1
)
WITH
CHECK
OPTION
;
DELETE
FROM
v3
;
DROP
VIEW
v1
,
v2
,
v3
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.1
tests
.
sql/field.cc
View file @
47cd41b0
...
...
@@ -5814,6 +5814,7 @@ int Field_newdate::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
{
char
buff
[
MAX_DATE_STRING_REP_LENGTH
];
String
str
(
buff
,
sizeof
(
buff
),
&
my_charset_latin1
);
tmp
=
0
;
make_date
((
DATE_TIME_FORMAT
*
)
0
,
ltime
,
&
str
);
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
str
.
ptr
(),
str
.
length
(),
MYSQL_TIMESTAMP_DATE
,
1
);
...
...
@@ -6056,6 +6057,7 @@ int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
{
char
buff
[
MAX_DATE_STRING_REP_LENGTH
];
String
str
(
buff
,
sizeof
(
buff
),
&
my_charset_latin1
);
tmp
=
0
;
make_datetime
((
DATE_TIME_FORMAT
*
)
0
,
ltime
,
&
str
);
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
str
.
ptr
(),
str
.
length
(),
MYSQL_TIMESTAMP_DATETIME
,
1
);
...
...
sql/mysql_priv.h
View file @
47cd41b0
...
...
@@ -548,6 +548,7 @@ class Default_object_creation_ctx : public Object_creation_ctx
#define UNCACHEABLE_PREPARE 16
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
#define UNCACHEABLE_UNITED 32
#define UNCACHEABLE_CHECKOPTION 64
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
#define UNDEF_POS (-1)
...
...
sql/sql_base.cc
View file @
47cd41b0
...
...
@@ -3095,7 +3095,10 @@ bool reopen_table(TABLE *table)
for
(
key
=
0
;
key
<
table
->
s
->
keys
;
key
++
)
{
for
(
part
=
0
;
part
<
table
->
key_info
[
key
].
usable_key_parts
;
part
++
)
{
table
->
key_info
[
key
].
key_part
[
part
].
field
->
table
=
table
;
table
->
key_info
[
key
].
key_part
[
part
].
field
->
orig_table
=
table
;
}
}
if
(
table
->
triggers
)
table
->
triggers
->
set_table
(
table
);
...
...
sql/sql_update.cc
View file @
47cd41b0
...
...
@@ -1470,6 +1470,32 @@ multi_update::initialize_tables(JOIN *join)
}
table
->
prepare_for_position
();
/*
enable uncacheable flag if we update a view with check option
and check option has a subselect, otherwise, the check option
can be evaluated after the subselect was freed as independent
(See full_local in JOIN::join_free()).
*/
if
(
table_ref
->
check_option
&&
!
join
->
select_lex
->
uncacheable
)
{
SELECT_LEX_UNIT
*
tmp_unit
;
SELECT_LEX
*
sl
;
for
(
tmp_unit
=
join
->
select_lex
->
first_inner_unit
();
tmp_unit
;
tmp_unit
=
tmp_unit
->
next_unit
())
{
for
(
sl
=
tmp_unit
->
first_select
();
sl
;
sl
=
sl
->
next_select
())
{
if
(
sl
->
master_unit
()
->
item
)
{
join
->
select_lex
->
uncacheable
|=
UNCACHEABLE_CHECKOPTION
;
goto
loop_end
;
}
}
}
}
loop_end:
if
(
table
==
first_table_for_update
&&
table_ref
->
check_option
)
{
table_map
unupdated_tables
=
table_ref
->
check_option
->
used_tables
()
&
...
...
tests/mysql_client_test.c
View file @
47cd41b0
...
...
@@ -17576,6 +17576,87 @@ static void test_bug38486(void)
DBUG_VOID_RETURN
;
}
static
void
test_bug40365
(
void
)
{
uint
rc
,
i
;
MYSQL_STMT
*
stmt
=
0
;
MYSQL_BIND
my_bind
[
2
];
my_bool
is_null
[
2
]
=
{
0
};
MYSQL_TIME
tm
[
2
];
DBUG_ENTER
(
"test_bug40365"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS t1"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE t1(c1 DATETIME, \
c2 DATE)"
);
myquery
(
rc
);
stmt
=
mysql_simple_prepare
(
mysql
,
"INSERT INTO t1 VALUES(?, ?)"
);
check_stmt
(
stmt
);
verify_param_count
(
stmt
,
2
);
bzero
((
char
*
)
my_bind
,
sizeof
(
my_bind
));
my_bind
[
0
].
buffer_type
=
MYSQL_TYPE_DATETIME
;
my_bind
[
1
].
buffer_type
=
MYSQL_TYPE_DATE
;
for
(
i
=
0
;
i
<
(
int
)
array_elements
(
my_bind
);
i
++
)
{
my_bind
[
i
].
buffer
=
(
void
*
)
&
tm
[
i
];
my_bind
[
i
].
is_null
=
&
is_null
[
i
];
}
rc
=
mysql_stmt_bind_param
(
stmt
,
my_bind
);
check_execute
(
stmt
,
rc
);
for
(
i
=
0
;
i
<
(
int
)
array_elements
(
my_bind
);
i
++
)
{
tm
[
i
].
neg
=
0
;
tm
[
i
].
second_part
=
0
;
tm
[
i
].
year
=
2009
;
tm
[
i
].
month
=
2
;
tm
[
i
].
day
=
29
;
tm
[
i
].
hour
=
0
;
tm
[
i
].
minute
=
0
;
tm
[
i
].
second
=
0
;
}
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_commit
(
mysql
);
myquery
(
rc
);
mysql_stmt_close
(
stmt
);
stmt
=
mysql_simple_prepare
(
mysql
,
"SELECT * FROM t1"
);
check_stmt
(
stmt
);
rc
=
mysql_stmt_bind_result
(
stmt
,
my_bind
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_store_result
(
stmt
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_fetch
(
stmt
);
check_execute
(
stmt
,
rc
);
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
"
);
for
(
i
=
0
;
i
<
array_elements
(
my_bind
);
i
++
)
{
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
time[%d]: %02d-%02d-%02d "
,
i
,
tm
[
i
].
year
,
tm
[
i
].
month
,
tm
[
i
].
day
);
DIE_UNLESS
(
tm
[
i
].
year
==
0
);
DIE_UNLESS
(
tm
[
i
].
month
==
0
);
DIE_UNLESS
(
tm
[
i
].
day
==
0
);
}
mysql_stmt_close
(
stmt
);
DBUG_VOID_RETURN
;
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
...
...
@@ -17885,6 +17966,7 @@ static struct my_tests_st my_tests[]= {
{
"test_wl4166_1"
,
test_wl4166_1
},
{
"test_wl4166_2"
,
test_wl4166_2
},
{
"test_bug38486"
,
test_bug38486
},
{
"test_bug40365"
,
test_bug40365
},
{
0
,
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