Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
5b4f0621
Commit
5b4f0621
authored
Sep 20, 2019
by
Steven Murray
Browse files
insert_with_bindUint64_2_pow_64_minus_1 now works for mysql and the 'BIGINT UNSIGNED' datatype
parent
1dd74e24
Changes
1
Hide whitespace changes
Inline
Side-by-side
rdbms/StmtTest.cpp
View file @
5b4f0621
...
...
@@ -76,6 +76,7 @@ std::string cta_rdbms_StmtTest::getCreateStmtTestTableSql() {
case
Login
::
DBTYPE_SQLITE
:
break
;
case
Login
::
DBTYPE_MYSQL
:
utils
::
searchAndReplace
(
sql
,
"NUMERIC(20, 0)"
,
"BIGINT UNSIGNED"
);
break
;
case
Login
::
DBTYPE_POSTGRESQL
:
break
;
...
...
@@ -189,55 +190,9 @@ TEST_P(cta_rdbms_StmtTest, insert_with_bindUint64) {
}
}
TEST_P
(
cta_rdbms_StmtTest
,
insert_with_bindUint64_2_pow_
5
4_minus_
2
)
{
TEST_P
(
cta_rdbms_StmtTest
,
insert_with_bindUint64_2_pow_
6
4_minus_
1
)
{
using
namespace
cta
::
rdbms
;
// The MySql support in CTA cannot store an unsigned integer greater than
// 2^54-2
const
uint64_t
insertValue
=
18014398509481982
;
// Insert a row into the test table
{
const
char
*
const
sql
=
"INSERT INTO STMT_TEST("
"UINT64_COL) "
"VALUES("
":UINT64_COL)"
;
auto
stmt
=
m_conn
.
createStmt
(
sql
);
stmt
.
bindUint64
(
":UINT64_COL"
,
insertValue
);
stmt
.
executeNonQuery
();
}
// Select the row back from the table
{
const
char
*
const
sql
=
"SELECT "
"UINT64_COL AS UINT64_COL "
"FROM "
"STMT_TEST"
;
auto
stmt
=
m_conn
.
createStmt
(
sql
);
auto
rset
=
stmt
.
executeQuery
();
ASSERT_TRUE
(
rset
.
next
());
const
auto
selectValue
=
rset
.
columnOptionalUint64
(
"UINT64_COL"
);
ASSERT_TRUE
((
bool
)
selectValue
);
ASSERT_EQ
(
insertValue
,
selectValue
.
value
());
ASSERT_FALSE
(
rset
.
next
());
}
}
TEST_P
(
cta_rdbms_StmtTest
,
insert_with_bindUint64_2_pow_64_minus_1_not_mysql
)
{
using
namespace
cta
::
rdbms
;
if
(
m_login
.
dbType
==
Login
::
DBTYPE_MYSQL
)
{
return
;
}
// The MySql support in CTA cannot store an unsigned integer greater than
// 2^54-2
const
uint64_t
insertValue
=
18446744073709551615U
;
// Insert a row into the test table
...
...
Write
Preview
Supports
Markdown
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