SA-MP Forums Archive
SQLite last_insert_rowid() tag mismatch - 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: SQLite last_insert_rowid() tag mismatch (/showthread.php?tid=528723)



SQLite last_insert_rowid() tag mismatch - arko123 - 29.07.2014

Hello I am currectly having an issue with this code:
pawn Код:
new DBResult: Result;

Result = db_query(Database, "SELECT last_insert_rowid()");
                       
LoadVehicle(Result);
                       
db_free_result(Result);
The issue I am having is that it is giving me a tag mismatch on this line:

pawn Код:
Result = db_query(Database, "SELECT last_insert_rowid()");
Can someone please explain what I am doing wrong here please.


Re: SQLite last_insert_rowid() tag mismatch - arko123 - 29.07.2014

EDIT:
It is infact this line that i get the error on:

pawn Код:
LoadVehicle(Result);
Sorry about that.


Re: SQLite last_insert_rowid() tag mismatch - arko123 - 29.07.2014

Anyone know what may be causing this?


Re: SQLite last_insert_rowid() tag mismatch - arko123 - 30.07.2014

Bump


Re: SQLite last_insert_rowid() tag mismatch - Ihateyou - 30.07.2014

show LoadVehicle() or try strval(Result) or something


Re: SQLite last_insert_rowid() tag mismatch - arko123 - 30.07.2014

Quote:
Originally Posted by Ihateyou
Посмотреть сообщение
show LoadVehicle() or try strval(Result) or something
strval wouldn't work other than giving a different tag mismatch, here is the LoadVehicle stock:
pawn Код:
stock LoadVehicle(id)
{  
    new
        DBResult: Result,
        Query[256],
        temp[256];
       
    format(Query, sizeof Query, "SELECT * FROM `vehicles` WHERE `id` = %i", id);   
    db_query(Database, Query);
   
    if(db_num_rows(Result))
    {
        db_get_field_assoc(Result, "id", temp, sizeof temp);
        Vehicle[id][vSQLID] = strval(temp);
       
        db_get_field_assoc(Result, "modelid", temp, sizeof temp);
        Vehicle[id][vModel] = strval(temp);
       
        db_get_field_assoc(Result, "pos_x", temp, sizeof temp);
        Vehicle[id][vPos][0] = floatstr(temp);
       
        db_get_field_assoc(Result, "pos_y", temp, sizeof temp);
        Vehicle[id][vPos][1] = floatstr(temp);
       
        db_get_field_assoc(Result, "pos_z", temp, sizeof temp);
        Vehicle[id][vPos][2] = floatstr(temp);
       
        db_get_field_assoc(Result, "pos_r", temp, sizeof temp);
        Vehicle[id][vPos][3] = floatstr(temp);
       
        db_get_field_assoc(Result, "colour1", temp, sizeof temp);
        Vehicle[id][vColour][0] = strval(temp);
       
        db_get_field_assoc(Result, "colour2", temp, sizeof temp);
        Vehicle[id][vColour][1] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_0", temp, sizeof temp);
        Vehicle[id][vMods][0] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_1", temp, sizeof temp);
        Vehicle[id][vMods][1] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_2", temp, sizeof temp);
        Vehicle[id][vMods][2] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_3", temp, sizeof temp);
        Vehicle[id][vMods][3] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_4", temp, sizeof temp);
        Vehicle[id][vMods][4] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_5", temp, sizeof temp);
        Vehicle[id][vMods][5] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_6", temp, sizeof temp);
        Vehicle[id][vMods][6] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_7", temp, sizeof temp);
        Vehicle[id][vMods][7] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_8", temp, sizeof temp);
        Vehicle[id][vMods][8] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_9", temp, sizeof temp);
        Vehicle[id][vMods][9] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_10", temp, sizeof temp);
        Vehicle[id][vMods][10] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_11", temp, sizeof temp);
        Vehicle[id][vMods][11] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_12", temp, sizeof temp);
        Vehicle[id][vMods][12] = strval(temp);
       
        db_get_field_assoc(Result, "mod_slot_13", temp, sizeof temp);
        Vehicle[id][vMods][13] = strval(temp);
       
        db_get_field_assoc(Result, "fuel", temp, sizeof temp);
        Vehicle[id][vFuel] = strval(temp);
       
        Vehicle[id][vVID] = CreateVehicle(Vehicle[id][vModel], Vehicle[id][vPos][0], Vehicle[id][vPos][1], Vehicle[id][vPos][2], Vehicle[id][vPos][3], Vehicle[id][vColour][0], Vehicle[id][vColour][1], -1);
    }
   
    db_free_result(Result);
    return 1;
}



Re: SQLite last_insert_rowid() tag mismatch - Ihateyou - 30.07.2014

can u do something like LoadVehicle(_:Result);

i dont know how sqlite works


Re: SQLite last_insert_rowid() tag mismatch - arko123 - 30.07.2014

Quote:
Originally Posted by Ihateyou
Посмотреть сообщение
can u do something like LoadVehicle(_:Result);

i dont know how sqlite works
What would that achieve? Also thanks for the suggestions so far, it seems like no one uses SQLite haha.


Re: SQLite last_insert_rowid() tag mismatch - Ihateyou - 30.07.2014

that should get rid of the error... try it


Re: SQLite last_insert_rowid() tag mismatch - arko123 - 30.07.2014

Quote:
Originally Posted by Ihateyou
Посмотреть сообщение
that should get rid of the error... try it
Nope still points to the same line and the same tag-mismatch, thanks anyways.