SQLite Big Query
#1

Is this good example of querying big info?

pawn Код:
SaveHouse(x)
{
    format(query, sizeof(query), "UPDATE `houses` SET `entrancex` = '%f', `entrancey` = '%f', `entrancez` = '%f', `exitx` = '%f', `exity` = '%f', `exitz` = '%f', `adress` = '%s', `owned` = '%d', `owner` = '%s', `value` = '%d', `hint` = '%d', `virtualworld` = '%d', `lock` = '%d', `rent` = '%d', `rentabil` = '%d', `takings` = '%d', `level` = '%d' WHERE `id` = '%d'",
        HouseInfo[x][hEntrancex],
        HouseInfo[x][hEntrancey],
        HouseInfo[x][hEntrancez],
        HouseInfo[x][hExitx],
        HouseInfo[x][hExity],
        HouseInfo[x][hExitz],
        DB_Escape(HouseInfo[b][hAdress]),
        HouseInfo[x][hOwned],
        DB_Escape(HouseInfo[b][hOwner]),
        HouseInfo[x][hValue],
        HouseInfo[x][hInt],
        HouseInfo[x][hVirtualWorld],
        HouseInfo[x][hLock],
        HouseInfo[x][hRent],
        HouseInfo[x][hRentabil],
        HouseInfo[x][hTakings],
        HouseInfo[x][hLevel],
        HouseInfo[x][hID]);

    db_free_result(db_query(Database,query));

    format(query, sizeof(query), "UPDATE `houses` SET `freeze` = '%d', `viwoexit` = '%d', `gunsafe1` = '%d', `gunsafe2` = '%d', `gunsafe3` = '%d', `gunsafe4` = '%d', `gunammo1` = '%d', `gunammo2` = '%d', `gunammo3` = '%d', `gunammo4` = '%d', `safestatus` = '%d', `safepass` = '%d', `safe` = '%d', `ormar` = '%d', `skin1` = '%d', `skin2` = '%d', `skin3` = '%d' WHERE `id` = '%d'",
        HouseInfo[x][hFreeze],
        HouseInfo[x][h3dViwo],
        HouseInfo[x][hGunSafe1],
        HouseInfo[x][hGunSafe2],
        HouseInfo[x][hGunSafe3],
        HouseInfo[x][hGunSafe4],
        HouseInfo[x][hGunAmmo1],
        HouseInfo[x][hGunAmmo2],
        HouseInfo[x][hGunAmmo3],
        HouseInfo[x][hGunAmmo4],
        HouseInfo[x][hSafeStatus],
        HouseInfo[x][hSafePass],
        HouseInfo[x][hSafe],
        HouseInfo[x][hOrmar],
        HouseInfo[x][hSkin1],
        HouseInfo[x][hSkin2],
        HouseInfo[x][hSkin3],
        HouseInfo[x][hID]);

    db_free_result(db_query(Database,query));

    format(query, sizeof(query), "UPDATE `houses` SET `namirnice` = '%d', `drug1` = '%d', `drug2` = '%d', `drug3` = '%d', `drug4` = '%d', `drug5` = '%d', `drug6` = '%d', `drug7` = '%d', `drug8` = '%d', `drug9` = '%d', `drug10` = '%d', `doorlevel` = '%d', `alarm` = '%d', `locklevel` = '%d', `built` = '%d', `iron` = '%d', `brick` = '%d', `quality` = '%d' WHERE `id` = '%d'",
        HouseInfo[x][hNamirnice],
        HouseInfo[x][hDrug][0],
        HouseInfo[x][hDrug][1],
        HouseInfo[x][hDrug][2],
        HouseInfo[x][hDrug][3],
        HouseInfo[x][hDrug][4],
        HouseInfo[x][hDrug][5],
        HouseInfo[x][hDrug][6],
        HouseInfo[x][hDrug][7],
        HouseInfo[x][hDrug][8],
        HouseInfo[x][hDrug][9],
        HouseInfo[x][hDoorLevel],
        HouseInfo[x][hAlarm],
        HouseInfo[x][hLockLevel],
        HouseInfo[x][hBuilt],
        HouseInfo[x][hIron],
        HouseInfo[x][hBrick],
        HouseInfo[x][hQuality],
        HouseInfo[x][hID]);

    db_free_result(db_query(Database,query));

    return 1;
}
I'm wondering because my server has over 500 houses and when I update table houses by looping through all houses, a warning occurs saying "SQLitei Warning: (db_autofree_result) The autofree pool is full!" Thanks in advance!
Reply
#2

You don't need to free the result after an update query, because there isn't any.
Reply
#3

Okay I removed it but I'm still getting this same warning. And updating all the houses last for 4 full minutes. Anyone know what is a problem?
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
The problem is what you are trying to do - don't update all your houses at once, just update them if and when they change.
Uhm alright, it makes sense.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)