Ucitavanje baze

Započeo Dobrica, April 14, 2020, 17:22:48 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): Dobar dan svima, imam problem prilikom kreiranja baze. Tacnije odradio sam kada se pokrene server, i ako je povezan tek ce onda kreirati tablice. Medjutim izbacuje mi u mysql logu erore, koje ne mogu da shvatim u cemu je problem.
Dio skripte:
stock mysql_loading()
{
	new MySQLOpt: option_id = mysql_init_options();
	mysql_set_option(option_id, AUTO_RECONNECT, true);

	conectionBase = mysql_connect(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD, MYSQL_DATABASE, option_id);
	if(conectionBase == MYSQL_INVALID_HANDLE || mysql_errno(conectionBase) != 0)
	{
		printf("[MySQL] (Database) Fatal Error: Could not connect to MySQL >>> (Host: %s - DB: %s - User: %s).", MYSQL_HOSTNAME, MYSQL_DATABASE, MYSQL_USERNAME);
		print("[MySQL] (Database) Note: Make sure that you have provided the correct connection credentials.");
		printf("[MySQL] (Database) Error number: %d", mysql_errno(conectionBase));
		SendRconCommand("exit");
	}
	else
 	{
		print("[MySQL] (Database) Connection successful toward MySQL Database Server!");
        printf("[MySQL] (Database) Connected to MySQL >>> (Host: %s - DB: %s - User: %s).", MYSQL_HOSTNAME, MYSQL_DATABASE, MYSQL_USERNAME);
        print("[MySQL] (Database) Users table has been loaded!");

  		new string[1024];
		string = "CREATE TABLE ifNOT EXISTS `users`(\
		`id` INT, \
		`name` VARCHAR(24), \
		`ip` VARCHAR(18), \
		`longip` INT, \
		`password` VARCHAR(64), \
		`salt` VARCHAR(64), \
		`sec_question` VARCHAR("#MAX_SECURITY_QUESTION_SIZE"), \
		`posx` FLOAT(24) NOT NULL DEFAULT '1633.2408', \
		`posz` FLOAT(24) NOT NULL DEFAULT '-2326.1482', \
		`posy` FLOAT(24) NOT NULL DEFAULT '13.5469', \
		`sec_answer` VARCHAR(64), ";
		strcat(string, "`register_timestamp` INT, \
		`lastlogin_timestamp` INT, \
		`kills` INT, \
		`deaths` INT, \
		`score` INT, \
		`money` INT, \
		`adminlevel` INT, \
		`viplevel` INT, \
		`afk` INT, \
		PRIMARY KEY(`id`))");
		mysql_tquery(conectionBase, string);

		mysql_tquery(conectionBase, "CREATE TABLE ifNOT EXISTS `temp_blocked_users` (\
		`ip` VARCHAR(18), \
		`lock_timestamp` INT, \
		`user_id` INT)");
		mysql_tquery(conectionBase, string);
 	}
}

Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log):
[17:18:45] [plugins/mysql] error #1064 while executing query "CREATE TABLE ifNOT EXISTS `users`(`id` INT, `name` VARCHAR(24), `ip` VARCHAR(18), `longip` INT, `password` VARCHAR(64), `salt` VARCHAR(64), `sec_question` VARCHAR(128), `posx` FLOAT(24) NOT NULL DEFAULT '1633.2408', `posz` FLOAT(24) NOT NULL DEFAULT '-2326.1482', `posy` FLOAT(24) NOT NULL DEFAULT '13.5469', `sec_answer` VARCHAR(64), `register_timestamp` INT, `lastlogin_timestamp` INT, `kills` INT, `deaths` INT, `score` INT, `money` INT, `adminlevel` INT, `viplevel` INT, `afk` INT, PRIMARY KEY(`id`))": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXISTS `users`(`id` INT, `name` VARCHAR(24), `ip` VARCHAR(18), `longip` INT, `pa' at line 1
[17:18:45] [plugins/mysql] error #1064 while executing query "CREATE TABLE ifNOT EXISTS `temp_blocked_users` (`ip` VARCHAR(18), `lock_timestamp` INT, `user_id` INT)": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXISTS `temp_blocked_users` (`ip` VARCHAR(18), `lock_timestamp` INT, `user_id` I' at line 1
[17:18:45] [plugins/mysql] error #1064 while executing query "CREATE TABLE ifNOT EXISTS `users`(`id` INT, `name` VARCHAR(24), `ip` VARCHAR(18), `longip` INT, `password` VARCHAR(64), `salt` VARCHAR(64), `sec_question` VARCHAR(128), `posx` FLOAT(24) NOT NULL DEFAULT '1633.2408', `posz` FLOAT(24) NOT NULL DEFAULT '-2326.1482', `posy` FLOAT(24) NOT NULL DEFAULT '13.5469', `sec_answer` VARCHAR(64), `register_timestamp` INT, `lastlogin_timestamp` INT, `kills` INT, `deaths` INT, `score` INT, `money` INT, `adminlevel` INT, `viplevel` INT, `afk` INT, PRIMARY KEY(`id`))": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXISTS `users`(`id` INT, `name` VARCHAR(24), `ip` VARCHAR(18), `longip` INT, `pa' at line 1

Slika/video ingame problema(obavezno ako je ingame problem):

Reseno, moze lock.
Napravio sam gresku jer sam IF not spojio.