ORM insert Not working properly
#1

The callback isn't being called
pawn Код:
//under cmd
orm_insert(DynamicDoor[dd][ORM_ddID], "OnDoorCreated", "d", dd);

//callback
public OnDoorCreated(dd)
{
    DynamicDoor[dd][ddID] = cache_insert_id();
    printf("DoorCreated: %d", DynamicDoor[dd][ddID]);
    return 1;
}
Reply
#2

Quote:

[22:27:56] [DEBUG] orm_insert - orm_id: 0, callback: "OnDoorCreated", format: "d"
[22:27:56] [ERROR] "orm_insert" - invalid orm id (id: 0)
[22:27:56] [DEBUG] orm_update - orm_id: 0
[22:27:56] [ERROR] "orm_update" - invalid orm id (id: 0)

Some Logs IDK what to do
Reply
#3

Quote:
Originally Posted by trapstar2020
Посмотреть сообщение
Some Logs IDK what to do
It looks like it doesn't like you using an orm id of 0, I would look at that first, and it might solve some of your other problems.
Reply
#4

I did some reading and it said i should use setkey before using insert but still no luck

Quote:

[23:21:26] [DEBUG] orm_create - table: "dynamicdoors", connectionHandle: 1
[23:21:26] [DEBUG] COrm::Create - creating new orm object..
[23:21:26] [DEBUG] COrm::Create - orm object created (id: 9)
[23:21:26] [DEBUG] orm_addvar_int - orm_id: 9, var: 04258C84, varname: "ID"
[23:21:26] [DEBUG] orm_setkey - orm_id: 9, varname: "ID"
[23:21:26] [DEBUG] orm_insert - orm_id: 9, callback: "OnDoorCreated", format: "d"
[23:21:26] [DEBUG] CMySQLQuery::Execute[OnDoorCreated] - starting query execution
[23:21:26] [ERROR] CMySQLQuery::Execute[OnDoorCreated] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`' at line 1
[23:21:26] [DEBUG] CMySQLQuery::Execute[OnDoorCreated] - error will be triggered in OnQueryError
[23:21:26] [DEBUG] Calling callback "OnQueryError"..

pawn Код:
new ORM:ormid = DynamicDoor[dd][ORM_ddID] = orm_create("dynamicdoors");
         orm_addvar_int(ormid, DynamicDoor[dd][ddID], "ID");
         orm_setkey(ormid, "ID");
         orm_insert(DynamicDoor[dd][ORM_ddID], "OnDoorCreated", "d", dd);
Reply
#5

Post more code bumpity bump bump.
Reply
#6

what else

pawn Код:
YCMD:createdd(playerid, params[], help)
{
     if(PlayerInfo[playerid][pAdmin] < 5) return SCM(playerid, COLOR_RED, "You are unathourized to do this command");
     new ownerid;
     if(sscanf(params, "i", ownerid)) return SCM(playerid, COLOR_GREY, "/createdd [playerid]");
     if(!IsPlayerLoggedIn(ownerid)) return SCM(playerid, COLOR_GREY, "This player is not logged");
     for(new dd = 0; dd < MAX_DDOORS; dd++)
     {
        if(!DynamicDoor[dd][ddCreated])
        {
         new Float:gPos[4], string[200];
         GetPlayerPos(playerid, gPos[0], gPos[1], gPos[2]);
         GetPlayerFacingAngle(playerid, gPos[3]);

         DynamicDoor[dd][ddCreated] = 1;
         
         format(DynamicDoor[dd][ddOwner], 32, "%s", RPNU(ownerid));
         format(DynamicDoor[dd][ddName], 50, "%s Door", RPNU(ownerid));

         new hashpass[129];
         WP_Hash(hashpass,sizeof(hashpass), "123");
         format(DynamicDoor[dd][ddPassword], 12, "%s", hashpass);
         DynamicDoor[dd][ddPasswordSwitch] = 0;

         DynamicDoor[dd][ddEnt][0] = gPos[0];
         DynamicDoor[dd][ddEnt][1] = gPos[1];
         DynamicDoor[dd][ddEnt][2] = gPos[2];
         DynamicDoor[dd][ddEnt][3] = gPos[3];
         DynamicDoor[dd][ddEntVW] = GetPlayerVirtualWorld(playerid);
         DynamicDoor[dd][ddEntInt] = GetPlayerInterior(playerid);

         new ORM:ormid = DynamicDoor[dd][ORM_ddID] = orm_create("dynamicdoors");
         orm_addvar_int(ormid, DynamicDoor[dd][ddID], "ID");
         orm_setkey(ormid, "ID");
         orm_insert(ormid, "OnDoorCreated", "d", dd);

         DynamicDoor[dd][ddEntPickup] =  CreateDynamicPickup(1318, 1, DynamicDoor[dd][ddEnt][0], DynamicDoor[dd][ddEnt][1], DynamicDoor[dd][ddEnt][2], DynamicDoor[dd][ddEntVW], DynamicDoor[dd][ddEntInt], -1, 100.0);
         DynamicDoor[dd][ddExPickup] =  CreateDynamicPickup(1318, 1, DynamicDoor[dd][ddEx][0], DynamicDoor[dd][ddEx][1], DynamicDoor[dd][ddEx][2], DynamicDoor[dd][ddExVW], DynamicDoor[dd][ddExInt], -1, 100.0);


         format(string, sizeof(string), "%d for %s was created", dd, RPNU(ownerid));
         SCM(playerid, COLOR_GREEN, string);
         dd = MAX_DDOORS;
        }
     }
     return 1;
}


public OnDoorCreated(dd)
{
    //DynamicDoor[dd][ddID] = cache_insert_id();
    //printf("DoorCreated: %d", DynamicDoor[dd][ddID]);
    printf("Player %d signed up and their ID value is %d.", dd, DynamicDoor[dd][ddID]);
    return 1;
}
Reply
#7

format(string, sizeof(string), "%d for %s was created", dd, RPNU(ownerid));
are you receiving this message?
Reply
#8

http://pastebin.com/rsC6y5hx [ MYSQL logs from when i start the server ]
Quote:

[08:01:46] [DEBUG] COrm::Create - creating new orm object..
[08:01:46] [DEBUG] COrm::Create - orm object created (id: 9)
[08:01:46] [DEBUG] orm_addvar_int - orm_id: 9, var: 0450428C, varname: "ID"
[08:01:46] [DEBUG] orm_setkey - orm_id: 9, varname: "ID"
[08:01:46] [DEBUG] orm_insert - orm_id: 9, callback: "OnDoorCreated", format: "d"
[08:01:46] [DEBUG] CMySQLQuery::Execute[OnDoorCreated] - starting query execution
[08:01:46] [ERROR] CMySQLQuery::Execute[OnDoorCreated] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`' at line 1
[08:01:46] [DEBUG] CMySQLQuery::Execute[OnDoorCreated] - error will be triggered in OnQueryError
[08:01:46] [DEBUG] Calling callback "OnQueryError"..

This is the only part of ORM i'm struggling with... i don't know what do i'm out of options also ignore the printf in OnDoorCreated i'll change that when i'm ready

http://imgur.com/B02T1xm
Reply
#9

[07:59:32] [ERROR] CMySQLQuery::Execute[OnDoorCreated] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`' at line 1

print off all the parameters of OnQueryError
Reply
#10

Quote:
Originally Posted by cessil
Посмотреть сообщение
[07:59:32] [ERROR] CMySQLQuery::Execute[OnDoorCreated] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`' at line 1

print off all the parameters of OnQueryError
Firstly i would like to thank you for assisting to my problem, it's appreciated a-lot.


I don't understand what you btw, can you noob it up a little please...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)