Use sqlite_prepare_v3; resolved #77; fixes #78 (#81)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-10-27 23:17:23 +01:00
committed by GitHub
parent e6b468af9b
commit e4cf6c802b
2 changed files with 10 additions and 11 deletions

View File

@@ -22,7 +22,6 @@ void assign_if_field_is_field_i(
const std::vector<std::optional<std::string>>& _row, const size_t _i,
ViewType* _view, std::optional<Error>* _err) noexcept {
using FieldType = rfl::tuple_element_t<i, typename ViewType::Fields>;
using OriginalType = typename FieldType::Type;
using T =
std::remove_cvref_t<std::remove_pointer_t<typename FieldType::Type>>;
constexpr auto name = FieldType::name();

View File

@@ -103,11 +103,11 @@ Result<Ref<IteratorBase>> Connection::read_impl(
sqlite3_stmt* p_stmt = nullptr;
sqlite3_prepare(conn_.get(), /* Database handle */
sql.c_str(), /* SQL statement, UTF-8 encoded */
sql.size(), /* Maximum length of zSql in bytes. */
&p_stmt, /* OUT: Statement handle */
nullptr /* OUT: Pointer to unused portion of zSql */
sqlite3_prepare_v2(conn_.get(), /* Database handle */
sql.c_str(), /* SQL statement, UTF-8 encoded */
sql.size(), /* Maximum length of zSql in bytes. */
&p_stmt, /* OUT: Statement handle */
nullptr /* OUT: Pointer to unused portion of zSql */
);
if (!p_stmt) {
@@ -124,11 +124,11 @@ Result<Connection::StmtPtr> Connection::prepare_statement(
const std::string& _sql) const noexcept {
sqlite3_stmt* p_stmt = nullptr;
sqlite3_prepare(conn_.get(), /* Database handle */
_sql.c_str(), /* SQL statement, UTF-8 encoded */
_sql.size(), /* Maximum length of zSql in bytes. */
&p_stmt, /* OUT: Statement handle */
nullptr /* OUT: Pointer to unused portion of zSql */
sqlite3_prepare_v2(conn_.get(), /* Database handle */
_sql.c_str(), /* SQL statement, UTF-8 encoded */
_sql.size(), /* Maximum length of zSql in bytes. */
&p_stmt, /* OUT: Statement handle */
nullptr /* OUT: Pointer to unused portion of zSql */
);
if (!p_stmt) {