Auto create tables(?) MySQL R38 -
biker122 - 28.05.2014
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.
Re : Auto create tables(?) MySQL R38 -
S4t3K - 28.05.2014
Should work. The query system hasn't changed, the SQL language too.
Re: Auto create tables(?) MySQL R38 -
biker122 - 28.05.2014
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)
Re: Auto create tables(?) MySQL R38 -
biker122 - 28.05.2014
EDIT: Sorry for the double post, problems with my internet...
Re: Auto create tables(?) MySQL R38 -
Riddick94 - 28.05.2014
to:
Re: Auto create tables(?) MySQL R38 -
biker122 - 28.05.2014
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)
Re: Auto create tables(?) MySQL R38 -
RajatPawar - 28.05.2014
I'm pretty sure there needs to be a cache true/false in -
pawn Код:
mysql_tquery(MySQL, gQuery, "", "");
Re: Auto create tables(?) MySQL R38 -
biker122 - 28.05.2014
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))
Re: Auto create tables(?) MySQL R38 -
Riddick94 - 28.05.2014
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.
Re: Auto create tables(?) MySQL R38 -
Konstantinos - 28.05.2014
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 ...");