23.09.2012, 09:54
(
Последний раз редактировалось ReneG; 27.09.2012 в 03:16.
Причина: Updated main post and corrected title
)
When loading some data with threaded queries, the loop won't go past the first iteration.
Server printed out
I have no idea why the loop isn't reaching past the first iteration.
pawn Код:
public OnOriginQueryFinish(query[], resultid, extraid, connectionHandle)
{
new rows, fields, content[128], field[20];
cache_get_data(rows, fields, gConnection);
switch(resultid) {
case THREAD_LOAD_ORIGINS: {
printf("Table ORIGINS returned %d rows", rows);
for(new row=0; row<rows; row++) {
printf("Loop call %d", row);
cache_get_field_content(row, "id", field, gConnection); OriginInfo[row][oSQLid] = strval(content);
cache_get_field_content(row, "Name", OriginInfo[row][oName], gConnection);
cache_get_field_content(row, "X", content, gConnection); OriginInfo[row][oPos][0] = floatstr(content);
cache_get_field_content(row, "Y", content, gConnection); OriginInfo[row][oPos][1] = floatstr(content);
cache_get_field_content(row, "Z", content, gConnection); OriginInfo[row][oPos][2] = floatstr(content);
cache_get_field_content(row, "rotZ", content, gConnection); OriginInfo[row][oPos][3] = floatstr(content);
cache_get_field_content(row, "Interior", content, gConnection); OriginInfo[row][oInt] = strval(content);
cache_get_field_content(row, "VW", content, gConnection); OriginInfo[row][oVW] = strval(content);
printf("Test");
for(new f=0; f<4; f++) {
printf("Loop call %d for skins.", f);
format(field, sizeof(field), "male%d", f+1);
cache_get_field_content(row, field, content, gConnection); OriginInfo[row][oMaleSkins][f] = strval(content);
format(field, sizeof(field), "female%d", f+1);
cache_get_field_content(row, field, content, gConnection); OriginInfo[row][oFemaleSkins][f] = strval(content);
}
printf("ID %d, Name %s, X %f, Y %f, Z %f, RotZ %f, Interior %d, VW %d", OriginInfo[row][oSQLid], OriginInfo[row][oName], OriginInfo[row][oPos][0], OriginInfo[row][oPos][1], OriginInfo[row][oPos][2], OriginInfo[row][oPos][3], OriginInfo[row][oInt], OriginInfo[row][oVW]);
}
}
}
return 1;
}
Код:
[13:53:12] Table ORIGINS returned 3 rows [13:53:12] Loop call 0 [13:53:12] Test [13:53:12] Loop call 0 for skins. [13:53:12] Loop call 1 for skins. [13:53:12] Loop call 2 for skins. [13:53:12] Loop call 3 for skins.