1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Update SQLite.cpp

This commit is contained in:
Sandu Liviu Catalin 2021-09-12 15:13:20 +03:00
parent f1ef37bdf3
commit ba4b8524e5

View File

@ -454,7 +454,7 @@ LightObj EscapeString(StackStrF & str)
// Allocate extra space to make sure there's room for a null terminator since we need it // Allocate extra space to make sure there's room for a null terminator since we need it
// This is a f* up from SQLite devs not returning the number of written characters from snprintf // This is a f* up from SQLite devs not returning the number of written characters from snprintf
// So we can figure out if we actually had room for the null terminator or not // So we can figure out if we actually had room for the null terminator or not
b.reserve(static_cast< size_t >(str.mLen * 2)); b.reserve(static_cast< size_t >(str.mLen * 2 + 1));
// Attempt to escape the specified string // Attempt to escape the specified string
sqlite3_snprintf(static_cast<int>(b.capacity()), b.data(), "%q", str.mPtr); sqlite3_snprintf(static_cast<int>(b.capacity()), b.data(), "%q", str.mPtr);
// Return the resulted string // Return the resulted string
@ -482,7 +482,7 @@ LightObj EscapeStringEx(SQChar spec, StackStrF & str)
// Allocate a memory buffer // Allocate a memory buffer
std::vector< SQChar > b; std::vector< SQChar > b;
// Allocate extra space to make sure there's room for a null terminator since we need it (see above) // Allocate extra space to make sure there's room for a null terminator since we need it (see above)
b.reserve(static_cast< size_t >(str.mLen * 2)); b.reserve(static_cast< size_t >(str.mLen * 2 + 1));
// Attempt to escape the specified string // Attempt to escape the specified string
sqlite3_snprintf(static_cast<int>(b.capacity()), b.data(), fs, str.mPtr); sqlite3_snprintf(static_cast<int>(b.capacity()), b.data(), fs, str.mPtr);
// Return the resulted string // Return the resulted string