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
1e88bdbf
Commit
1e88bdbf
authored
Jan 02, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Streamlined code for trim, ltrim and rtrim
Portability fixes
parent
9bb8f6d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
51 deletions
+87
-51
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+9
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+3
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+46
-30
tests/client_test.c
tests/client_test.c
+29
-21
No files found.
mysql-test/r/func_str.result
View file @
1e88bdbf
...
@@ -48,6 +48,9 @@ tcx.se .se
...
@@ -48,6 +48,9 @@ tcx.se .se
select concat(':',ltrim(' left '),':',rtrim(' right '),':');
select concat(':',ltrim(' left '),':',rtrim(' right '),':');
concat(':',ltrim(' left '),':',rtrim(' right '),':')
concat(':',ltrim(' left '),':',rtrim(' right '),':')
:left : right:
:left : right:
select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':');
concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':')
:left : right:
select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':');
select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':');
concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':')
concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':')
:left: right:
:left: right:
...
@@ -703,3 +706,9 @@ NULL
...
@@ -703,3 +706,9 @@ NULL
select trim('xyz' from null) as "must_be_null";
select trim('xyz' from null) as "must_be_null";
must_be_null
must_be_null
NULL
NULL
select trim(leading NULL from 'kate') as "must_be_null";
must_be_null
NULL
select trim(trailing NULL from 'xyz') as "must_be_null";
must_be_null
NULL
mysql-test/t/func_str.test
View file @
1e88bdbf
...
@@ -25,6 +25,7 @@ select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',
...
@@ -25,6 +25,7 @@ select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',
select
substring_index
(
'.tcx.se'
,
'.'
,
-
2
),
substring_index
(
'.tcx.se'
,
'.tcx'
,
-
1
);
select
substring_index
(
'.tcx.se'
,
'.'
,
-
2
),
substring_index
(
'.tcx.se'
,
'.tcx'
,
-
1
);
select
concat
(
':'
,
ltrim
(
' left '
),
':'
,
rtrim
(
' right '
),
':'
);
select
concat
(
':'
,
ltrim
(
' left '
),
':'
,
rtrim
(
' right '
),
':'
);
select
concat
(
':'
,
trim
(
leading
from
' left '
),
':'
,
trim
(
trailing
from
' right '
),
':'
);
select
concat
(
':'
,
trim
(
LEADING
FROM
' left'
),
':'
,
trim
(
TRAILING
FROM
' right '
),
':'
);
select
concat
(
':'
,
trim
(
LEADING
FROM
' left'
),
':'
,
trim
(
TRAILING
FROM
' right '
),
':'
);
select
concat
(
':'
,
trim
(
' m '
),
':'
,
trim
(
BOTH
FROM
' y '
),
':'
,
trim
(
'*'
FROM
'*s*'
),
':'
);
select
concat
(
':'
,
trim
(
' m '
),
':'
,
trim
(
BOTH
FROM
' y '
),
':'
,
trim
(
'*'
FROM
'*s*'
),
':'
);
select
concat
(
':'
,
trim
(
BOTH
'ab'
FROM
'ababmyabab'
),
':'
,
trim
(
BOTH
'*'
FROM
'***sql'
),
':'
);
select
concat
(
':'
,
trim
(
BOTH
'ab'
FROM
'ababmyabab'
),
':'
,
trim
(
BOTH
'*'
FROM
'***sql'
),
':'
);
...
@@ -443,3 +444,5 @@ select quote(trim(concat(' ', 'a')));
...
@@ -443,3 +444,5 @@ select quote(trim(concat(' ', 'a')));
#
#
select
trim
(
null
from
'kate'
)
as
"must_be_null"
;
select
trim
(
null
from
'kate'
)
as
"must_be_null"
;
select
trim
(
'xyz'
from
null
)
as
"must_be_null"
;
select
trim
(
'xyz'
from
null
)
as
"must_be_null"
;
select
trim
(
leading
NULL
from
'kate'
)
as
"must_be_null"
;
select
trim
(
trailing
NULL
from
'xyz'
)
as
"must_be_null"
;
sql/item_strfunc.cc
View file @
1e88bdbf
...
@@ -1185,21 +1185,29 @@ String *Item_func_substr_index::val_str(String *str)
...
@@ -1185,21 +1185,29 @@ String *Item_func_substr_index::val_str(String *str)
String
*
Item_func_ltrim
::
val_str
(
String
*
str
)
String
*
Item_func_ltrim
::
val_str
(
String
*
str
)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
char
buff
[
MAX_FIELD_WIDTH
],
*
ptr
,
*
end
;
if
((
null_value
=
args
[
0
]
->
null_value
))
String
tmp
(
buff
,
sizeof
(
buff
),
system_charset_info
);
return
0
;
/* purecov: inspected */
String
*
res
,
*
remove_str
;
char
buff
[
MAX_FIELD_WIDTH
];
String
tmp
(
buff
,
sizeof
(
buff
),
res
->
charset
());
String
*
remove_str
=
(
arg_count
==
2
)
?
args
[
1
]
->
val_str
(
&
tmp
)
:
&
remove
;
uint
remove_length
;
uint
remove_length
;
LINT_INIT
(
remove_length
);
LINT_INIT
(
remove_length
);
if
(
!
remove_str
||
(
remove_length
=
remove_str
->
length
())
==
0
||
res
=
args
[
0
]
->
val_str
(
str
);
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
remove_str
=
&
remove
;
/* Default value. */
if
(
arg_count
==
2
)
{
remove_str
=
args
[
1
]
->
val_str
(
&
tmp
);
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
}
if
((
remove_length
=
remove_str
->
length
())
==
0
||
remove_length
>
res
->
length
())
remove_length
>
res
->
length
())
return
res
;
return
res
;
char
*
ptr
=
(
char
*
)
res
->
ptr
();
ptr
=
(
char
*
)
res
->
ptr
();
char
*
end
=
ptr
+
res
->
length
();
end
=
ptr
+
res
->
length
();
if
(
remove_length
==
1
)
if
(
remove_length
==
1
)
{
{
char
chr
=
(
*
remove_str
)[
0
];
char
chr
=
(
*
remove_str
)[
0
];
...
@@ -1224,21 +1232,29 @@ String *Item_func_ltrim::val_str(String *str)
...
@@ -1224,21 +1232,29 @@ String *Item_func_ltrim::val_str(String *str)
String
*
Item_func_rtrim
::
val_str
(
String
*
str
)
String
*
Item_func_rtrim
::
val_str
(
String
*
str
)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
char
buff
[
MAX_FIELD_WIDTH
],
*
ptr
,
*
end
;
if
((
null_value
=
args
[
0
]
->
null_value
))
String
tmp
(
buff
,
sizeof
(
buff
),
system_charset_info
);
return
0
;
/* purecov: inspected */
String
*
res
,
*
remove_str
;
char
buff
[
MAX_FIELD_WIDTH
];
String
tmp
(
buff
,
sizeof
(
buff
),
res
->
charset
());
String
*
remove_str
=
(
arg_count
==
2
)
?
args
[
1
]
->
val_str
(
&
tmp
)
:
&
remove
;
uint
remove_length
;
uint
remove_length
;
LINT_INIT
(
remove_length
);
LINT_INIT
(
remove_length
);
if
(
!
remove_str
||
(
remove_length
=
remove_str
->
length
())
==
0
||
res
=
args
[
0
]
->
val_str
(
str
);
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
remove_str
=
&
remove
;
/* Default value. */
if
(
arg_count
==
2
)
{
remove_str
=
args
[
1
]
->
val_str
(
&
tmp
);
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
}
if
((
remove_length
=
remove_str
->
length
())
==
0
||
remove_length
>
res
->
length
())
remove_length
>
res
->
length
())
return
res
;
return
res
;
char
*
ptr
=
(
char
*
)
res
->
ptr
();
ptr
=
(
char
*
)
res
->
ptr
();
char
*
end
=
ptr
+
res
->
length
();
end
=
ptr
+
res
->
length
();
#ifdef USE_MB
#ifdef USE_MB
char
*
p
=
ptr
;
char
*
p
=
ptr
;
register
uint32
l
;
register
uint32
l
;
...
@@ -1297,31 +1313,31 @@ String *Item_func_rtrim::val_str(String *str)
...
@@ -1297,31 +1313,31 @@ String *Item_func_rtrim::val_str(String *str)
String
*
Item_func_trim
::
val_str
(
String
*
str
)
String
*
Item_func_trim
::
val_str
(
String
*
str
)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
char
buff
[
MAX_FIELD_WIDTH
],
*
ptr
,
*
end
;
if
((
null_value
=
args
[
0
]
->
null_value
))
const
char
*
r_ptr
;
return
0
;
/* purecov: inspected */
String
tmp
(
buff
,
sizeof
(
buff
),
system_charset_info
);
char
buff
[
MAX_FIELD_WIDTH
];
String
*
res
,
*
remove_str
;
String
tmp
(
buff
,
sizeof
(
buff
),
res
->
charset
());
uint
remove_length
;
uint
remove_length
;
LINT_INIT
(
remove_length
);
LINT_INIT
(
remove_length
);
String
*
remove_str
;
/* The string to remove from res. */
res
=
args
[
0
]
->
val_str
(
str
);
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
remove_str
=
&
remove
;
/* Default value. */
if
(
arg_count
==
2
)
if
(
arg_count
==
2
)
{
{
remove_str
=
args
[
1
]
->
val_str
(
&
tmp
);
remove_str
=
args
[
1
]
->
val_str
(
&
tmp
);
if
((
null_value
=
args
[
1
]
->
null_value
))
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0
;
return
0
;
}
}
else
remove_str
=
&
remove
;
/* Default value. */
if
(
!
remove_str
||
(
remove_length
=
remove_str
->
length
())
==
0
||
if
(
(
remove_length
=
remove_str
->
length
())
==
0
||
remove_length
>
res
->
length
())
remove_length
>
res
->
length
())
return
res
;
return
res
;
char
*
ptr
=
(
char
*
)
res
->
ptr
();
ptr
=
(
char
*
)
res
->
ptr
();
char
*
end
=
ptr
+
res
->
length
();
end
=
ptr
+
res
->
length
();
const
char
*
r_ptr
=
remove_str
->
ptr
();
r_ptr
=
remove_str
->
ptr
();
while
(
ptr
+
remove_length
<=
end
&&
!
memcmp
(
ptr
,
r_ptr
,
remove_length
))
while
(
ptr
+
remove_length
<=
end
&&
!
memcmp
(
ptr
,
r_ptr
,
remove_length
))
ptr
+=
remove_length
;
ptr
+=
remove_length
;
#ifdef USE_MB
#ifdef USE_MB
...
...
tests/client_test.c
View file @
1e88bdbf
...
@@ -734,8 +734,8 @@ static void verify_st_affected_rows(MYSQL_STMT *stmt, ulonglong exp_count)
...
@@ -734,8 +734,8 @@ static void verify_st_affected_rows(MYSQL_STMT *stmt, ulonglong exp_count)
{
{
ulonglong
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
ulonglong
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: `%l
ld` (expected: `%l
ld`)"
,
fprintf
(
stdout
,
"
\n
total affected rows: `%l
d` (expected: `%
ld`)"
,
affected_rows
,
exp_count
);
(
long
)
affected_rows
,
(
long
)
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
}
}
...
@@ -746,8 +746,8 @@ static void verify_affected_rows(ulonglong exp_count)
...
@@ -746,8 +746,8 @@ static void verify_affected_rows(ulonglong exp_count)
{
{
ulonglong
affected_rows
=
mysql_affected_rows
(
mysql
);
ulonglong
affected_rows
=
mysql_affected_rows
(
mysql
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: `%l
ld` (expected: `%l
ld`)"
,
fprintf
(
stdout
,
"
\n
total affected rows: `%l
d` (expected: `%
ld`)"
,
affected_rows
,
exp_count
);
(
long
)
affected_rows
,
(
long
)
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
}
}
...
@@ -780,8 +780,8 @@ static void execute_prepare_query(const char *query, ulonglong exp_count)
...
@@ -780,8 +780,8 @@ static void execute_prepare_query(const char *query, ulonglong exp_count)
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: `%l
ld` (expected: `%l
ld`)"
,
fprintf
(
stdout
,
"
\n
total affected rows: `%l
d` (expected: `%
ld`)"
,
affected_rows
,
exp_count
);
(
long
)
affected_rows
,
(
long
)
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
DIE_UNLESS
(
affected_rows
==
exp_count
);
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
...
@@ -1017,7 +1017,8 @@ my_bool fetch_n(const char **query_list, unsigned query_count)
...
@@ -1017,7 +1017,8 @@ my_bool fetch_n(const char **query_list, unsigned query_count)
fprintf
(
stderr
,
fprintf
(
stderr
,
"Got error reading rows from statement %d,
\n
"
"Got error reading rows from statement %d,
\n
"
"query is: %s,
\n
"
"query is: %s,
\n
"
"error message: %s"
,
fetch
-
fetch_array
,
fetch
->
query
,
"error message: %s"
,
(
int
)
(
fetch
-
fetch_array
),
fetch
->
query
,
mysql_stmt_error
(
fetch
->
handle
));
mysql_stmt_error
(
fetch
->
handle
));
error_count
++
;
error_count
++
;
}
}
...
@@ -1479,6 +1480,7 @@ static void test_prepare()
...
@@ -1479,6 +1480,7 @@ static void test_prepare()
double
double_data
,
o_double_data
;
double
double_data
,
o_double_data
;
ulong
length
[
7
],
len
;
ulong
length
[
7
],
len
;
my_bool
is_null
[
7
];
my_bool
is_null
[
7
];
char
llbuf
[
22
];
MYSQL_BIND
bind
[
7
];
MYSQL_BIND
bind
[
7
];
myheader
(
"test_prepare"
);
myheader
(
"test_prepare"
);
...
@@ -1596,7 +1598,8 @@ static void test_prepare()
...
@@ -1596,7 +1598,8 @@ static void test_prepare()
fprintf
(
stdout
,
"
\n\t
tiny : %d (%lu)"
,
tiny_data
,
length
[
0
]);
fprintf
(
stdout
,
"
\n\t
tiny : %d (%lu)"
,
tiny_data
,
length
[
0
]);
fprintf
(
stdout
,
"
\n\t
short : %d (%lu)"
,
small_data
,
length
[
3
]);
fprintf
(
stdout
,
"
\n\t
short : %d (%lu)"
,
small_data
,
length
[
3
]);
fprintf
(
stdout
,
"
\n\t
int : %d (%lu)"
,
int_data
,
length
[
2
]);
fprintf
(
stdout
,
"
\n\t
int : %d (%lu)"
,
int_data
,
length
[
2
]);
fprintf
(
stdout
,
"
\n\t
big : %lld (%lu)"
,
big_data
,
length
[
4
]);
fprintf
(
stdout
,
"
\n\t
big : %s (%lu)"
,
llstr
(
big_data
,
llbuf
),
length
[
4
]);
fprintf
(
stdout
,
"
\n\t
float : %f (%lu)"
,
real_data
,
length
[
5
]);
fprintf
(
stdout
,
"
\n\t
float : %f (%lu)"
,
real_data
,
length
[
5
]);
fprintf
(
stdout
,
"
\n\t
double : %f (%lu)"
,
double_data
,
length
[
6
]);
fprintf
(
stdout
,
"
\n\t
double : %f (%lu)"
,
double_data
,
length
[
6
]);
...
@@ -3446,7 +3449,7 @@ static void test_bind_result_ext()
...
@@ -3446,7 +3449,7 @@ static void test_bind_result_ext()
MYSQL_BIND
bind
[
8
];
MYSQL_BIND
bind
[
8
];
ulong
length
[
8
];
ulong
length
[
8
];
my_bool
is_null
[
8
];
my_bool
is_null
[
8
];
char
llbuf
[
22
];
myheader
(
"test_bind_result_ext"
);
myheader
(
"test_bind_result_ext"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS test_bind_result"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS test_bind_result"
);
...
@@ -3520,7 +3523,7 @@ static void test_bind_result_ext()
...
@@ -3520,7 +3523,7 @@ static void test_bind_result_ext()
fprintf
(
stdout
,
"
\n
data (tiny) : %d"
,
t_data
);
fprintf
(
stdout
,
"
\n
data (tiny) : %d"
,
t_data
);
fprintf
(
stdout
,
"
\n
data (short) : %d"
,
s_data
);
fprintf
(
stdout
,
"
\n
data (short) : %d"
,
s_data
);
fprintf
(
stdout
,
"
\n
data (int) : %d"
,
i_data
);
fprintf
(
stdout
,
"
\n
data (int) : %d"
,
i_data
);
fprintf
(
stdout
,
"
\n
data (big) : %
lld"
,
b_data
);
fprintf
(
stdout
,
"
\n
data (big) : %
s"
,
llstr
(
b_data
,
llbuf
)
);
fprintf
(
stdout
,
"
\n
data (float) : %f"
,
f_data
);
fprintf
(
stdout
,
"
\n
data (float) : %f"
,
f_data
);
fprintf
(
stdout
,
"
\n
data (double) : %f"
,
d_data
);
fprintf
(
stdout
,
"
\n
data (double) : %f"
,
d_data
);
...
@@ -5286,7 +5289,7 @@ static void test_manual_sample()
...
@@ -5286,7 +5289,7 @@ static void test_manual_sample()
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: %l
ld"
,
affected_rows
);
fprintf
(
stdout
,
"
\n
total affected rows: %l
d"
,
(
ulong
)
affected_rows
);
if
(
affected_rows
!=
1
)
/* validate affected rows */
if
(
affected_rows
!=
1
)
/* validate affected rows */
{
{
fprintf
(
stderr
,
"
\n
invalid affected rows by MySQL"
);
fprintf
(
stderr
,
"
\n
invalid affected rows by MySQL"
);
...
@@ -5311,7 +5314,7 @@ static void test_manual_sample()
...
@@ -5311,7 +5314,7 @@ static void test_manual_sample()
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
affected_rows
=
mysql_stmt_affected_rows
(
stmt
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
fprintf
(
stdout
,
"
\n
total affected rows: %l
ld"
,
affected_rows
);
fprintf
(
stdout
,
"
\n
total affected rows: %l
d"
,
(
ulong
)
affected_rows
);
if
(
affected_rows
!=
1
)
/* validate affected rows */
if
(
affected_rows
!=
1
)
/* validate affected rows */
{
{
fprintf
(
stderr
,
"
\n
invalid affected rows by MySQL"
);
fprintf
(
stderr
,
"
\n
invalid affected rows by MySQL"
);
...
@@ -5467,9 +5470,9 @@ DROP TABLE IF EXISTS test_multi_tab";
...
@@ -5467,9 +5470,9 @@ DROP TABLE IF EXISTS test_multi_tab";
mysql_free_result
(
result
);
mysql_free_result
(
result
);
}
}
else
if
(
!
opt_silent
)
else
if
(
!
opt_silent
)
fprintf
(
stdout
,
"OK, %l
ld row(s) affected, %
d warning(s)
\n
"
,
fprintf
(
stdout
,
"OK, %l
d row(s) affected, %l
d warning(s)
\n
"
,
mysql_affected_rows
(
mysql_local
),
(
ulong
)
mysql_affected_rows
(
mysql_local
),
mysql_warning_count
(
mysql_local
));
(
ulong
)
mysql_warning_count
(
mysql_local
));
exp_value
=
(
uint
)
mysql_affected_rows
(
mysql_local
);
exp_value
=
(
uint
)
mysql_affected_rows
(
mysql_local
);
if
(
rows
[
count
]
!=
exp_value
)
if
(
rows
[
count
]
!=
exp_value
)
...
@@ -6549,7 +6552,7 @@ static void test_ushort_bug()
...
@@ -6549,7 +6552,7 @@ static void test_ushort_bug()
ulonglong
longlong_value
;
ulonglong
longlong_value
;
int
rc
;
int
rc
;
uchar
tiny_value
;
uchar
tiny_value
;
char
llbuf
[
22
];
myheader
(
"test_ushort_bug"
);
myheader
(
"test_ushort_bug"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS test_ushort"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS test_ushort"
);
...
@@ -6601,7 +6604,8 @@ static void test_ushort_bug()
...
@@ -6601,7 +6604,8 @@ static void test_ushort_bug()
{
{
fprintf
(
stdout
,
"
\n
ushort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
ushort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
ulong : %lu (%ld)"
,
(
ulong
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
ulong : %lu (%ld)"
,
(
ulong
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
longlong : %lld (%ld)"
,
longlong_value
,
ll_length
);
fprintf
(
stdout
,
"
\n
longlong : %s (%ld)"
,
llstr
(
longlong_value
,
llbuf
),
ll_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
}
}
...
@@ -6636,6 +6640,7 @@ static void test_sshort_bug()
...
@@ -6636,6 +6640,7 @@ static void test_sshort_bug()
ulonglong
longlong_value
;
ulonglong
longlong_value
;
int
rc
;
int
rc
;
uchar
tiny_value
;
uchar
tiny_value
;
char
llbuf
[
22
];
myheader
(
"test_sshort_bug"
);
myheader
(
"test_sshort_bug"
);
...
@@ -6686,7 +6691,8 @@ static void test_sshort_bug()
...
@@ -6686,7 +6691,8 @@ static void test_sshort_bug()
{
{
fprintf
(
stdout
,
"
\n
sshort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
sshort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
slong : %ld (%ld)"
,
(
long
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
slong : %ld (%ld)"
,
(
long
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
longlong : %lld (%ld)"
,
longlong_value
,
ll_length
);
fprintf
(
stdout
,
"
\n
longlong : %s (%ld)"
,
llstr
(
longlong_value
,
llbuf
),
ll_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
}
}
...
@@ -6721,6 +6727,7 @@ static void test_stiny_bug()
...
@@ -6721,6 +6727,7 @@ static void test_stiny_bug()
ulonglong
longlong_value
;
ulonglong
longlong_value
;
int
rc
;
int
rc
;
uchar
tiny_value
;
uchar
tiny_value
;
char
llbuf
[
22
];
myheader
(
"test_stiny_bug"
);
myheader
(
"test_stiny_bug"
);
...
@@ -6770,7 +6777,8 @@ static void test_stiny_bug()
...
@@ -6770,7 +6777,8 @@ static void test_stiny_bug()
{
{
fprintf
(
stdout
,
"
\n
sshort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
sshort : %d (%ld)"
,
short_value
,
s_length
);
fprintf
(
stdout
,
"
\n
slong : %ld (%ld)"
,
(
long
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
slong : %ld (%ld)"
,
(
long
)
long_value
,
l_length
);
fprintf
(
stdout
,
"
\n
longlong : %lld (%ld)"
,
longlong_value
,
ll_length
);
fprintf
(
stdout
,
"
\n
longlong : %s (%ld)"
,
llstr
(
longlong_value
,
llbuf
),
ll_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
fprintf
(
stdout
,
"
\n
tinyint : %d (%ld)"
,
tiny_value
,
t_length
);
}
}
...
@@ -11263,7 +11271,7 @@ static void test_bug5399()
...
@@ -11263,7 +11271,7 @@ static void test_bug5399()
for
(
stmt
=
stmt_list
;
stmt
!=
stmt_list
+
NUM_OF_USED_STMT
;
++
stmt
)
for
(
stmt
=
stmt_list
;
stmt
!=
stmt_list
+
NUM_OF_USED_STMT
;
++
stmt
)
{
{
sprintf
(
buff
,
"select %d"
,
stmt
-
stmt_list
);
sprintf
(
buff
,
"select %d"
,
(
int
)
(
stmt
-
stmt_list
)
);
*
stmt
=
mysql_stmt_init
(
mysql
);
*
stmt
=
mysql_stmt_init
(
mysql
);
rc
=
mysql_stmt_prepare
(
*
stmt
,
buff
,
strlen
(
buff
));
rc
=
mysql_stmt_prepare
(
*
stmt
,
buff
,
strlen
(
buff
));
check_execute
(
*
stmt
,
rc
);
check_execute
(
*
stmt
,
rc
);
...
@@ -11452,7 +11460,7 @@ static void test_bug5194()
...
@@ -11452,7 +11460,7 @@ static void test_bug5194()
if
(
!
opt_silent
)
if
(
!
opt_silent
)
printf
(
"Insert: query length= %d, row count= %d, param count= %lu
\n
"
,
printf
(
"Insert: query length= %d, row count= %d, param count= %lu
\n
"
,
strlen
(
query
),
nrows
,
mysql_stmt_param_count
(
stmt
));
(
int
)
strlen
(
query
),
nrows
,
mysql_stmt_param_count
(
stmt
));
/* bind the parameter array and execute the query */
/* bind the parameter array and execute the query */
rc
=
mysql_stmt_bind_param
(
stmt
,
bind
);
rc
=
mysql_stmt_bind_param
(
stmt
,
bind
);
...
...
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