Skip to content

Commit 6b6eaa7

Browse files
authored
Merge pull request #160 from oblivioncth/dev
Merge to master for v0.7.0.1
2 parents 1d15649 + bde0629 commit 6b6eaa7

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.23.0...3.31.0)
88
# avoided and only used for hotfixes. DON'T USE TRAILING
99
# ZEROS IN VERSIONS
1010
project(Qx
11-
VERSION 0.7
11+
VERSION 0.7.0.1
1212
LANGUAGES CXX
1313
DESCRIPTION "Qt Extensions Library"
1414
)

lib/sql/include/qx/sql/__private/qx-sqlstring_helpers.h

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,29 @@ void appendKeywordParen(QString& str, const QString& word, const R& range)
5656
/* The boxing here is inefficient, but I'm not sure how to improve the situation since
5757
* we rely on the SqlString ctor to reliably get a string from value_type.
5858
*/
59-
QString rStr = u"'"_s;
59+
60+
/* TODO: This is a bit of a hack. We manually quote when the contained type of R is QString
61+
* based. This works, but there is an arugment to be made that the caller should be responsible
62+
* for ensuring that everything is quoted as required (or is a type that auto quotes) ahead of
63+
* time, and this may on occasion cause accidental double quoting.
64+
*/
65+
constexpr bool quote = std::constructible_from<QString, Qx::unwrap<R>>;
66+
QString rStr;
67+
if constexpr(quote)
68+
rStr += u"'"_s;
6069
for(auto n = std::size(range); const auto& value : range)
6170
{
6271
rStr += __private::qstring_compat(value);
6372
if(n-- != 1)
64-
rStr += u"','"_s;
73+
{
74+
if constexpr(quote)
75+
rStr += u"','"_s;
76+
else
77+
rStr += u","_s;
78+
}
6579
}
66-
rStr += u"'"_s;
80+
if constexpr(quote)
81+
rStr += u"'"_s;
6782

6883
appendKeywordParen(str, word, rStr);
6984
}

lib/sql/src/qx-sqlquery.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
/*!
132132
* @def QX_SQL_MEMBER_OVERRIDE()
133133
*
134-
* Used to define a member/field specific value parsing/serialzing override for a
134+
* Used to define a member/field specific value parsing/serializing override for a
135135
* SQL-tried struct. The specified member will be processed using the provided
136136
* functions instead of potentially available generic ones for that type.
137137
*
@@ -289,7 +289,7 @@ void SqlQuery::bindValue(const QString& placeholder, const QVariant& val) { mBin
289289
/*!
290290
* @fn Derived& AbstractSqlQuery::IN(const R& range)
291291
*
292-
* Adds an `IN` clause to the query using all of the elments from @a range.
292+
* Adds an `IN` clause to the query using all of the elements from @a range.
293293
*
294294
* If @a range is empty, the SQL statement will be ill-formed.
295295
*/

0 commit comments

Comments
 (0)