Converted to threaded MySQL, using R7 BlueG's, issues loading. -
I'm completely new to threaded mysql and I've gave it a good shot. However, nothing is loading despite the connections being correct, vehicles aren't loading etc.
pawn Код:
stock LoadVehicles()
{
new QueryString[256], count, vehicleid;
mysql_function_query(dbHandle, "SELECT * FROM vehicles", true, "", "");
//mysql_query( "SELECT id, VehModel,VehOwner, VehColour1, VehColour2, VehPlate, VehSpawnX, VehSpawnY, VehSpawnZ, VehSpawnAngle, VehFuel, VehCash,VehWep1,VehWepA1,VehWep2,VehWepA2, VehArmour,VehFaction,VehFRank, VehOwned, VehFactioned, VehWeed, VehCoke, VehBizID, VehForSale,VehPrice FROM vehicles");
//mysql_store_result();
new y, x;
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
cache_get_row(y, vvid, QueryString);
x = strval(QueryString);
cache_get_row(y, vVehModel, QueryString);
VehModel[x] = strval( QueryString);
cache_get_row(y, vVehColour1, QueryString);
VehColour1[x] = strval( QueryString);
cache_get_row(y, vVehColour2, QueryString);
VehColour2[x] = strval( QueryString);
cache_get_row(y,vVehSpawnX, QueryString);
VehSpawnX[x] = floatstr( QueryString);
cache_get_row(y,vVehSpawnY, QueryString);
VehSpawnY[x] = floatstr( QueryString);
cache_get_row(y,vVehSpawnZ, QueryString);
VehSpawnZ[x] = floatstr( QueryString);
cache_get_row(y,vVehSpawnAngle, QueryString);
VehSpawnAngle[x] = floatstr( QueryString);
vehicleid = CreateVehicle(VehModel[x], VehSpawnX[x], VehSpawnY[x],VehSpawnZ[x], VehSpawnAngle[x], VehColour1[x], VehColour2[x], -1, VehSiren[x]);
VehicleSQLID[vehicleid] = x;
cache_get_row(y,vVehPlate, VehPlate[vehicleid]);
SetVehicleNumberPlate(vehicleid, VehPlate[vehicleid]);
cache_get_row(y,vVehOwner, QueryString);
VehOwner[vehicleid] = strval( QueryString);
cache_get_row(y,vVehJob, QueryString);
VehJob[vehicleid] = strval( QueryString);
cache_get_row(y,vVehFuel, QueryString);
VehFuel[vehicleid] = strval( QueryString);
cache_get_row(y,vVehCash, QueryString);
VehCash[vehicleid] = strval( QueryString);
cache_get_row(y,vVehWeed, QueryString);
VehWeed[vehicleid] = strval( QueryString);
cache_get_row(y,vVehCoke, QueryString);
VehCoke[vehicleid] = strval( QueryString);
cache_get_row(y,vVehLock, QueryString);
VehLock[vehicleid] = strval( QueryString);
cache_get_row(y,vVehAlarm, QueryString);
VehAlarm[vehicleid] = strval( QueryString);
cache_get_row(y,vVehFaction, QueryString);
VehicleFaction[vehicleid] = strval( QueryString);
cache_get_row(y,vVehFRank, QueryString);
VehicleRank[vehicleid] = strval( QueryString);
cache_get_row(y,vVehOwned, QueryString);
VehOwned[vehicleid] = strval( QueryString);
cache_get_row(y,vVehFactioned, QueryString);
VehFactioned[vehicleid] = strval( QueryString);
cache_get_row(y,vVehArmour, QueryString);
VehArmour[vehicleid] = floatstr( QueryString);
cache_get_row(y,vVehBizID, QueryString);
VehBizID[vehicleid] = strval( QueryString);
cache_get_row(y, vVehForSale, QueryString);
VehForSale[vehicleid] = strval( QueryString);
cache_get_row(y,vVehPrice, QueryString);
VehPrice[vehicleid] = strval( QueryString);
cache_get_row(y,vVehWepSlots, QueryString);
VehWepSlots[vehicleid] = strval( QueryString);
cache_get_row(y,vVehSiren, QueryString);
VehSiren[vehicleid] = strval(QueryString);
cache_get_row(y,vVehFType, QueryString);
VehFType[vehicleid] = strval(QueryString);
cache_get_row(y,vVehSpark, QueryString);
VehSpark[vehicleid] = strval(QueryString);
cache_get_row(y,vVehWater, QueryString);
VehWater[vehicleid] = strval(QueryString);
cache_get_row(y,vVehGear, QueryString);
VehGear[vehicleid] = strval(QueryString);
cache_get_row(y,vVehElec, QueryString);
VehElec[vehicleid] = strval(QueryString);
cache_get_row(y,vVehOil, QueryString);
VehOil[vehicleid] = strval(QueryString);
cache_get_row(y,vVehExhaust, QueryString);
VehExhaust[vehicleid] = strval(QueryString);
cache_get_row(y,vVehFLine, QueryString);
VehFLine[vehicleid] = strval(QueryString);
cache_get_row(y,vVehRadi, QueryString);
VehRadi[vehicleid] = strval(QueryString);
cache_get_row(y,vVehBattery, QueryString);
VehBattery[vehicleid] = strval(QueryString);
cache_get_row(y,vVehFSize, QueryString);
VehFSize[vehicleid] = strval(QueryString);
cache_get_row(y,vVehTyres, QueryString);
VehTyres[vehicleid] = strval(QueryString);
cache_get_row(y,vVehFUsed, QueryString);
VehFUsed[vehicleid] = strval(QueryString);
cache_get_row(y,vVehVMarker, QueryString);
VehVMarker[vehicleid] = strval(QueryString);
cache_get_row(y,vVehFMarker, QueryString);
VehFMarker[vehicleid] = strval(QueryString);
cache_get_row(y,vVehNMarker, QueryString);
VehNMarker[vehicleid] = strval(QueryString);
cache_get_row(y,vVehFSlots, QueryString);
VehFSlots[vehicleid] = strval(QueryString);
if(VehicleFaction[vehicleid] > 0)
{
new string[12];
format(string, sizeof(string), "%s%d", ShortFName[VehicleFaction[vehicleid]], x);
if(strcmp(string, VehPlate[vehicleid], false))
{
count++;
format(VehPlate[vehicleid], sizeof(VehPlate),"%s%d", ShortFName[VehicleFaction[vehicleid]], x);
MySQL_SetString(x, "VehPlate", VehPlate[vehicleid], "vehicles");
SetVehicleNumberPlate(vehicleid, VehPlate[vehicleid]);
printf("unmatched Vehicle Plates: %d", count);
}
}
if(VehicleFaction[vehicleid] == 0)
{
printf("PLATE %s - not faction", VehPlate[vehicleid]);
SetVehicleNumberPlate(vehicleid, VehPlate[vehicleid]);
}
SetVehicleParamsEx(vehicleid, 0, 0, 0, VehLock[vehicleid], 0, 0, 0);
SetVehicleParamsCarDoors(vehicleid, 0,0,0,0);
SetVehicleParamsCarWindows(vehicleid, 1,1, 1, 1);
if(VehForSale[vehicleid] == 1)
{
new string[128];
new name = VehModel[vehicleid] - 400;
format(string, sizeof(string), "%s, $%s, %s", VehicleNames[name], AddCommas(VehPrice[vehicleid]), VehPlate[vehicleid]);
VehicleLabel[vehicleid] = CreateDynamic3DTextLabel(string, COLOUR_ORANGE, VehSpawnX[vehicleid],VehSpawnY[vehicleid], VehSpawnZ[vehicleid], 100.0, INVALID_PLAYER_ID, vehicleid, 0, 0, -1, -1, 20.0);
Attach3DTextLabelToVehicle(VehicleLabel[vehicleid] ,vehicleid,0.0,0.0,0.0);
}
y++;
}
return 1;
}
The defines are all listed correctly (took me hours).
Here is the mysql log.
I know I've probably done something stupid, any assistance would be kindly appreciated.
Re: Converted to threaded MySQL, using R7 BlueG's, issues loading. -
Re: Converted to threaded MySQL, using R7 BlueG's, issues loading. -
Re: Converted to threaded MySQL, using R7 BlueG's, issues loading. -
Neither of those is actually threaded. The whole point of using threads is you don't bog down the main server thread while waiting for the result. It is comparable to how you use timers. You need a callback.
Re: Converted to threaded MySQL, using R7 BlueG's, issues loading. -
Thanks a lot for the replies, Thanks Vince, I've changed it all, about to test.