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
329ac024
Commit
329ac024
authored
May 20, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
assigning max_length parameter for Item_param (Bug #3811)
parent
98c10ced
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
1 deletion
+62
-1
sql/item.cc
sql/item.cc
+19
-0
tests/client_test.c
tests/client_test.c
+43
-1
No files found.
sql/item.cc
View file @
329ac024
...
...
@@ -646,6 +646,7 @@ void Item_param::set_null()
DBUG_ENTER
(
"Item_param::set_null"
);
/* These are cleared after each execution by reset() method */
null_value
=
value_is_set
=
1
;
max_length
=
0
;
DBUG_VOID_RETURN
;
}
...
...
@@ -656,6 +657,7 @@ void Item_param::set_int(longlong i)
item_type
=
INT_ITEM
;
value_is_set
=
1
;
maybe_null
=
0
;
max_length
=
11
;
DBUG_PRINT
(
"info"
,
(
"integer: %lld"
,
int_value
));
DBUG_VOID_RETURN
;
}
...
...
@@ -667,6 +669,8 @@ void Item_param::set_double(double value)
item_type
=
REAL_ITEM
;
value_is_set
=
1
;
maybe_null
=
0
;
decimals
=
NOT_FIXED_DEC
;
max_length
=
DBL_DIG
+
8
;;
DBUG_PRINT
(
"info"
,
(
"double: %lg"
,
real_value
));
DBUG_VOID_RETURN
;
}
...
...
@@ -679,6 +683,7 @@ void Item_param::set_value(const char *str, uint length)
item_type
=
STRING_ITEM
;
value_is_set
=
1
;
maybe_null
=
0
;
max_length
=
length
;
DBUG_PRINT
(
"info"
,
(
"string: %s"
,
str_value
.
ptr
()));
DBUG_VOID_RETURN
;
}
...
...
@@ -704,6 +709,20 @@ void Item_param::set_time(TIME *tm, timestamp_type type)
item_type
=
STRING_ITEM
;
value_is_set
=
1
;
maybe_null
=
0
;
switch
(
type
)
{
case
TIMESTAMP_DATE
:
max_length
=
10
;
break
;
case
TIMESTAMP_DATETIME
:
max_length
=
19
;
break
;
case
TIMESTAMP_TIME
:
max_length
=
8
;
break
;
default:
DBUG_ASSERT
(
0
);
// it should be impossible
}
}
...
...
tests/client_test.c
View file @
329ac024
...
...
@@ -9640,6 +9640,47 @@ group by b ");
}
static
void
test_union_param
()
{
MYSQL_STMT
*
stmt
;
char
*
query
;
int
rc
,
i
;
MYSQL_BIND
bind
[
2
];
char
my_val
[
4
];
ulong
my_length
=
3L
;
long
my_null
=
0L
;
myheader
(
"test_union_param"
);
strcpy
(
my_val
,
"abc"
);
query
=
(
char
*
)
"select ? as my_col union distinct select ?"
;
stmt
=
mysql_prepare
(
mysql
,
query
,
strlen
(
query
));
check_stmt
(
stmt
);
/* bind parameters */
bind
[
0
].
buffer_type
=
FIELD_TYPE_STRING
;
bind
[
0
].
buffer
=
&
my_val
;
bind
[
0
].
buffer_length
=
4
;
bind
[
0
].
length
=
&
my_length
;
bind
[
0
].
is_null
=
(
char
*
)
&
my_null
;
bind
[
1
].
buffer_type
=
FIELD_TYPE_STRING
;
bind
[
1
].
buffer
=
&
my_val
;
bind
[
1
].
buffer_length
=
4
;
bind
[
1
].
length
=
&
my_length
;
bind
[
1
].
is_null
=
(
char
*
)
&
my_null
;
rc
=
mysql_bind_param
(
stmt
,
bind
);
check_execute
(
stmt
,
rc
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
assert
(
1
==
my_process_stmt_result
(
stmt
));
}
mysql_stmt_close
(
stmt
);
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
...
...
@@ -9784,6 +9825,7 @@ int main(int argc, char **argv)
start_time
=
time
((
time_t
*
)
0
);
test_union_param
();
client_query
();
/* simple client query test */
#if NOT_YET_WORKING
/* Used for internal new development debugging */
...
...
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