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

Method GetInt

extensions/sqlite/driver/SqResults.cpp:389–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389DBResult SqResults::GetInt(unsigned int columnId, int *pInt)
390{
391 SqField *field = GetField(columnId);
392 if (!field)
393 {
394 return DBVal_Error;
395 } else if (field->type == SQLITE_BLOB) {
396 return DBVal_Error;
397 }
398
399 int val = 0;
400 if (field->type == SQLITE_INTEGER)
401 {
402 val = field->u.idx;
403 } else if (field->type == SQLITE_TEXT) {
404 const char *ptr = m_Strings.GetString(field->u.idx);
405 if (ptr)
406 {
407 val = atoi(ptr);
408 }
409 } else if (field->type == SQLITE_FLOAT) {
410 val = (int)field->u.f;
411 }
412
413 if (pInt)
414 {
415 *pInt = val;
416 }
417
418 return (field->type == SQLITE_NULL) ? DBVal_Null : DBVal_Data;
419}
420
421DBResult SqResults::GetBlob(unsigned int columnId, const void **pData, size_t *length)
422{

Callers

nothing calls this directly

Calls 1

GetStringMethod · 0.45

Tested by

no test coverage detected