MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / PrepareQuery

Method PrepareQuery

extensions/sqlite/driver/SqDatabase.cpp:177–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177IPreparedQuery *SqDatabase::PrepareQuery(const char *query,
178 char *error,
179 size_t maxlength,
180 int *errCode/* =NULL */)
181{
182 sqlite3_stmt *stmt = NULL;
183 if ((m_LastErrorCode = sqlite3_prepare_v2(m_sq3, query, -1, &stmt, NULL)) != SQLITE_OK
184 || !stmt)
185 {
186 const char *msg;
187 if (m_LastErrorCode != SQLITE_OK)
188 {
189 msg = sqlite3_errmsg(m_sq3);
190 } else {
191 msg = "Invalid query string";
192 m_LastErrorCode = SQLITE_ERROR;
193 }
194 if (error)
195 {
196 strncopy(error, msg, maxlength);
197 }
198 m_LastError.assign(msg);
199 return NULL;
200 }
201 return new SqQuery(this, stmt);
202}
203
204IPreparedQuery *SqDatabase::PrepareQueryEx(const char *query,
205 size_t len,

Callers

nothing calls this directly

Calls 1

strncopyFunction · 0.70

Tested by

no test coverage detected