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
6cafb12c
Commit
6cafb12c
authored
Jul 30, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for timestamp issue (BR #819)
tests/client_test.c: Updated test_ts() test (For BR# 819)
parent
73d128ec
Changes
2
Hide 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 @
6cafb12c
...
...
@@ -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 @
6cafb12c
...
...
@@ -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
);
mystmt
(
stmt
,
rc
);
myassert
(
2
==
my_process_stmt_result
(
stmt
)
);
field_count
=
mysql_num_fields
(
prep_res
);
rc
=
mysql_fetch
(
stmt
);
mys
tmt
(
stmt
,
rc
);
mysql_free_result
(
prep_res
);
mys
ql_stmt_close
(
stmt
);
rc
=
mysql_fetch
(
stmt
);
myassert
(
rc
==
MYSQL_NO_DATA
);
for
(
name
=
'a'
;
field_count
--
;
name
++
)
{
int
row_count
=
0
;
mysql_stmt_close
(
stmt
);
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_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
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