13.06.2012, 06:15
Quote:
Код:
DELETE * FROM `Families` Код:
TRUNCATE TABLE `Families` |
As for the excessive freeing of results, I've read so many views on SQLite, and am having a hard time deciphering right from wrong. Thanks for heads up.
Here is the updated code.
pawn Код:
public SaveFamilies()
{
new
id,
query[256]
;
db_query(Database, "TRUNCATE TABLE `Families`");
while(id < MAX_FAMILIES)
{
format(query, sizeof(query), "INSERT INTO `Families` (`Slot`, `Taken`, `Name`, `Leader`, `MOTD`, `Count`, `Rank1`, `Rank2`, `Rank3`, `Rank4`, `Rank5`, `Rank6`) \
VALUES ('%d', '0', 'None', 'None', 'None', '0', 'Rank1', 'Rank2', 'Rank3', 'Rank4', 'Rank5', 'Rank5')", id);
db_query(Database, query);
if(FamilyInfo[id][fTaken] == 1)
{
format(query, sizeof(query), "UPDATE `Families` SET Name = '%s', Leader = '%s', MOTD = '%s', Count = '%d', Taken = '%d' WHERE Slot = '%d'",
FamilyInfo[id][fName],
FamilyInfo[id][fLeader],
FamilyInfo[id][fMOTD],
FamilyInfo[id][fCount],
FamilyInfo[id][fTaken],
id);
db_query(Database, query);
format(query, sizeof(query), "UPDATE `Families` SET Rank1 = '%s', Rank2 = '%s', Rank3 = '%s', Rank4 = '%s', Rank5 = '%s', Rank6 = '%s' WHERE Slot = '%d'",
FamilyRank[id][0],
FamilyRank[id][1],
FamilyRank[id][2],
FamilyRank[id][3],
FamilyRank[id][4],
FamilyRank[id][5],
id);
db_query(Database, query);
}
id++;
}
return 1;
}
After every restart, the rows increase by 10.