db_query(Database,
"CREATE TABLE IF NOT EXISTS users (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) COLLATE NOCASE, ip VARCHAR(16) COLLATE NOCASE, password VARCHAR(129), score INTEGER DEFAULT 0 NOT NULL, money INTEGER DEFAULT 5000 NOT NULL hours INTEGER DEFAULT 0 NOT NULL, minutes INTEGER DEFAULT 0 NOT NULL, seconds INTEGER DEFAULT 0 NOT NULL, admin INTEGER DEFAULT 0 NOT NULL, vip INTEGER DEFAULT 0 NOT NULL, speedboost INTEGER DEFAULT 1 NOT NULL, cookies INTEGER DEFAULT 0 NOT NULL, mb INTEGER DEFAULT 0 NOT NULL)");
strcat(string, "CREATE TABLE IF NOT EXISTS users ");
strcat(string, " (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) COLLATE NOCASE, ip VARCHAR(16) COLLATE NOCASE, password VARCHAR(129),");
strcat(string, " score INTEGER DEFAULT 0 NOT NULL, money INTEGER DEFAULT 5000 NOT NULL hours INTEGER DEFAULT 0 NOT NULL, minutes INTEGER DEFAULT 0 NOT NULL, seconds INTEGER DEFAULT 0 NOT NULL,");
strcat(string, " admin INTEGER DEFAULT 0 NOT NULL, vip INTEGER DEFAULT 0 NOT NULL, speedboost INTEGER DEFAULT 1 NOT NULL, cookies INTEGER DEFAULT 0 NOT NULL,");
strcat(string, " mb INTEGER DEFAULT 0 NOT NULL)");
db_query(Database, string);
strcat(string, "CREATE TABLE IF NOT EXISTS users ");
strcat(string, " (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) COLLATE NOCASE, ip VARCHAR(16) COLLATE NOCASE, password VARCHAR(129),");
strcat(string, " score INTEGER DEFAULT 0 NOT NULL, money INTEGER DEFAULT 5000 NOT NULL hours INTEGER DEFAULT 0 NOT NULL, minutes INTEGER DEFAULT 0 NOT NULL, seconds INTEGER DEFAULT 0 NOT NULL,");
strcat(string, " admin INTEGER DEFAULT 0 NOT NULL, vip INTEGER DEFAULT 0 NOT NULL, speedboost INTEGER DEFAULT 1 NOT NULL, cookies INTEGER DEFAULT 0 NOT NULL,");
strcat(string, " mb INTEGER DEFAULT 0 NOT NULL)");
db_query(Database, string);
print( string ); // Let's see the output


db_query(Database,
"CREATE TABLE IF NOT EXISTS users (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) \
COLLATE NOCASE, ip VARCHAR(16) COLLATE NOCASE, password VARCHAR(129), score INTEGER DEFAULT 0 NOT NULL,\
money INTEGER DEFAULT 5000 NOT NULL hours INTEGER DEFAULT 0 NOT NULL, minutes INTEGER DEFAULT 0 NOT \
NULL, seconds INTEGER DEFAULT 0 NOT NULL, admin INTEGER DEFAULT 0 NOT NULL, vip INTEGER DEFAULT 0 NOT \
NULL, speedboost INTEGER DEFAULT 1 NOT NULL, cookies INTEGER DEFAULT 0 NOT NULL, mb INTEGER DEFAULT 0 NOT NULL)");
tring's aren't an option sadly lol) but I'm sure there must be something if you want to aim for perfection (*hint*).
|
That strcat thing is a bad suggestion. In order for strcat to work, it must count through every character in the string (every time, starting from 0, even when you know it's gonna be bigger than it was for the last strcat) until it finds the end and then start copying characters from the source to that end position, essentially expanding the string. It's also extra useless since all this data is constant and doesn't need variables at all.
However, since the compiler is apparently hating the long constant string length (which is a pretty annoying compiler trait) I guess I can't suggest any better alternative (std: tring's aren't an option sadly lol) but I'm sure there must be something if you want to aim for perfection (*hint*). |
|
Actually using strcat for that - it IS faster than some other methods which using format which is pretty slow.
|