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
015a65a7
Commit
015a65a7
authored
Jul 30, 2003
by
venu@myvenu.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge venu@bk-internal.mysql.com:/home/bk/mysql-4.1
into myvenu.com:/home/venu/work/sql/dev-4.1
parents
f8791c39
45dcca73
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
24 deletions
+57
-24
sql/item.cc
sql/item.cc
+5
-0
tests/client_test.c
tests/client_test.c
+52
-24
No files found.
sql/item.cc
View file @
015a65a7
...
...
@@ -530,6 +530,11 @@ void Item_param::set_longdata(const char *str, ulong length)
int
Item_param
::
save_in_field
(
Field
*
field
,
bool
no_conversions
)
{
THD
*
thd
=
current_thd
;
if
(
thd
->
command
==
COM_PREPARE
)
return
-
1
;
if
(
null_value
)
return
(
int
)
set_field_to_null
(
field
);
...
...
tests/client_test.c
View file @
015a65a7
...
...
@@ -7467,24 +7467,26 @@ static void test_sqlmode()
static
void
test_ts
()
{
MYSQL_STMT
*
stmt
;
MYSQL_BIND
bind
[
2
];
MYSQL_BIND
bind
[
6
];
MYSQL_TIME
ts
;
MYSQL_RES
*
prep_res
;
char
strts
[
30
];
long
length
;
int
rc
;
int
rc
,
field_count
;
char
name
;
myheader
(
"test_ts"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS test_ts"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE test_ts(a TIMESTAMP)"
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE test_ts(a
DATE, b TIME, c
TIMESTAMP)"
);
myquery
(
rc
);
rc
=
mysql_commit
(
mysql
);
myquery
(
rc
);
stmt
=
mysql_prepare
(
mysql
,
"INSERT INTO test_ts VALUES(?
),(?)"
,
4
0
);
stmt
=
mysql_prepare
(
mysql
,
"INSERT INTO test_ts VALUES(?
,?,?),(?,?,?)"
,
5
0
);
mystmt_init
(
stmt
);
ts
.
year
=
2003
;
...
...
@@ -7495,17 +7497,21 @@ static void test_ts()
ts
.
second
=
46
;
length
=
(
long
)(
strmov
(
strts
,
"2003-07-12 21:07:46"
)
-
strts
);
bind
[
0
].
buffer_type
=
MYSQL_TYPE_
STRING
;
bind
[
0
].
buffer
=
(
char
*
)
str
ts
;
bind
[
0
].
buffer_length
=
sizeof
(
str
ts
);
bind
[
0
].
buffer_type
=
MYSQL_TYPE_
TIMESTAMP
;
bind
[
0
].
buffer
=
(
char
*
)
&
ts
;
bind
[
0
].
buffer_length
=
sizeof
(
ts
);
bind
[
0
].
is_null
=
0
;
bind
[
0
].
length
=
&
length
;
bind
[
0
].
length
=
0
;
bind
[
1
].
buffer_type
=
MYSQL_TYPE_TIMESTAMP
;
bind
[
1
].
buffer
=
(
char
*
)
&
ts
;
bind
[
1
].
buffer_length
=
sizeof
(
ts
);
bind
[
1
].
is_null
=
0
;
bind
[
1
].
length
=
0
;
bind
[
2
]
=
bind
[
1
]
=
bind
[
0
];
bind
[
3
].
buffer_type
=
MYSQL_TYPE_STRING
;
bind
[
3
].
buffer
=
(
char
*
)
strts
;
bind
[
3
].
buffer_length
=
sizeof
(
strts
);
bind
[
3
].
is_null
=
0
;
bind
[
3
].
length
=
&
length
;
bind
[
5
]
=
bind
[
4
]
=
bind
[
3
];
rc
=
mysql_bind_param
(
stmt
,
bind
);
mystmt
(
stmt
,
rc
);
...
...
@@ -7515,27 +7521,49 @@ static void test_ts()
mysql_stmt_close
(
stmt
);
verify_col_data
(
"test_ts"
,
"a"
,
"2003-07-12 21:07:46"
);
verify_col_data
(
"test_ts"
,
"a"
,
"2003-07-12"
);
verify_col_data
(
"test_ts"
,
"b"
,
"21:07:46"
);
verify_col_data
(
"test_ts"
,
"c"
,
"2003-07-12 21:07:46"
);
stmt
=
mysql_prepare
(
mysql
,
"SELECT
a FROM test_ts WHERE a >= ?
"
,
50
);
stmt
=
mysql_prepare
(
mysql
,
"SELECT
* FROM test_ts
"
,
50
);
mystmt_init
(
stmt
);
rc
=
mysql_bind_param
(
stmt
,
bind
);
my
stmt
(
stmt
,
rc
);
prep_res
=
mysql_prepare_result
(
stmt
);
my
test
(
prep_res
);
rc
=
mysql_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
rc
=
mysql_fetch
(
stmt
);
myassert
(
2
==
my_process_stmt_result
(
stmt
));
field_count
=
mysql_num_fields
(
prep_res
);
mysql_free_result
(
prep_res
);
mysql_stmt_close
(
stmt
);
for
(
name
=
'a'
;
field_count
--
;
name
++
)
{
int
row_count
=
0
;
sprintf
(
query
,
"SELECT a,b,c FROM test_ts WHERE %c=?"
,
name
);
length
=
(
long
)(
strmov
(
query
,
query
)
-
query
);
fprintf
(
stdout
,
"
\n
%s"
,
query
);
stmt
=
mysql_prepare
(
mysql
,
query
,
length
);
mystmt_init
(
stmt
);
rc
=
mysql_bind_param
(
stmt
,
bind
);
mystmt
(
stmt
,
rc
);
rc
=
mysql_fetch
(
stmt
);
rc
=
mysql_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
rc
=
mysql_fetch
(
stmt
);
myassert
(
rc
==
MYSQL_NO_DATA
)
;
while
(
mysql_fetch
(
stmt
)
==
0
)
row_count
++
;
fprintf
(
stdout
,
"
\n
returned '%d' rows"
,
row_count
);
myassert
(
row_count
==
2
);
mysql_stmt_close
(
stmt
);
}
}
...
...
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