Quote:
Originally Posted by brunoronning
Try this method:
It is not elegant, but it works.
|
PHP Code:
public void SomeFunction()
{
DataPack pack = new DataPack();
pack.WriteCell(69);
pack.WriteCell(420);
char szQuery[32];
Format(szQuery, sizeof(szQuery), "SELECT * FROM test");
g_dbTest.Query(SQLCallback_Test, szQuery, pack);
}
public void SQLCallback_Test(Database db, DBResultSet results, const char[] sError, DataPack data)
{
//db not connected or something went wrong with connection:
if (db == null)
{
LogError("(SQLCallback_Test) Database not connected or failed to connect, aboring query...");
return;
}
//query fucked up:
else if(results == null)
{
LogError("(SQLCallback_Test) Fail at Query: %s", sError);
}
int iValue1;
int iValue2;
data.Reset();
iValue1 = data.ReadCell();
iValue2 = data.ReadCell();
delete data;
// Your Code.
}