SA-MP Forums Archive
SQLite long query - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQLite long query (/showthread.php?tid=587018)



SQLite long query - Matz - 27.08.2015

Recently interested in SQLite but I couldn't figure out this table is not being created, any idea why?

Код:
new string2[1500];
    strcat(string2, "CREATE TABLE IF NOT EXISTS teams (teamid INTEGER PRIMARY KEY AUTOINCREMENT,");
	strcat(string2, "teamname VARCHAR(24) COLLATE NOCASE,");
	strcat(string2, "colour INTEGER DEFAULT 0 NOT NULL,");

	strcat(string2, "skin1 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin2 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin3 INTEGER DEFAULT 0 NOT NULL,");

	strcat(string2, "skin1weap1 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin1weap2 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin1weap3 INTEGER DEFAULT 0 NOT NULL,");

	strcat(string2, "skin2weap1 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin2weap2 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin2weap3 INTEGER DEFAULT 0 NOT NULL,");

	strcat(string2, "skin3weap1 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin3weap2 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin3weap3 INTEGER DEFAULT 0 NOT NULL,");

	strcat(string2, "skin1ammo1 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin1ammo2 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin1ammo3 INTEGER DEFAULT 0 NOT NULL,");

	strcat(string2, "skin2ammo1 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin2ammo2 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin2ammo3 INTEGER DEFAULT 0 NOT NULL,");

	strcat(string2, "skin3ammo1 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin3ammo2 INTEGER DEFAULT 0 NOT NULL,");
	strcat(string2, "skin3ammo3 INTEGER DEFAULT 0 NOT NULL)");

	strcat(string2, "spawn1X FLOAT DEFAULT 0.0,");
	strcat(string2, "spawn1Y FLOAT DEFAULT 0.0,");
	strcat(string2, "spawn1Z FLOAT DEFAULT 0.0,");
	strcat(string2, "spawn2R FLOAT DEFAULT 0.0,");

	strcat(string2, "spawn2X FLOAT DEFAULT 0.0,");
	strcat(string2, "spawn2Y FLOAT DEFAULT 0.0,");
	strcat(string2, "spawn2Z FLOAT DEFAULT 0.0,");
	strcat(string2, "spawn2R FLOAT DEFAULT 0.0,");

	strcat(string2, "spawn3X FLOAT DEFAULT 0.0,");
	strcat(string2, "spawn3Y FLOAT DEFAULT 0.0,");
	strcat(string2, "spawn3Z FLOAT DEFAULT 0.0,");
	strcat(string2, "spawn3R FLOAT DEFAULT 0.0)");
	
	db_query(Database, string2);



Re: SQLite long query - xVIP3Rx - 27.08.2015

enable "dbquerry"ing and check the server log for errors.


Re: SQLite long query - Matz - 27.08.2015

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
enable "dbquerry"ing and check the server log for errors.
I don't know neither what do you mean nor how to do


Re: SQLite long query - xVIP3Rx - 27.08.2015

Add this in server.cfg
Код:
db_log_queries 1
db_logging 1
This will log all the queries to server log, post it.


Re: SQLite long query - Matess - 27.08.2015

strcat(string2, "skin3ammo3 INTEGER DEFAULT 0 NOT NULL)");

strcat(string2, "spawn1X FLOAT DEFAULT 0.0,");



Re: SQLite long query - Matz - 27.08.2015

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
Add this in server.cfg
Код:
db_log_queries 1
db_logging 1
This will log all the queries to server log, post it.
I see it ends somewhere early and a duplicated one exists so:

Quote:
Originally Posted by Matess
Посмотреть сообщение
strcat(string2, "skin3ammo3 INTEGER DEFAULT 0 NOT NULL)");

strcat(string2, "spawn1X FLOAT DEFAULT 0.0,");
Yes, working.

Cheers both xVIP3Rx and Matess