#include public Plugin:myinfo = { name = "SQL Testing Lab", author = "AlliedModders LLC", description = "Tests basic function calls", version = "1.0.0.0", url = "http://www.sourcemod.net/" }; public OnPluginStart() { RegServerCmd("sql_test_normal", Command_TestSql1) RegServerCmd("sql_test_stmt", Command_TestSql2) } PrintQueryData(Handle:query) { if (!SQL_HasResultSet(query)) { PrintToServer("Query Handle %x has no results", query) return } new rows = SQL_GetRowCount(query) new fields = SQL_GetFieldCount(query) decl String:fieldNames[fields][32] PrintToServer("Fields: %d", fields) for (new i=0; i Field %d: \"%s\"", i, fieldNames[i]) } PrintToServer("Rows: %d", rows) decl String:result[255] new row while (SQL_FetchRow(query)) { row++ PrintToServer("Row %d:", row) for (new i=0; i ?", error, sizeof(error)) if (stmt == INVALID_HANDLE) { PrintToServer("Failed to prepare query: %s", error) } else { SQL_BindParamInt(stmt, 0, 1) if (!SQL_Execute(stmt)) { SQL_GetError(stmt, error, sizeof(error)) PrintToServer("Failed to execute query: %s", error) } else { PrintQueryData(stmt) } CloseHandle(stmt) } CloseHandle(db) return Plugin_Handled; }