SQLite Help :)
#1

Okay so I'm new to SQLite and I'm using Norrin's Base SQLite gamemode for practicing, My question is,
pawn Код:
// It's on OnGameModeInit!
        Database = db_open("database.db");
        new string[1024];
    strcat(string, "CREATE TABLE IF NOT EXISTS Accounts(");
    strcat(string, "UserID INTEGER PRIMARY KEY AUTOINCREMENT,");
    strcat(string, "Username VARCHAR(24) COLLATE NOCASE,");
    strcat(string, "Password VARCHAR(128),");
    strcat(string, "IP VARCHAR(16),");
    strcat(string, "Age INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Rod INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Job INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Gender INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Registered INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Member INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Rank INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Leader INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Banned INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "BanReason VARCHAR(64),");
    strcat(string, "BanExpiry INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "JailTime INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "JailReason VARCHAR(64),");
    strcat(string, "NMute INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "RMute INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "AdminLevel INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "SecondaryTask INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Money INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "PositionX FLOAT DEFAULT 0.0,");
    strcat(string, "PositionY FLOAT DEFAULT 0.0,");
    strcat(string, "PositionZ FLOAT DEFAULT 0.0,");
    strcat(string, "FacingAngle FLOAT DEFAULT 0.0,");
    strcat(string, "Interior INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "VirtualWorld INTEGER DEFAULT 0 NOT NULL,");
    strcat(string, "Health FLOAT DEFAULT 0.0,");
    strcat(string, "Armour FLOAT DEFAULT 0.0,");
    strcat(string, "Skin INTEGER DEFAULT 0 NOT NULL)");
    db_query(Database, string);
I'm trying to add new column called "Bait",
Код:
strcat(string, "Bait INTEGER DEFAULT 0 NOT NULL,");
(( Below VirtualWorld ))
But it fails (no "baits" column on SQLite Database Browser).
If I change a column name like "Job" to "Test", it works. Is there any maximum lines in strcat? The strcats are 31 lines.
Reply
#2

Your entire query string is 1018 characters long, and your variable size is 1024, if you add something to that query it will not be able to handle it because you reached variable size. I'm not a SQL guru and by that I mean that I do not know a lot about SQL language but still this looks awful to me, better use BUD include made by Slice, I think it's the best include for saving user stats because it's so damn simple.
Reply
#3

Thanks for replying, +rep, by the way it's fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)