[MySQL] BlueG - undefined symbol mysql_query
#1

Hello Community.
Can someone tell me why i get undefined symbol mysql_query ?

Script:
pawn Code:
#include <a_samp>
#include <a_mysql>

//==============
//== Defines ==
#define SERVER_CREATOR  "d,"
#define SERVER_VERSION  "0.01"
#define SERVER_CONFIG   "Server/System/Config.ini"
#define SERVER_LOG_PATH "Server/Benutzers/%s.ini"

#define MYSQL_HOST      "host"
#define MYSQL_USER      "user"
#define MYSQL_PASS      "pw"
#define MYSQL_DATA      "db"
#define DIALOG_LOGIN    1
#define DIALOG_REGISTER 2
#define DIALOG_INFO     3

enum SpielerDaten
{
    ID,
    IP[20],
    Passwort[20],
    Geld,
    Admin,
    Banned,
    VIP,
    Kills,
    Deaths,
    Warns,
    Muted,
};

new pInfo[MAX_PLAYERS][SpielerDaten];
new bool:Login[MAX_PLAYERS] = false;
new OnlineCounter = 0;

//===============
//== Forwards ==

forward SaveAccount(playerid);
public SaveAccount(playerid)
{
    new name[MAX_PLAYER_NAME], Query[500];
    GetPlayerName(playerid, name, sizeof name);
    new realname[MAX_PLAYER_NAME];
    mysql_real_escape_string(name,realname);
    format(Query, sizeof Query, "SELECT * FROM `Users` WHERE Nick = '%s'", realname);
    mysql_store_result();
    if(mysql_num_rows())
    {
        if(Login[playerid] == true)
        {
            new pip[25];
            GetPlayerIp(playerid,pip, sizeof pip);
            format(Query, sizeof Query, "UPDATE `Users` SET ґIPґ = '%s' WHERE Nick = '%s'",pip,realname);
            mysql_query("");
        }
    }
    return 1;
}

forward LoadAccount(playerid);
public LoadAccount(playerid)
{
    //
    return 1;
}

main()
{
    print("GameMode wird geladen . . .");
    printf("GameMode wurde von %s ersteltt.",SERVER_CREATOR);
    printf("Version: %s",SERVER_VERSION);
}

public OnGameModeInit()
{
    mysql_debug(1);
    mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_DATA,MYSQL_PASS);
    SetGameModeText("8");
    return 1;
}

