More than 2 = No cache active?!
#1

Ok , well tonight i get a stupid bug which one i don't know how to fix it!

Well if is only 2 sbizz in db = no problem in mysql_log , but if i make 3 sbizz in db =

Код:
[21:24:34] [WARNING] cache_get_field_content_int - no active cache
[21:24:34] [WARNING] cache_get_field_content_int - no active cache
[21:24:34] [WARNING] cache_get_field_content_int - no active cache
[21:24:34] [WARNING] cache_get_field_content_int - no active cache
[21:24:34] [WARNING] cache_get_field_content_int - no active cache
[21:24:34] [WARNING] cache_get_field_content_float - no active cache
[21:24:34] [WARNING] cache_get_field_content_float - no active cache
[21:24:34] [WARNING] cache_get_field_content_float - no active cache
[21:24:34] [WARNING] cache_get_field_content - no active cache
[21:24:34] [WARNING] cache_get_field_content - no active cache
Why the fuck ? o-o


There are my code:
pawn Код:
stock IncarcaSBIZZ()
{
    new Cache: Result = mysql_query(SQL, "SELECT * FROM `sBusiness`"), Get[2];
    cache_get_data(Get[0], Get[1], SQL); // Get[0] - Rows || Get[1] - Fields || SQL - connectionHandle
    new IDSB;
    new string[456];
    for(new i = 0; i < Get[0]; i++)
    {
        IDSB = cache_get_field_content_int(i, "ID");
        sBizz[IDSB][sBOwnable] = cache_get_field_content_int(i, "Ownable");
        sBizz[IDSB][sBDeposit] = cache_get_field_content_int(i, "Depozit");
        sBizz[IDSB][sBSettings] = cache_get_field_content_int(i, "Settings");
        sBizz[IDSB][sBPret] = cache_get_field_content_int(i, "Price");
        sBizz[IDSB][sBX] = cache_get_field_content_float(i, "PozitieX", SQL);
        sBizz[IDSB][sBY] = cache_get_field_content_float(i, "PozitieY", SQL);
        sBizz[IDSB][sBZ] = cache_get_field_content_float(i, "PozitieZ", SQL);
        cache_get_field_content(i, "Titlu", sBizz[IDSB][sBTitlu], SQL, 80);
        cache_get_field_content(i, "Detinator", sBizz[IDSB][sBDetinator], SQL, 50);
        CreateDynamicPickup(1239, 1,  sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ], -1, -1, -1, 250.0);
        if(sBizz[IDSB][sBOwnable] == 0)
        {
            format(string, sizeof(string), "{FFCC00}[ %s ]\n\n( Pret de cumparare: {00cc33} %s$ {FFCC00})\n{FFCC00}( Tasteaza {CC0033}/buysbizz{FFCC00} )", sBizz[IDSB][sBTitlu], FormatMoney(sBizz[IDSB][sBPret]));
            sbizz[IDSB] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1,0,-1,-1, 10.5);
        }
        if(sBizz[IDSB][sBOwnable] == 1)
        {
            format(string, sizeof(string), "{FFCC00}[ %s ]\n\n( Detinator: {00cc33} %s {FFCC00})", sBizz[IDSB][sBTitlu], sBizz[IDSB][sBDetinator]);
            sbizz[IDSB] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1,0,-1,-1, 10.5);
        }
        if(sBizz[IDSB][sBOwnable] == 1)
        {
            format(szQuery, 500, "SELECT * FROM `Accounts` WHERE `Name` = '%s' LIMIT 1;", sBizz[IDSB][sBDetinator]);
            new Cache: result2 = mysql_query(SQL, szQuery);
            new Gete[ 2 ];
            cache_get_data(Gete[ 0 ], Gete[ 1 ], SQL);
            if(!Gete[ 0 ])
            {
                sBizz[IDSB][sBOwnable] = 0;
                format(sBizz[IDSB][sBDetinator], 50, "No-One");
            }
            cache_delete(result2);
        }
        sSBizz++;
    }
    GasPrice = sBizz[1][sBSettings] * Rata;
    cache_delete(Result);
    printf("[8.] Am incarcat toate sbizz-urile [%d]",sSBizz);
}
My DB: http://i.imgur.com/sn3iBbw.png


... Any explain ? why is happening ?
Reply
#2

I think because of that line
pawn Код:
new Cache: Result = mysql_query(SQL, "SELECT * FROM `sBusiness`"), Get[2];
Try to declare the cache than make it equal the mysql_query, like this
pawn Код:
new Cache: Result;
Result = mysql_query(SQL, "SELECT * FROM `sBusiness`"), Get[2];
Reply
#3

Is not working .. i still get the bugs..
pawn Код:
[00:00:07] [WARNING] cache_get_field_content_int - no active cache
[00:00:07] [WARNING] cache_get_field_content_int - no active cache
[00:00:07] [WARNING] cache_get_field_content_int - no active cache
[00:00:07] [WARNING] cache_get_field_content_int - no active cache
[00:00:07] [WARNING] cache_get_field_content_int - no active cache
[00:00:07] [WARNING] cache_get_field_content_float - no active cache
[00:00:07] [WARNING] cache_get_field_content_float - no active cache
[00:00:07] [WARNING] cache_get_field_content_float - no active cache
[00:00:07] [WARNING] cache_get_field_content - no active cache
[00:00:07] [WARNING] cache_get_field_content - no active cache
Reply
#4

Why is this an unthreaded query to begin with? It's already in a separate function so I don't see why you can't just thread it?
Reply
#5

