Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
976858b8
Commit
976858b8
authored
5 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Added unit-test insert_with_bindUint64_2_pow_64_minus_1_not_mysql
parent
4d6918b8
No related branches found
Branches containing commit
Tags
v4.4.0-1
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
rdbms/StmtTest.cpp
+46
-2
46 additions, 2 deletions
rdbms/StmtTest.cpp
rdbms/StmtTest.hpp
+5
-0
5 additions, 0 deletions
rdbms/StmtTest.hpp
with
51 additions
and
2 deletions
rdbms/StmtTest.cpp
+
46
−
2
View file @
976858b8
...
...
@@ -32,9 +32,9 @@ void cta_rdbms_StmtTest::SetUp() {
using
namespace
cta
::
rdbms
;
if
(
!
m_connPool
)
{
const
cta
::
rdbms
::
Login
login
=
GetParam
()
->
create
();
m_
login
=
GetParam
()
->
create
();
const
uint64_t
maxNbConns
=
1
;
m_connPool
=
cta
::
make_unique
<
ConnPool
>
(
login
,
maxNbConns
);
m_connPool
=
cta
::
make_unique
<
ConnPool
>
(
m_
login
,
maxNbConns
);
}
m_conn
=
m_connPool
->
getConn
();
...
...
@@ -178,4 +178,48 @@ TEST_P(cta_rdbms_StmtTest, insert_with_bindUint64_2_pow_54_minus_2) {
}
}
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
{
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
());
}
}
}
// namespace unitTests
This diff is collapsed.
Click to expand it.
rdbms/StmtTest.hpp
+
5
−
0
View file @
976858b8
...
...
@@ -28,6 +28,11 @@ namespace unitTests {
class
cta_rdbms_StmtTest
:
public
::
testing
::
TestWithParam
<
cta
::
rdbms
::
LoginFactory
*>
{
protected:
/**
* The database login.
*/
cta
::
rdbms
::
Login
m_login
;
/**
* The database connection pool.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment