#1

Hey

I'm wondering what works best, good old files or (My)SQL.

I'm currently saving a lot of data in files using dini, namely:
all pickup locations,
all business locations,
all house locations,
all team data (ranks, etc)
all player data

Now, I suppose SQL is faster or something.
I want to convert my gamemode to SQL, but I don't know how SQL works at all.

So will it be worth it? And how do I set it up on Linux (I'm using ServerFFS)?
Reply
#2

If you're going to store many data, definetaly - MySQL.
Reply
#3

Well, I downloaded a MySQL plugin, gonna take a look at it tomorrow.
Gonna take me a while to understand things like this:

pawn Код:
format(query,sizeof(query),"SELECT * FROM `"TABLENAME"` WHERE Username = '%s' AND Password = md5('%s') LIMIT 1",pName,pass);
Reply
#4

Quote:
Originally Posted by Vince
Well, I downloaded a MySQL plugin, gonna take a look at it tomorrow.
Gonna take me a while to understand things like this:

pawn Код:
format(query,sizeof(query),"SELECT * FROM `"TABLENAME"` WHERE Username = '%s' AND Password = md5('%s') LIMIT 1",pName,pass);
MySQL takes longer to learn but in the end its worth it. This might help
http://dev.mysql.com/doc/refman/5.0/en/functions.html
Reply
#5

It doesn't take that much to learn, especially with tools like phpmyadmin to help you create the backend with ease. Why does no one suggest sqlite?
Reply
#6

Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
It doesn't take that much to learn, especially with tools like phpmyadmin to help you create the backend with ease. Why does no one suggest sqlite?
Not sure, I never used it so I wouldn't know much.
Reply
#7

Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
It doesn't take that much to learn, especially with tools like phpmyadmin to help you create the backend with ease. Why does no one suggest sqlite?
Dunno about SQLLite, but MySQL has them fancy GUI tools. <3
They probably work with SQLLite anyway though.

But anyway, MySQL is much better than files.
With files, you can only store so much data in them before it takes a long time to read/write from/to them.
MySQL makes it very easy to organize your data.
And it has those perty functions like NOW() and md5()
Reply
#8

Okay, I've started coding MySQL into my GM, but I get a bunch of errors:
pawn Код:
SetupTable()
{
    new data[4096];
    format(data, sizeof(data),"\
    CREATE TABLE IF NOT EXISTS `%s`(\
    `id`            int(11)     NOT NULL auto_increment PRIMARY KEY,\
    `Username`      varchar(30) NOT NULL, `Password` varchar(50) NOT NULL,\
    `Money`         int(10)     NOT NULL default '0',\
    `Registered`  int(10)   NOT NULL default '0',\
    `LoggedIn`   int(10)        NOT NULL default '0',\
    `TutDone`    int(10)        NOT NULL default '0',\
    `Sex`      int(10)      NOT NULL default '0',\
    `Age`      int(10)      NOT NULL default '0',\ // <= line 455
    `Origin`    int(10)     NOT NULL default '0',\
    `Level`     int(10)     NOT NULL default '0',\
    `AdminLevel`  int(10)       NOT NULL default '0',\
    `Skin`     int(10)      NOT NULL default '0',\
    `Team`     int(10)      NOT NULL default '0',\
    `Leader`    int(10)     NOT NULL default '0',\
    `Rank`     int(10)      NOT NULL default '0',\
    `Cash`     int(10)      NOT NULL default '0',\
    `Bank`     int(10)      NOT NULL default '0',\
    `DrivingLic`  int(10)       NOT NULL default '0',\
    `FlyingLic`   int(10)       NOT NULL default '0',\
    `SailingLic`  int(10)       NOT NULL default '0',\
    `GunLic`    int(10)     NOT NULL default '0',\
    `Drugs`     int(10)     NOT NULL default '0',\
    `DrugPacks`   int(10)       NOT NULL default '0',\
    `Mats`     int(10)      NOT NULL default '0',\
    `MatPacks`    int(10)       NOT NULL default '0')\
    "
,TABLENAME);
    mysql_query(data);
    return 1;
}
Код:
D:\Documents and Settings\Vince\Mijn Documenten\SA-MP SERVER\gamemodes\rrp.pwn(455) : error 075: input line too long (after substitutions)
D:\Documents and Settings\Vince\Mijn Documenten\SA-MP SERVER\gamemodes\rrp.pwn(456) : error 037: invalid string (possibly non-terminated string)
D:\Documents and Settings\Vince\Mijn Documenten\SA-MP SERVER\gamemodes\rrp.pwn(456) : error 017: undefined symbol "CREATE"
D:\Documents and Settings\Vince\Mijn Documenten\SA-MP SERVER\gamemodes\rrp.pwn(456) : error 017: undefined symbol "TABLE"
D:\Documents and Settings\Vince\Mijn Documenten\SA-MP SERVER\gamemodes\rrp.pwn(456) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#9

I've got the same error, but i deleted SetupTabled, just created by yourself and don't let samp do it for you.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)