SA-MP Forums Archive
these shitty sql warnings - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: these shitty sql warnings (/showthread.php?tid=606437)



these shitty sql warnings - ReD_HunTeR - 04.05.2016

EDIT: Solved


Re: these shitty sql warnings - jlalt - 04.05.2016

Show your
PHP код:
 new MySQLPipeline



Re: these shitty sql warnings - ReD_HunTeR - 04.05.2016

got these errors in this shity 'gates' table, not anywhere else :/


Re: these shitty sql warnings - Konstantinos - 04.05.2016

MySQLPipeline should have a tag of DB: when it is declared.

Are you trying to convert MySQL to SQLite? Having "MySQL" in variable name but using sqlite functions.


Re: these shitty sql warnings - ReD_HunTeR - 04.05.2016

ye, konstantinos
i'm trying to convert SQLite to MySQL :P


Re: these shitty sql warnings - PrO.GameR - 04.05.2016

Do you see the trend here? whenever you use MySQLPipeline you see a tagmismatch warning, which well .. tells you it doesn't match the tag, so match it for god's sake(sqlite's tag for connection is DB).


Re: these shitty sql warnings - ReD_HunTeR - 04.05.2016

can you help me to conver this into mysql? ill do others myself..
Код:
    new Query[250],DBResult:Result,gateid = 0;
    for(new i = 0; i < MAX_GATES; i++)
    {
        format(Query, sizeof(Query),"SELECT * FROM gates WHERE ID = %d",i);
        Result = db_query(MySQLPipeline, Query);
        if(db_num_rows(Result))
        {
            format(Query, sizeof(Query),"UPDATE `gates` SET `ID` = '%d' WHERE `ID` = '%d'",gateid,i);
            db_query(MySQLPipeline, Query);
            gateid ++;
        }
    }



Re: these shitty sql warnings - Konstantinos - 04.05.2016

Oh, it was the other way around.

I'm trying to figure out what your code is supposed to do - are you trying to set the IDs again without the missing numbers (perhaps those that were deleted)? Having set auto increment for a table is always good, so don't worry if you delete some of the rows and you see the IDs as the following: 1, 2, 6, 7, 10 etc.


Re: these shitty sql warnings - ReD_HunTeR - 04.05.2016

yes you're right konstantinos, so how can i fix those warnings?


Re: these shitty sql warnings - Konstantinos - 04.05.2016

pawn Код:
// global:
new gateid;

// calling it once to fix them for now
new Query[50];
for (new i = 0; i < MAX_GATES; i++)
{
    format(Query, sizeof(Query), "SELECT * FROM gates WHERE ID = %d LIMIT 1", i);
    mysql_tquery(MySQLPipeline, Query, "OnGateLoad", "ii", gateid, i);

    gateid++;
}

forward OnGateLoad(gate_id, _i);
public OnGateLoad(gate_id, _i)
{
    if (cache_get_row_count())
    {
        new Query[45];
        format(Query, sizeof(Query), "UPDATE gates SET ID = %d WHERE ID = %d", gate_id, _i);
        mysql_tquery(MySQLPipeline, Query, "", "");
    }
    return 1;
}