Auto create tables(?) MySQL R38
#1

It was actually(?) like this in the older versions
pawn Код:
mysql_query(gQuery,
                                "CREATE TABLE IF NOT EXISTS `"Users_Table"` ("\
                                "`AccountID` int(10) NOT NULL AUTO_INCREMENT,"\
                                "`UserName` varchar(25) NOT NULL,"\
                                "`Password` varchar(129) NOT NULL,"\
                                "`IP` varchar(16) NULL,"\
                                "`Score` int(15) NULL,"\
                                "`Money` int(15) NULL,"\
                                "`Kills` int(15) NULL,"\
                                "`Deaths` int(15) NULL,"\
                                "`Level` int(15) NULL,"\
                                "PRIMARY KEY (`AccountID`)"\
                                ") ENGINE=InnoDB DEFAULT CHARSET=latin1;");
But, I don't know how it works on MySQL R38 version. Would be great if someone could help me a bit,
Thanks.
Reply
#2

Should work. The query system hasn't changed, the SQL language too.
Reply
#3

pawn Код:
mysql_format(MySQL, gQuery,
                                "CREATE TABLE IF NOT EXISTS `"Users_Table"` ("\
                                "`AccountID` int(10) NOT NULL AUTO_INCREMENT,"\
                                "`UserName` varchar(25) NOT NULL,"\
                                "`Password` varchar(129) NOT NULL,"\
                                "`IP` varchar(16) NULL,"\
                                "`Score` int(15) NULL,"\
                                "`Money` int(15) NULL,"\
                                "`Kills` int(15) NULL,"\
                                "`Deaths` int(15) NULL,"\
                                "`Level` int(15) NULL,"\
                                "PRIMARY KEY (`AccountID`)"\
                                ") ENGINE=InnoDB DEFAULT CHARSET=latin1;");
    mysql_tquery(MySQL, gQuery, "", "");
I'm using it like this now, is that wrong? ;o
And, I'm getting these errors:
Код:
C:\Users\Matt\Desktop\MP-Related\SAMP 0.3z Server Package\filterscripts\BAdmin.pwn(111 -- 123) : error 035: argument type mismatch (argument 3)
Reply
#4

EDIT: Sorry for the double post, problems with my internet...
Reply
#5

pawn Код:
...`"Users_Table"`...
to:
pawn Код:
...`Users_Table`...
Reply
#6

Nothing changed, it's still the same...
pawn Код:
C:\Users\Matt\Desktop\MP-Related\SAMP 0.3z Server Package\filterscripts\BAdmin.pwn(111 -- 123) : error 035: argument type mismatch (argument 3)
Reply
#7

I'm pretty sure there needs to be a cache true/false in -

pawn Код:
mysql_tquery(MySQL, gQuery, "", "");
Reply
#8

pawn Код:
native mysql_tquery(connectionHandle, query[], callback[] = "", format[] = "", {Float,_}:...);
Anyways, I tried to use it like
pawn Код:
mysql_tquery(MySQL, gQuery, true, "", "");
and i got the same error (argument type mismatch (argument 3))
Reply
#9

pawn Код:
mysql_format(MySQL, gQuery,
                                "CREATE TABLE IF NOT EXISTS `Users_Table` (\
                                `AccountID` int(10) NOT NULL AUTO_INCREMENT,\
                                `UserName` varchar(25) NOT NULL,\
                                `Password` varchar(129) NOT NULL,\
                                `IP` varchar(16) NULL,\
                                `Score` int(15) NULL,\
                                `Money` int(15) NULL,\
                                `Kills` int(15) NULL,\
                                `Deaths` int(15) NULL,\
                                `Level` int(15) NULL,\
                                PRIMARY KEY (`AccountID`)"
) ENGINE=InnoDB DEFAULT CHARSET=latin1);
    mysql_tquery(MySQL, gQuery, "", "");
There might be some syntax error at the last line. Try to fix it, if something come's up.
Reply
#10

No need to use format for that. The mistake was that the 1st argument of the mysql_query function must be the connection handle in R38 but you used an array "gQuery". So change it to:
pawn Код:
mysql_query(MySQL, "... QUERY_HERE ...");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)