diff --git a/orm_lib/inc/drogon/orm/SqlBinder.h b/orm_lib/inc/drogon/orm/SqlBinder.h index 3335e6ffbd..83cb737532 100644 --- a/orm_lib/inc/drogon/orm/SqlBinder.h +++ b/orm_lib/inc/drogon/orm/SqlBinder.h @@ -312,6 +312,13 @@ class DROGON_EXPORT SqlBinder : public trantor::NonCopyable client_(client), type_(type) { + if (sql[sqlLength] != '\0') + { + // if the sql is not null terminated, we need to copy it to a string + sqlPtr_ = std::make_shared(sql, sqlLength); + sqlViewPtr_ = sqlPtr_->data(); + sqlViewLength_ = sqlPtr_->length(); + } } SqlBinder(SqlBinder &&that) noexcept