08.04.2013, 14:02
Всем привет. Возникла проблема при загрузке и сохранении значений из базы.
Вот сама загрузка:
В mysql_log.txt пишет следущее:
А вот сохранение:
В логе про сохранение ничего нет.
Вот сама загрузка:
pawn Код:
public LoadFactionsCallback()
{
new rows, fields;
cache_get_data(rows, fields);
TOTAL_FACTIONS = rows;
if(rows)
{
for (new id = 1; id < MAX_FACTIONS + 1 ; id ++)
{
szFaction[id][fID] = cache_get_field(id, "ID", g_ConnectionHandle);
cache_get_field_content(id, "Name", szFaction[id][fName], g_ConnectionHandle);
szFaction[id][fSpawnX] = cache_get_field(id, "SpawnX", g_ConnectionHandle);
szFaction[id][fSpawnY] = cache_get_field(id, "SpawnY", g_ConnectionHandle);
szFaction[id][fSpawnZ] = cache_get_field(id, "SpawnZ", g_ConnectionHandle);
szFaction[id][fSpawnA] = cache_get_field(id, "SpawnA", g_ConnectionHandle);
szFactionRank[id][0] = cache_get_field(id, "Rank1", g_ConnectionHandle);
szFactionRank[id][1] = cache_get_field(id, "Rank2", g_ConnectionHandle);
szFactionRank[id][2] = cache_get_field(id, "Rank3", g_ConnectionHandle);
szFactionRank[id][3] = cache_get_field(id, "Rank4", g_ConnectionHandle);
szFactionRank[id][4] = cache_get_field(id, "Rank5", g_ConnectionHandle);
szFactionRank[id][5] = cache_get_field(id, "Rank6", g_ConnectionHandle);
szFactionRank[id][6] = cache_get_field(id, "Rank7", g_ConnectionHandle);
szFactionRank[id][7] = cache_get_field(id, "Rank8", g_ConnectionHandle);
szFactionRank[id][8] = cache_get_field(id, "Rank9", g_ConnectionHandle);
szFactionRank[id][9] = cache_get_field(id, "Rank10", g_ConnectionHandle);
szFactionRank[id][10] = cache_get_field(id, "Rank11", g_ConnectionHandle);
szFactionRank[id][11] = cache_get_field(id, "Rank12", g_ConnectionHandle);
szFactionRank[id][12] = cache_get_field(id, "Rank13", g_ConnectionHandle);
szFactionRank[id][13] = cache_get_field(id, "Rank14", g_ConnectionHandle);
szFactionRank[id][14] = cache_get_field(id, "Rank15", g_ConnectionHandle);
}
}
printf("Организации загружены. Количество: %d",TOTAL_FACTIONS);
return true;
}
pawn Код:
[20:25:46] LoadFactionsCallback() - Threaded function called.
[20:25:46] >> cache_get_data( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] >> cache_get_field( Connection handle: 1 )
[20:25:46] ProcessTick() - The cache has been cleared.
pawn Код:
stock SaveFaction(factid)
{
new query[550];
format(query,550,"UPDATE "FactionTable" SET Name='%s',SpawnX='%f',SpawnY='%f',SpawnZ='%f',SpawnA='%f',Rank1='%s',Rank2='%s',Rank3='%s',Rank4='%s',Rank5='%s',Rank6='%s',Rank7='%s',Rank8='%s',Rank9='%s',Rank10='%s',Rank11='%s',Rank12='%s',Rank13='%s',Rank14='%s',Rank15='%s' WHERE ID = %d",
szFaction[factid][fName],
szFaction[factid][fSpawnX],
szFaction[factid][fSpawnY],
szFaction[factid][fSpawnZ],
szFaction[factid][fSpawnA],
szFactionRank[factid][0],
szFactionRank[factid][1],
szFactionRank[factid][2],
szFactionRank[factid][3],
szFactionRank[factid][4],
szFactionRank[factid][5],
szFactionRank[factid][6],
szFactionRank[factid][7],
szFactionRank[factid][8],
szFactionRank[factid][9],
szFactionRank[factid][10],
szFactionRank[factid][11],
szFactionRank[factid][12],
szFactionRank[factid][13],
szFactionRank[factid][14]);
mysql_function_query(g_ConnectionHandle, query, false, "", "");
printf("Организация [%d] успешно сохранена.");
return true;
}