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
3d063e0c
Commit
3d063e0c
authored
Dec 15, 2008
by
Timothy Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge from upstream 5.0-bugteam.
parents
776fb66a
c1bf0475
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
81 additions
and
40 deletions
+81
-40
client/mysql.cc
client/mysql.cc
+17
-32
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+9
-0
mysql-test/r/mysql.result
mysql-test/r/mysql.result
+6
-0
mysql-test/t/func_if.test
mysql-test/t/func_if.test
+14
-0
mysql-test/t/mysql.test
mysql-test/t/mysql.test
+19
-0
sql/item_func.h
sql/item_func.h
+4
-1
sql/log.cc
sql/log.cc
+7
-6
tests/mysql_client_test.c
tests/mysql_client_test.c
+5
-1
No files found.
client/mysql.cc
View file @
3d063e0c
...
...
@@ -1998,7 +1998,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
{
if
(
!
preserve_comments
)
{
// Skip spaces at the beg
gi
ning of a statement
// Skip spaces at the beg
in
ning of a statement
if
(
my_isspace
(
charset_info
,
inchar
)
&&
(
out
==
line
)
&&
buffer
.
is_empty
())
continue
;
...
...
@@ -2081,37 +2081,6 @@ static bool add_line(String &buffer,char *line,char *in_string,
continue
;
}
}
else
if
(
!*
ml_comment
&&
!*
in_string
&&
(
end_of_line
-
pos
)
>=
10
&&
!
my_strnncoll
(
charset_info
,
(
uchar
*
)
pos
,
10
,
(
const
uchar
*
)
"delimiter "
,
10
))
{
// Flush previously accepted characters
if
(
out
!=
line
)
{
buffer
.
append
(
line
,
(
uint32
)
(
out
-
line
));
out
=
line
;
}
// Flush possible comments in the buffer
if
(
!
buffer
.
is_empty
())
{
if
(
com_go
(
&
buffer
,
0
)
>
0
)
// < 0 is not fatal
DBUG_RETURN
(
1
);
buffer
.
length
(
0
);
}
/*
Delimiter wants the get rest of the given line as argument to
allow one to change ';' to ';;' and back
*/
buffer
.
append
(
pos
);
if
(
com_delimiter
(
&
buffer
,
pos
)
>
0
)
DBUG_RETURN
(
1
);
buffer
.
length
(
0
);
break
;
}
else
if
(
!*
ml_comment
&&
!*
in_string
&&
is_prefix
(
pos
,
delimiter
))
{
// Found a statement. Continue parsing after the delimiter
...
...
@@ -2174,8 +2143,24 @@ static bool add_line(String &buffer,char *line,char *in_string,
// comment to end of line
if
(
preserve_comments
)
{
bool
started_with_nothing
=
!
buffer
.
length
();
buffer
.
append
(
pos
);
/*
A single-line comment by itself gets sent immediately so that
client commands (delimiter, status, etc) will be interpreted on
the next line.
*/
if
(
started_with_nothing
)
{
if
(
com_go
(
&
buffer
,
0
)
>
0
)
// < 0 is not fatal
DBUG_RETURN
(
1
);
buffer
.
length
(
0
);
}
}
break
;
}
else
if
(
!*
in_string
&&
inchar
==
'/'
&&
*
(
pos
+
1
)
==
'*'
&&
...
...
mysql-test/r/func_if.result
View file @
3d063e0c
...
...
@@ -176,4 +176,13 @@ IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((R
DROP TABLE t1;
CREATE TABLE t1 (c LONGTEXT);
INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890');
SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
MAX(IF(1, CAST(c AS UNSIGNED), 0))
12345678901234567890
SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
MAX(IFNULL(CAST(c AS UNSIGNED), 0))
12345678901234567890
DROP TABLE t1;
End of 5.0 tests
mysql-test/r/mysql.result
View file @
3d063e0c
...
...
@@ -180,4 +180,10 @@ ERROR at line 1: DELIMITER cannot contain a backslash character
1
This is a file starting with UTF8 BOM 0xEFBBBF
This is a file starting with UTF8 BOM 0xEFBBBF
delimiter
1
2
2
2
2
End of 5.0 tests
mysql-test/t/func_if.test
View file @
3d063e0c
...
...
@@ -150,4 +150,18 @@ FROM t1;
DROP
TABLE
t1
;
#
# Bug #40761: Assert on sum func on IF(..., CAST(longtext AS UNSIGNED), signed)
# (was: LEFT JOIN on inline view crashes server)
#
CREATE
TABLE
t1
(
c
LONGTEXT
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
3
),
(
4
),
(
'12345678901234567890'
);
SELECT
*
FROM
(
SELECT
MAX
(
IF
(
1
,
CAST
(
c
AS
UNSIGNED
),
0
))
FROM
t1
)
AS
te
;
SELECT
*
FROM
(
SELECT
MAX
(
IFNULL
(
CAST
(
c
AS
UNSIGNED
),
0
))
FROM
t1
)
AS
te
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
mysql-test/t/mysql.test
View file @
3d063e0c
...
...
@@ -290,4 +290,23 @@ EOF
--
exec
$MYSQL
<
$MYSQLTEST_VARDIR
/
tmp
/
bug29323
.
sql
2
>&
1
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
bug29323
.
sql
;
#
# Bug #33812: mysql client incorrectly parsing DELIMITER
#
# The space and ; after delimiter are important
--
exec
$MYSQL
-
e
"select 1 delimiter ;"
#
# Bug #38158: mysql client regression, can't read dump files
#
--
write_file
$MYSQLTEST_VARDIR
/
tmp
/
bug38158
.
sql
--
Testing
--
delimiter
||
select
2
||
EOF
--
exec
$MYSQL
<
$MYSQLTEST_VARDIR
/
tmp
/
bug38158
.
sql
2
>&
1
--
exec
$MYSQL
-
c
<
$MYSQLTEST_VARDIR
/
tmp
/
bug38158
.
sql
2
>&
1
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
bug38158
.
sql
;
--
echo
End
of
5.0
tests
sql/item_func.h
View file @
3d063e0c
...
...
@@ -351,7 +351,10 @@ class Item_func_unsigned :public Item_func_signed
Item_func_unsigned
(
Item
*
a
)
:
Item_func_signed
(
a
)
{}
const
char
*
func_name
()
const
{
return
"cast_as_unsigned"
;
}
void
fix_length_and_dec
()
{
max_length
=
args
[
0
]
->
max_length
;
unsigned_flag
=
1
;
}
{
max_length
=
min
(
args
[
0
]
->
max_length
,
DECIMAL_MAX_PRECISION
+
2
);
unsigned_flag
=
1
;
}
longlong
val_int
();
void
print
(
String
*
str
);
};
...
...
sql/log.cc
View file @
3d063e0c
...
...
@@ -1146,7 +1146,7 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included)
* Need to update the log pos because purge logs has been called
* after fetching initially the log pos at the begining of the method.
*/
if
(
error
=
find_log_pos
(
&
rli
->
linfo
,
rli
->
event_relay_log_name
,
0
))
if
(
(
error
=
find_log_pos
(
&
rli
->
linfo
,
rli
->
event_relay_log_name
,
0
)
))
{
char
buff
[
22
];
sql_print_error
(
"next log error: %d offset: %s log: %s included: %d"
,
...
...
@@ -1234,8 +1234,8 @@ int MYSQL_LOG::purge_logs(const char *to_log,
*/
if
(
!
my_b_inited
(
&
purge_temp
))
{
if
(
error
=
open_cached_file
(
&
purge_temp
,
mysql_tmpdir
,
TEMP_PREFIX
,
DISK_BUFFER_SIZE
,
MYF
(
MY_WME
)))
if
(
(
error
=
open_cached_file
(
&
purge_temp
,
mysql_tmpdir
,
TEMP_PREFIX
,
DISK_BUFFER_SIZE
,
MYF
(
MY_WME
)
)))
{
sql_print_error
(
"MYSQL_LOG::purge_logs failed to open purge_temp"
);
goto
err
;
...
...
@@ -1243,7 +1243,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
}
else
{
if
(
error
=
reinit_io_cache
(
&
purge_temp
,
WRITE_CACHE
,
0
,
0
,
1
))
if
(
(
error
=
reinit_io_cache
(
&
purge_temp
,
WRITE_CACHE
,
0
,
0
,
1
)
))
{
sql_print_error
(
"MYSQL_LOG::purge_logs failed to reinit purge_temp "
"for write"
);
...
...
@@ -1274,7 +1274,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
}
/* We know how many files to delete. Update index file. */
if
(
error
=
update_log_index
(
&
log_info
,
need_update_threads
))
if
(
(
error
=
update_log_index
(
&
log_info
,
need_update_threads
)
))
{
sql_print_error
(
"MSYQL_LOG::purge_logs failed to update the index file"
);
goto
err
;
...
...
@@ -1283,7 +1283,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
DBUG_EXECUTE_IF
(
"crash_after_update_index"
,
abort
(););
/* Switch purge_temp for read. */
if
(
error
=
reinit_io_cache
(
&
purge_temp
,
READ_CACHE
,
0
,
0
,
0
))
if
(
(
error
=
reinit_io_cache
(
&
purge_temp
,
READ_CACHE
,
0
,
0
,
0
)
))
{
sql_print_error
(
"MSYQL_LOG::purge_logs failed to reinit purge_temp "
"for read"
);
...
...
@@ -1409,6 +1409,7 @@ int MYSQL_LOG::purge_logs(const char *to_log,
}
err:
close_cached_file
(
&
purge_temp
);
if
(
need_mutex
)
pthread_mutex_unlock
(
&
LOCK_index
);
DBUG_RETURN
(
error
);
...
...
tests/mysql_client_test.c
View file @
3d063e0c
...
...
@@ -15899,6 +15899,7 @@ static void test_bug28934()
}
#ifdef HAVE_SPATIAL
/**
Bug#37956 memory leak and / or crash with geometry and prepared statements!
*/
...
...
@@ -15907,7 +15908,7 @@ static void test_bug37956(void)
{
const
char
*
query
=
"select point(?,?)"
;
MYSQL_STMT
*
stmt
=
NULL
;
u
nsigned
int
val
=
0
;
u
long
val
=
0
;
MYSQL_BIND
bind_param
[
2
];
unsigned
char
buff
[
2
]
=
{
134
,
211
};
DBUG_ENTER
(
"test_bug37956"
);
...
...
@@ -15951,6 +15952,7 @@ static void test_bug37956(void)
DIE_UNLESS
(
0
);
DBUG_VOID_RETURN
;
}
#endif
/*
Bug#27592 (stack overrun when storing datetime value using prepared statements)
...
...
@@ -16648,7 +16650,9 @@ static struct my_tests_st my_tests[]= {
{
"test_bug32265"
,
test_bug32265
},
{
"test_bug38486"
,
test_bug38486
},
{
"test_bug40365"
,
test_bug40365
},
#ifdef HAVE_SPATIAL
{
"test_bug37956"
,
test_bug37956
},
#endif
{
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