Problemwith mysql![error 075: input line too long ]
#1

Hello dear samp members.

I have another prob with mysql..


CODE:
pawn Код:
stock mySQL_init()
{
    mysql_debug(1);
    g_Handle = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
    /* Table Structure - kind of messy, I know. */
    mysql_function_query(g_Handle, "CREATE TABLE IF NOT EXISTS `Accounts` ( \
    `id` int(11) NOT NULL AUTO_INCREMENT, \
    `name` varchar(24) NOT NULL, \
    `pass` varchar(129) NOT NULL, \
    `salt` varchar(30) NOT NULL, \
    `health` float NOT NULL, \
    `X` float NOT NULL, \
    `Y` float NOT NULL, \
    `Z` float NOT NULL, \
    `A` float NOT NULL, \
    `interior` int(2) NOT NULL, \
    `vw` int(11) NOT NULL, \
    `skin` int(3) NOT NULL, \
    `Respect` int(3) NOT NULL, \ // ERROR STARTS FROM HERE!
    `EXP` int(3) NOT NULL, \
    `Level` int(3) NOT NULL, \
    `Admin` int(3) NOT NULL, \
    `VIP` int(3) NOT NULL, \
    `Mapper` int(3) NOT NULL, \
    `Helper` int(3) NOT NULL, \
    PRIMARY KEY (`id`) \
    )"
, false, "SendQuery", "");
    return 1;
}
ERRORS:
pawn Код:
304) : error 075: input line too long (after substitutions)
(305) : error 017: undefined symbol "mysql_function_query"
(305) : error 017: undefined symbol "CREATE"
(305) : error 017: undefined symbol "TABLE"
(305) : fatal error 107: too many error messages on one line
Thank you for your time..

With best regards Scrillex!
Reply
#2

I've got a feeling the query might be too long, try and define a string, and format the string.
Reply
#3

What plugin and its version are you using?
Reply
#4

Yeah I think the same... But .... hmmh where can I define a for create tables...

pawn Код:
stock LoadAccount(playerid)
{
    new query[128];
    format(query, sizeof(query), "SELECT * FROM `Accounts` WHERE `id` = %d", g_PlayerInfo[playerid][pSQLid]);
    mysql_function_query(g_Handle, query, true, "OnAccountLoad", "d", playerid);
}
stock CreateAccount(playerid, salt[], pass[129])
{
    new query[240];
    format(query, sizeof(query), "INSERT INTO `Accounts` (name, salt, pass) VALUES (\'%s\', \'%s\', \'%s\')",
    returnName(playerid), salt, pass);
    mysql_function_query(g_Handle, query, false, "OnAccountCreate", "d", playerid);
}

stock SaveAccount(playerid)
{
    new
    query[322],
    Float:pos[4],
    Float:health;
    GetPlayerPos(playerid, posArr{pos});
    GetPlayerFacingAngle(playerid, pos[3]);
    GetPlayerHealth(playerid, health);
    format(query, sizeof(query), "UPDATE `Accounts` SET health = %.1f, X = %.2f, Y = %.2f, Z = %.2f, A = %.2f, interior = %d, vw = %d, skin = %d,Respect = %d, EXP = %d, Level = %d, Admin = %d, VIP = %d, Mapper = %d, Helper = %d WHERE `id` = %d",
    health, posArrEx{pos},GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid),
    GetPlayerSkin(playerid), g_PlayerInfo[playerid][pSQLid]);
    mysql_function_query(g_Handle, query, false, "SendQuery", "");
    return 1;
}
And it ain't a prob with plugin it is about string size.. thats why all the rest errors are showing up
Reply
#5

https://sampwiki.blast.hk/wiki/Strcat
Reply
#6

Why not create the table manually and if you plan to release the script export the structure?
Reply
#7

Errors:
pawn Код:
(300) : error 037: invalid string (possibly non-terminated string)
(300) : error 017: undefined symbol "mysql_function_query"
(300) : error 017: undefined symbol "TABLE"
(300) : fatal error 107: too many error messages on one line
Lines
pawn Код:
stock mySQL_init()
{
    mysql_debug(1);
    new Query [512];
    g_Handle = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
    /* Table Structure - kind of messy, I know. */
    strcat(Query, "mysql_function_query(g_Handle, CREATE TABLE IF NOT EXISTS `Accounts` ( \
    `id` int(11) NOT NULL AUTO_INCREMENT, \
    `name` varchar(24) NOT NULL, \
    `pass` varchar(129) NOT NULL, \
    `salt` varchar(30) NOT NULL, \
    `health` float NOT NULL, \
    `X` float NOT NULL, \
    `Y` float NOT NULL, \
    `Z` float NOT NULL, \
    `A` float NOT NULL, \
    `interior` int(2) NOT NULL, \
    `vw` int(11) NOT NULL, \");
    strcat(Query, "
`skin` int(3) NOT NULL, \
    `Respect` int(3) NOT NULL, \
    `EXP` int(3) NOT NULL, \
    `Level` int(3) NOT NULL, \
    `Admin` int(3) NOT NULL, \
    `VIP` int(3) NOT NULL, \
    `Mapper` int(3) NOT NULL, \
    `Helper` int(3) NOT NULL, \
    PRIMARY KEY (`id`) \
    )", false, "SendQuery", "");
    return 1;
}
It would be double work.. That's why I want to make it automatically.
Reply
#8

Something like
pawn Код:
new String[ calcolate the size of the query];
strcat(String,"CREATE TABLE IF NOT EXISTS `Accounts` (");
strcat(String,"`id` int(11) NOT NULL AUTO_INCREMENT,");
strcat(String,"`name` varchar(24) NOT NULL,");
strcat(String,"`pass` varchar(129) NOT NULL,");
strcat(String,"`salt` varchar(30) NOT NULL,");
strcat(String,"`health` float NOT NULL,");
strcat(String,"`X` float NOT NULL,");
strcat(String,"`Y` float NOT NULL,");
strcat(String,"`Z` float NOT NULL,");
strcat(String,"`A` float NOT NULL,");
strcat(String,"`interior` int(2) NOT NULL,");
strcat(String,"`vw` int(11) NOT NULL,");
strcat(String,"`skin` int(3) NOT NULL,");
strcat(String,"`Respect` int(3) NOT NULL,");
strcat(String,"`EXP` int(3) NOT NULL,");
strcat(String,"`Level` int(3) NOT NULL,");
strcat(String,"`Admin` int(3) NOT NULL,");
strcat(String,"`VIP` int(3) NOT NULL,");
strcat(String,"`Mapper` int(3) NOT NULL,");
strcat(String,"`Helper` int(3) NOT NULL,");
strcat(String,"PRIMARY KEY (`id`) )");
Then use mysql_function_query for String
Reply
#9

That string is 730 chars long!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)