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
6d5c0c3f
Commit
6d5c0c3f
authored
8 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Made rdbms::Stmt::m_paramNameToIdx private
parent
6c4a51f1
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
rdbms/OcciStmt.cpp
+2
-2
2 additions, 2 deletions
rdbms/OcciStmt.cpp
rdbms/SqliteStmt.cpp
+2
-2
2 additions, 2 deletions
rdbms/SqliteStmt.cpp
rdbms/Stmt.cpp
+9
-2
9 additions, 2 deletions
rdbms/Stmt.cpp
rdbms/Stmt.hpp
+15
-5
15 additions, 5 deletions
rdbms/Stmt.hpp
with
28 additions
and
11 deletions
rdbms/OcciStmt.cpp
+
2
−
2
View file @
6d5c0c3f
...
...
@@ -113,7 +113,7 @@ void OcciStmt::bindUint64(const std::string ¶mName, const uint64_t paramValu
//------------------------------------------------------------------------------
void
OcciStmt
::
bindOptionalUint64
(
const
std
::
string
&
paramName
,
const
optional
<
uint64_t
>
&
paramValue
)
{
try
{
const
unsigned
paramIdx
=
m_paramNameToIdx
.
get
Idx
(
paramName
);
const
unsigned
paramIdx
=
getParam
Idx
(
paramName
);
if
(
paramValue
)
{
// Bind integer as a string in order to support 64-bit integers
m_stmt
->
setString
(
paramIdx
,
std
::
to_string
(
paramValue
.
value
()));
...
...
@@ -150,7 +150,7 @@ void OcciStmt::bindOptionalString(const std::string ¶mName, const optional<s
" An optional string parameter should either have a non-empty string value or no value at all."
);
}
const
unsigned
paramIdx
=
m_paramNameToIdx
.
get
Idx
(
paramName
);
const
unsigned
paramIdx
=
getParam
Idx
(
paramName
);
if
(
paramValue
)
{
m_stmt
->
setString
(
paramIdx
,
paramValue
.
value
());
}
else
{
...
...
This diff is collapsed.
Click to expand it.
rdbms/SqliteStmt.cpp
+
2
−
2
View file @
6d5c0c3f
...
...
@@ -152,7 +152,7 @@ void SqliteStmt::bindUint64(const std::string ¶mName, const uint64_t paramVa
//------------------------------------------------------------------------------
void
SqliteStmt
::
bindOptionalUint64
(
const
std
::
string
&
paramName
,
const
optional
<
uint64_t
>
&
paramValue
)
{
try
{
const
unsigned
int
paramIdx
=
m_paramNameToIdx
.
get
Idx
(
paramName
);
const
unsigned
int
paramIdx
=
getParam
Idx
(
paramName
);
int
bindRc
=
0
;
if
(
paramValue
)
{
bindRc
=
sqlite3_bind_int64
(
m_stmt
,
paramIdx
,
(
sqlite3_int64
)
paramValue
.
value
());
...
...
@@ -188,7 +188,7 @@ void SqliteStmt::bindOptionalString(const std::string ¶mName, const optional
throw
exception
::
Exception
(
std
::
string
(
"Optional string parameter "
)
+
paramName
+
" is an empty string. "
" An optional string parameter should either have a non-empty string value or no value at all."
);
}
const
unsigned
int
paramIdx
=
m_paramNameToIdx
.
get
Idx
(
paramName
);
const
unsigned
int
paramIdx
=
getParam
Idx
(
paramName
);
int
bindRc
=
0
;
if
(
paramValue
)
{
bindRc
=
sqlite3_bind_text
(
m_stmt
,
paramIdx
,
paramValue
.
value
().
c_str
(),
-
1
,
SQLITE_TRANSIENT
);
...
...
This diff is collapsed.
Click to expand it.
rdbms/Stmt.cpp
+
9
−
2
View file @
6d5c0c3f
...
...
@@ -26,8 +26,8 @@ namespace rdbms {
//------------------------------------------------------------------------------
Stmt
::
Stmt
(
const
std
::
string
&
sql
,
const
AutocommitMode
autocommitMode
)
:
m_sql
(
sql
),
m_
paramNameToIdx
(
sql
),
m_
autoCommitMode
(
autocommitMode
)
{
m_
autoCommitMode
(
autocommitMode
),
m_
paramNameToIdx
(
sql
)
{
}
//------------------------------------------------------------------------------
...
...
@@ -43,6 +43,13 @@ const std::string &Stmt::getSql() const {
return
m_sql
;
}
//------------------------------------------------------------------------------
// getParamIdx
//------------------------------------------------------------------------------
uint32_t
Stmt
::
getParamIdx
(
const
std
::
string
&
paramName
)
const
{
return
m_paramNameToIdx
.
getIdx
(
paramName
);
}
//------------------------------------------------------------------------------
// getSqlForException
//------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
rdbms/Stmt.hpp
+
15
−
5
View file @
6d5c0c3f
...
...
@@ -95,6 +95,14 @@ public:
*/
const
std
::
string
&
getSql
()
const
;
/**
* Returns the index of the specified SQL parameter.
*
* @param paramName The name of the SQL parameter.
* @return The index of the SQL parameter.
*/
uint32_t
getParamIdx
(
const
std
::
string
&
paramName
)
const
;
/**
* Binds an SQL parameter.
*
...
...
@@ -179,11 +187,6 @@ protected:
*/
std
::
string
m_sql
;
/**
* Map from SQL parameter name to parameter index.
*/
ParamNameToIdx
m_paramNameToIdx
;
/**
* The autocommit mode of the statement.
*/
...
...
@@ -206,6 +209,13 @@ protected:
*/
std
::
string
getSqlForException
()
const
;
private
:
/**
* Map from SQL parameter name to parameter index.
*/
ParamNameToIdx
m_paramNameToIdx
;
};
// class Stmt
}
// namespace rdbms
...
...
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