You gotta save the current cache in the for loop then run the mysql_query and delete the result. Then set the saved cache active again.

@xVIP3Rx
That changes nothing at all.
Reply
#6

Can somebody fix the code for me .. please? i mean to show an example or something
Reply
#7

Quote:
Originally Posted by Mellnik
Посмотреть сообщение
You gotta save the current cache in the for loop then run the mysql_query and delete the result. Then set the saved cache active again.

@xVIP3Rx
That changes nothing at all.
In some cases it gives me a warning,

Quote:
Originally Posted by Metharon
Посмотреть сообщение
Can somebody fix the code for me .. please? i mean to show an example or something
I think that's how the threaded query should be..
pawn Код:
mysql_tquery(SQL, "SELECT * FROM `sBusiness`", IncarcaSBIZZ);//replace IncarcaSBIZZ() with it, it'll call the stock.
forward IncarcaSBIZZ();
public IncarcaSBIZZ()
{
    new Get[2];
    cache_get_data(Get[0], Get[1], SQL); // Get[0] - Rows || Get[1] - Fields || SQL - connectionHandle
    new IDSB;
    new string[456];
    for(new i = 0; i < Get[0]; i++)
    {
        IDSB = cache_get_field_content_int(i, "ID");
        sBizz[IDSB][sBOwnable] = cache_get_field_content_int(i, "Ownable");
        sBizz[IDSB][sBDeposit] = cache_get_field_content_int(i, "Depozit");
        sBizz[IDSB][sBSettings] = cache_get_field_content_int(i, "Settings");
        sBizz[IDSB][sBPret] = cache_get_field_content_int(i, "Price");
        sBizz[IDSB][sBX] = cache_get_field_content_float(i, "PozitieX", SQL);
        sBizz[IDSB][sBY] = cache_get_field_content_float(i, "PozitieY", SQL);
        sBizz[IDSB][sBZ] = cache_get_field_content_float(i, "PozitieZ", SQL);
        cache_get_field_content(i, "Titlu", sBizz[IDSB][sBTitlu], SQL, 80);
        cache_get_field_content(i, "Detinator", sBizz[IDSB][sBDetinator], SQL, 50);
        CreateDynamicPickup(1239, 1,  sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ], -1, -1, -1, 250.0);
        if(sBizz[IDSB][sBOwnable] == 0)
        {
            format(string, sizeof(string), "{FFCC00}[ %s ]\n\n( Pret de cumparare: {00cc33} %s$ {FFCC00})\n{FFCC00}( Tasteaza {CC0033}/buysbizz{FFCC00} )", sBizz[IDSB][sBTitlu], FormatMoney(sBizz[IDSB][sBPret]));
            sbizz[IDSB] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1,0,-1,-1, 10.5);
        }
        if(sBizz[IDSB][sBOwnable] == 1)
        {
            format(string, sizeof(string), "{FFCC00}[ %s ]\n\n( Detinator: {00cc33} %s {FFCC00})", sBizz[IDSB][sBTitlu], sBizz[IDSB][sBDetinator]);
            sbizz[IDSB] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1,0,-1,-1, 10.5);
        }
        if(sBizz[IDSB][sBOwnable] == 1)
        {
            format(szQuery, 500, "SELECT * FROM `Accounts` WHERE `Name` = '%s' LIMIT 1;", sBizz[IDSB][sBDetinator]);
            new Cache: result2 = mysql_query(SQL, szQuery);
            new Gete[ 2 ];
            cache_get_data(Gete[ 0 ], Gete[ 1 ], SQL);
            if(!Gete[ 0 ])
            {
                sBizz[IDSB][sBOwnable] = 0;
                format(sBizz[IDSB][sBDetinator], 50, "No-One");
            }
            cache_delete(result2);
        }
        sSBizz++;
    }
    GasPrice = sBizz[1][sBSettings] * Rata;
    //cache_delete(Result); Don't think you should delete a cache;
    printf("[8.] Am incarcat toate sbizz-urile [%d]",sSBizz);
}
Reply
#8

Is not working .. for exmaple now is not giving anymore the cache error , but now isn't working

- The printf doesen't come
- The pickup isn't created
- The data isn't loading.
Reply
#9

Did you notice it's a public and not a stock, I've edited that few seconds after posting it;
also put that somewhere around it so you can know if something went wrong.
pawn Код:
public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
{
    switch(errorid)
    {
        case CR_SERVER_GONE_ERROR: printf("Lost connection to server, trying reconnect..."), mysql_reconnect(connectionHandle);
        case ER_SYNTAX_ERROR: printf("Something is wrong in your syntax, query: %s", query);
        default: printf("Errorid:%d|Error:%s|Callback:%s|Query:%s, ", errorid, error, callback, query);
    }
    return 1;
}
Reply
#10

I've been using it ..... but isn't showing any errors.. is kinda weird.. why when they are 2 = work , 3 = not work ?

look other info :

pawn Код:
#define                 MAX_SBIZZ               10
    Text3D:sbizz[MAX_SBIZZ],



enum sBusinessInfo
{
    sBPickup,
    sBTitlu[80],
    Float:sBX,
    Float:sBY,
    Float:sBZ,
    sBPret,
    sBSettings,
    sBOwnable,
    sBDeposit,
    sBDetinator[50]
}
new sBizz[MAX_SBIZZ][sBusinessInfo];

/**
 * MySQL plugin R39
 */
Maybe.. somebody can save me ?.. this and my problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)