SA-MP Forums Archive
Convert SQLite to MySQL? - 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: Convert SQLite to MySQL? (/showthread.php?tid=520975)



Convert SQLite to MySQL? - AMouldyLemon - 21.06.2014

Is there a tutorial or reference around?
I've tried googl'ing but can't seem to find anything.

If anyone could help me convert a script, I would appreciate it. Thanks


Re: Convert SQLite to MySQL? - ]Rafaellos[ - 21.06.2014

If you know how to use them, write a quick filterscript that will read the data from the SQLite database and will save them in MySQL.

At least this works for me but I use it for SQLite to SQLite.


Re: Convert SQLite to MySQL? - AMouldyLemon - 21.06.2014

I have a gamemode that is in SQLite, I want to convert it to MySQL. I've done a bit with help from people on the forums.


Re: Convert SQLite to MySQL? - AMouldyLemon - 21.06.2014

Quote:
Originally Posted by ]Rafaellos[
View Post
If you know how to use them, write a quick filterscript that will read the data from the SQLite database and will save them in MySQL.

At least this works for me but I use it for SQLite to SQLite.
What do you mean by that?


Re: Convert SQLite to MySQL? - AMouldyLemon - 21.06.2014

I have this:

pawn Code:
public PlayerCharacterCount(playerid)
{
    new DBResult:qresult, count = 0;
    if(IsPlayerConnected(playerid))
    {
        if(MasterAccount[playerid][mLoggedIn])
        {
            format(query, sizeof(query), "SELECT * FROM `Character` WHERE ( `owner_id` = '%d' )", MasterAccount[playerid][mID]);
            qresult = db_query(database, query);
            count = db_num_rows(qresult);
            db_free_result(qresult);
        }
    }
    return count;
}


I converted it to this:
pawn Code:
forward PlayerCharacterCount(playerid);
public PlayerCharacterCount(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(MasterAccount[playerid][mLoggedIn])
        {
            new query[64];
            format(query, sizeof(query), "SELECT * FROM `PlayerCharacter` WHERE ( `owner_id` = '%d' )", MasterAccount[playerid][mID]);
            mysql_query(1, query);
            cache_get_field_content(0, "", query);
            count = db_num_rows(qresult);
           
            /*qresult = db_query(database, query);
           
            db_free_result(qresult);*/

        }
    }
    return count;
}
it returns these errors:
pawn Code:
MyProject.pwn(700) : error 017: undefined symbol "count"
MyProject.pwn(700) : error 017: undefined symbol "qresult"
If you could possibly convert it, and explain why, I would be very thankful. Thank you.


Re: Convert SQLite to MySQL? - AMouldyLemon - 21.06.2014

Anyone?