public OnGameModeExit()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        {
            pInfo[i][ID] = 0;
            pInfo[i][Passwort] = 0;
            pInfo[i][Geld] = 0;
            pInfo[i][Admin] = 0;
            pInfo[i][Banned] = 0;
            pInfo[i][VIP] = 0;
            pInfo[i][Kills] = 0;
            pInfo[i][Deaths] = 0;
            pInfo[i][Warns] = 0;
            pInfo[i][Muted] = 0;
            OnlineCounter--;
            SaveAccount(i);
            Login[i] = false;
        }
    }
    mysql_close();
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(!IsPlayerNPC(playerid)) { OnlineCounter++; }
        else return Kick(playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    Login[playerid] = false;
    OnlineCounter--;
    if(!IsPlayerNPC(playerid))
    {
        pInfo[playerid][ID] = 0;
        pInfo[playerid][Passwort] = 0;
        pInfo[playerid][Geld] = 0;
        pInfo[playerid][Admin] = 0;
        pInfo[playerid][Banned] = 0;
        pInfo[playerid][VIP] = 0;
        pInfo[playerid][Kills] = 0;
        pInfo[playerid][Deaths] = 0;
        pInfo[playerid][Warns] = 0;
        pInfo[playerid][Muted] = 0;
        SaveAccount(playerid);
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
a_mysql inc:
pawn Code:
/**
 * MySQL plugin R7
 * Copyright © 2008-2011, BlueG
 */


#if defined mysql_included
    #endinput
#endif
#define mysql_included

/**
 * Common error codes
 *
 * Client: http://dev.mysql.com/doc/refman/5.0/en/e...lient.html
 * Server: http://dev.mysql.com/doc/refman/5.0/en/e...erver.html
 *
 */


#define ER_DBACCESS_DENIED_ERROR 1044
#define ER_ACCESS_DENIED_ERROR 1045
#define ER_UNKNOWN_TABLE 1109
#define ER_SYNTAX_ERROR 1149
#define CR_SERVER_GONE_ERROR 2006
#define CR_SERVER_LOST 2013
#define CR_COMMAND_OUT_OF_SYNC 2014
#define CR_SERVER_LOST_EXTENDED 2055

// Native functions

#define mysql_fetch_row(%1) mysql_fetch_row_format(%1,"|")
#define mysql_next_row() mysql_retrieve_row()
#define mysql_get_field(%1,%2) mysql_fetch_field_row(%2,%1)

#define mysql_query_callback(%1,%2,%3,%4,%5) \
    mysql_function_query(%5, %2, false, %3, "siii", %2, %1, %4, %5)

#define mysql_query(%1,%2,%3,%4) \
    mysql_function_query(%4, %1, false, "OnQueryFinish", "siii", %1, %2, %3, %4)


native mysql_affected_rows(connectionHandle = 1);
native mysql_close(connectionHandle = 1);
native mysql_connect(const host[], const user[], const database[], const password[], port = 3306);
native mysql_data_seek(offset, connectionHandle = 1);
native mysql_debug(enable = 1);
native mysql_errno(connectionHandle = 1);
native mysql_fetch_field(number, dest[], connectionHandle = 1);
native mysql_fetch_field_row(string[], const fieldname[], connectionHandle = 1);
native mysql_fetch_row_format(string[], const delimiter[] = "|", connectionHandle = 1);
native mysql_format(connectionHandle, output[], format[], {Float,_}:...);
native mysql_field_count(connectionHandle = 1);
native mysql_free_result(connectionHandle = 1);
native mysql_get_charset(destination[], connectionHandle = 1);
native mysql_insert_id(connectionHandle = 1);
native mysql_num_rows(connectionHandle = 1);
native mysql_num_fields(connectionHandle = 1);
native mysql_ping(connectionHandle = 1);
native mysql_real_escape_string(const source[], destination[], connectionHandle = 1);
native mysql_reconnect(connectionHandle = 1);
native mysql_reload(connectionHandle = 1);
native mysql_retrieve_row(connectionHandle = 1);
native mysql_set_charset(charset[], connectionHandle = 1);
native mysql_stat(const destination[], connectionHandle = 1);
native mysql_store_result(connectionHandle = 1);
native mysql_warning_count(connectionHandle = 1);

// Cache functions

native mysql_function_query(connectionHandle, query[], bool:cache, callback[], format[], {Float,_}:...);
native cache_get_row(row, idx, dest[], connectionHandle = 1);
native cache_get_field(field_index, dest[], connectionHandle = 1);
native cache_get_data(&num_rows, &num_fields, connectionHandle = 1);
native cache_get_field_content(row, const field_name[], dest[], connectionHandle = 1);
native enable_mutex(bool:enable);

// forward declarations

forward OnQueryError(errorid, error[], callback[], query[], connectionHandle);
hope anyone can help me o.O
Reply
#2

Cause this is the new format of mysql_query:
pawn Code:
#define mysql_query(%1,%2,%3,%4) \
    mysql_function_query(%4, %1, false, "OnQueryFinish", "siii", %1, %2, %3, %4)
And you are using the old format of mysql_query.
Reply
#3

Quote:
Originally Posted by Joey^
View Post
Cause this is the new format of mysql_query:
pawn Code:
#define mysql_query(%1,%2,%3,%4) \
    mysql_function_query(%4, %1, false, "OnQueryFinish", "siii", %1, %2, %3, %4)
And you are using the old format of mysql_query.
no same errors -.- any help ? or can anyone paste the new inc here ?
Reply
#4

Converting from R6-2 or earlier to R7 takes time, especially if you didn't use threaded queries before already. For that definition (that Joey^ posted) to work, you must fill in all four paramters in your old mysql_query function. The new query function is called mysql_function_query which automatically threads all queries.
Reply
#5

I had same problems when i was converting to R7 plugin.
Im using mysql_query like this:
pawn Code:
mysql_query(Query, THREAD_SAVEHOUSE);
And i needed to change the macro to this:
pawn Code:
#define mysql_query(%1,%2) \
    mysql_function_query(gConnectionhandle, %1, false, "OnQueryFinish", "siii", %1, %2, -1, 1)
Reply
#6

so i can use mysql_function_query("SELECT * FROM *");

or how ?

anyone ?
Reply
#7

sry for bumb but anyone can help me ? i really need it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)