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

Method Execute

extensions/sqlite/driver/SqQuery.cpp:133–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133bool SqQuery::Execute()
134{
135 int rc;
136
137 /* If we don't have a result set and we have a column count,
138 * create a result set pre-emptively. This is in case there
139 * are no rows in the upcoming result set.
140 */
141 if (!m_pResults && m_ColCount)
142 {
143 m_pResults = new SqResults(this);
144 }
145
146 /* If we've got results, throw them away */
147 if (m_pResults)
148 {
149 m_pResults->ResetResultCount();
150 }
151
152 /* Fetch each row, if any */
153 while ((rc = sqlite3_step(m_pStmt)) == SQLITE_ROW)
154 {
155 /* This should NEVER happen but we're being safe. */
156 if (!m_pResults)
157 {
158 m_pResults = new SqResults(this);
159 }
160 m_pResults->PushResult();
161 }
162
163 sqlite3 *db = m_pParent->GetDb();
164 if (rc != SQLITE_OK && rc != SQLITE_DONE && rc == sqlite3_errcode(db))
165 {
166 /* Something happened... */
167 m_LastErrorCode = rc;
168 m_LastError.assign(sqlite3_errmsg(db));
169 m_AffectedRows = 0;
170 m_InsertID = 0;
171 } else {
172 m_LastErrorCode = SQLITE_OK;
173 m_AffectedRows = (unsigned int)sqlite3_changes(db);
174 m_InsertID = (unsigned int)sqlite3_last_insert_rowid(db);
175 }
176
177 /* Reset everything for the next execute */
178 sqlite3_reset(m_pStmt);
179 sqlite3_clear_bindings(m_pStmt);
180
181 return (m_LastErrorCode == SQLITE_OK);
182}
183
184const char *SqQuery::GetError(int *errCode/* =NULL */)
185{

Callers 15

FireEventDetourMethod · 0.45
OnTimerMethod · 0.45
OnClientVoiceMethod · 0.45
TempEntityInfoMethod · 0.45
SDKCallFunction · 0.45
OnPlaybackTempEntityMethod · 0.45
TeleportFunction · 0.45
GetVelocityFunction · 0.45
GetEyeAnglesFunction · 0.45
AcceptEntityInputFunction · 0.45
SetClientInfoFunction · 0.45

Calls 3

ResetResultCountMethod · 0.80
PushResultMethod · 0.80
GetDbMethod · 0.80

Tested by

no test coverage detected