So the above code is OK? Or should I send it to the callback and after sending in the same function close it again?
So like this:
PHP Code:
public void SQL_Insert_Death(Database db, DBResultSet results, const char[] error, DataPack hEventInfo) {
hEventInfo.Reset(); // reset datapack pos, you need to do this before reading a datapack
char type[32]; hEventInfo.ReadString(type, sizeof(type)); // "kill"
char weapon[32]; hEventInfo.ReadString(weapon, sizeof(weapon)); // "ak47"
char killerTeam[32]; hEventInfo.ReadString(killerTeam, sizeof(killerTeam)); // "T"
char victimTeam[32]; hEventInfo.ReadString(victimTeam, sizeof(victimTeam)); // "CT"
int iNumber = hEventInfo.ReadCell(); // 1920394
//Create Type
char createTypeQuery[256]; FormatEx(createTypeQuery, sizeof(createTypeQuery), "INSERT INTO types (name) VALUES ('%s');", eventDetail);
db.Query(SQL_Create_Type, createTypeQuery, hEventInfo);
// make sure to close the datapack handle
delete hEventInfo;
}
Or just close it after I use it for the last time?