-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3389f50
commit 230d850
Showing
5 changed files
with
147 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
diff --git a/alpine-x64.dockerfile b/alpine-x64.dockerfile | ||
index d24c0d661..1e84ea96e 100644 | ||
--- a/alpine-x64.dockerfile | ||
+++ b/alpine-x64.dockerfile | ||
@@ -1,27 +1,11 @@ | ||
FROM amd64/alpine:3.20.1 | ||
|
||
-RUN apk add \ | ||
- samurai \ | ||
- ninja-build \ | ||
- autoconf \ | ||
- automake \ | ||
- gcc \ | ||
- g++ \ | ||
- cmake \ | ||
- git \ | ||
- libtool \ | ||
- libunwind-dev \ | ||
- gtest-dev \ | ||
- benchmark-dev \ | ||
- sqlite-dev \ | ||
- libpq-dev \ | ||
- mariadb-connector-c-dev \ | ||
- asio-dev \ | ||
- openssl-dev \ | ||
- libarchive-dev \ | ||
- python3 \ | ||
- py3-pip \ | ||
- doxygen | ||
+RUN apk add samurai ninja-build autoconf automake gcc g++ cmake | ||
+ | ||
+RUN apk add libtool libunwind-dev gtest-dev benchmark-dev sqlite-dev libpq-dev mariadb-connector-c-dev \ | ||
+ asio-dev openssl-dev libarchive-dev python3 py3-pip | ||
+ | ||
+RUN apk add doxygen mariadb-client postgresql-client | ||
|
||
COPY ./requirements.txt /tmp/requirements.txt | ||
|
||
diff --git a/sese/internal/db/impl/sqlite/SqlitePreparedStatementImpl.cpp b/sese/internal/db/impl/sqlite/SqlitePreparedStatementImpl.cpp | ||
index 6d085d8eb..64d18fdb3 100644 | ||
--- a/sese/internal/db/impl/sqlite/SqlitePreparedStatementImpl.cpp | ||
+++ b/sese/internal/db/impl/sqlite/SqlitePreparedStatementImpl.cpp | ||
@@ -92,6 +92,7 @@ int64_t impl::SqlitePreparedStatementImpl::executeUpdate() noexcept { | ||
} | ||
|
||
bool impl::SqlitePreparedStatementImpl::setDouble(uint32_t index, const double &value) noexcept { | ||
+ if (index == 0 || index > count) return false; | ||
if (this->stmtStatus) sqlite3_reset(stmt); | ||
if (this->isManual[index - 1]) { | ||
free(this->buffer[index - 1]); | ||
@@ -102,6 +103,7 @@ bool impl::SqlitePreparedStatementImpl::setDouble(uint32_t index, const double & | ||
} | ||
|
||
bool impl::SqlitePreparedStatementImpl::setFloat(uint32_t index, const float &value) noexcept { | ||
+ if (index == 0 || index > count) return false; | ||
if (this->stmtStatus) sqlite3_reset(stmt); | ||
if (this->isManual[index - 1]) { | ||
free(this->buffer[index - 1]); | ||
@@ -112,6 +114,7 @@ bool impl::SqlitePreparedStatementImpl::setFloat(uint32_t index, const float &va | ||
} | ||
|
||
bool impl::SqlitePreparedStatementImpl::setLong(uint32_t index, const int64_t &value) noexcept { | ||
+ if (index == 0 || index > count) return false; | ||
if (this->stmtStatus) sqlite3_reset(stmt); | ||
if (this->isManual[index - 1]) { | ||
free(this->buffer[index - 1]); | ||
@@ -122,6 +125,7 @@ bool impl::SqlitePreparedStatementImpl::setLong(uint32_t index, const int64_t &v | ||
} | ||
|
||
bool impl::SqlitePreparedStatementImpl::setInteger(uint32_t index, const int32_t &value) noexcept { | ||
+ if (index == 0 || index > count) return false; | ||
if (this->stmtStatus) sqlite3_reset(stmt); | ||
if (this->isManual[index - 1]) { | ||
free(this->buffer[index - 1]); | ||
@@ -132,6 +136,7 @@ bool impl::SqlitePreparedStatementImpl::setInteger(uint32_t index, const int32_t | ||
} | ||
|
||
bool impl::SqlitePreparedStatementImpl::setText(uint32_t index, const char *value) noexcept { | ||
+ if (index == 0 || index > count) return false; | ||
if (this->stmtStatus) sqlite3_reset(stmt); | ||
if (this->isManual[index - 1]) { | ||
free(this->buffer[index - 1]); | ||
@@ -148,6 +153,7 @@ bool impl::SqlitePreparedStatementImpl::setText(uint32_t index, const char *valu | ||
} | ||
|
||
bool impl::SqlitePreparedStatementImpl::setNull(uint32_t index) noexcept { | ||
+ if (index == 0 || index > count) return false; | ||
if (this->stmtStatus) sqlite3_reset(stmt); | ||
if (this->isManual[index - 1]) { | ||
free(this->buffer[index - 1]); | ||
@@ -158,6 +164,7 @@ bool impl::SqlitePreparedStatementImpl::setNull(uint32_t index) noexcept { | ||
} | ||
|
||
bool impl::SqlitePreparedStatementImpl::setDateTime(uint32_t index, const sese::DateTime &value) noexcept { | ||
+ if (index == 0 || index > count) return false; | ||
if (this->stmtStatus) sqlite3_reset(stmt); | ||
this->stmtStatus = false; | ||
|
||
diff --git a/sese/test/TestFormat.cpp b/sese/test/TestFormat.cpp | ||
index 515551380..7a6130bfa 100644 | ||
--- a/sese/test/TestFormat.cpp | ||
+++ b/sese/test/TestFormat.cpp | ||
@@ -123,16 +123,17 @@ TEST(TestFormat, Number) { | ||
} | ||
|
||
TEST(TestFormat, Formatter) { | ||
- Point point{1, 2}; | ||
- SESE_INFO(R"(\{{\}123\}ABC\}})", point); | ||
- auto datetime = sese::DateTime::now(); | ||
- SESE_INFO("{} | {HH:mm:ss}", datetime, datetime); | ||
- SESE_INFO("{A}", "Hello"); | ||
+ // Point point{1, 2}; | ||
+ // SESE_INFO(R"(\{{\}123\}ABC\}})", point); | ||
+ // auto datetime = sese::DateTime::now(); | ||
+ // SESE_INFO("{} | {HH:mm:ss}", datetime, datetime); | ||
+ // SESE_INFO("{A}", "Hello"); | ||
+ SESE_INFO("free buffer[{}] = 0x{:x}", 1, 123456); | ||
} | ||
|
||
TEST(TestFormat, MismatchParam) { | ||
SESE_INFO("{}"); | ||
- SESE_INFO("{}",1, 2); | ||
+ SESE_INFO("{}", 1, 2); | ||
} | ||
|
||
TEST(TestFormat, Constexpr) { | ||
diff --git a/sese/text/Format.cpp b/sese/text/Format.cpp | ||
index 3aa635c2f..a519e246f 100644 | ||
--- a/sese/text/Format.cpp | ||
+++ b/sese/text/Format.cpp | ||
@@ -57,6 +57,7 @@ bool sese::text::FmtCtx::parsing(std::string &args) { | ||
|
||
// 无参数直接返回 | ||
if (*pre_m == '}') { | ||
+ pos = pre_m + 1; | ||
return true; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters