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

Function SQL_GetError

core/logic/smn_database.cpp:697–724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

695}
696
697static cell_t SQL_GetError(IPluginContext *pContext, const cell_t *params)
698{
699 IDatabase *db = NULL;
700 IPreparedQuery *stmt = NULL;
701 HandleError err;
702
703 if ((err = ReadDbOrStmtHndl(params[1], pContext, &db, &stmt)) != HandleError_None)
704 {
705 return pContext->ThrowNativeError("Invalid statement or db Handle %x (error: %d)", params[1], err);
706 }
707
708 const char *error = "";
709 if (db)
710 {
711 error = db->GetError();
712 } else if (stmt) {
713 error = stmt->GetError();
714 }
715
716 if (error[0] == '\0')
717 {
718 return false;
719 }
720
721 pContext->StringToLocalUTF8(params[2], params[3], error, NULL);
722
723 return 1;
724}
725
726static cell_t SQL_QuoteString(IPluginContext *pContext, const cell_t *params)
727{

Callers

nothing calls this directly

Calls 2

ReadDbOrStmtHndlFunction · 0.85
GetErrorMethod · 0.45

Tested by

no test coverage detected