SQLite problem
#1

Hey all! I added some code into Execute SQL in my SQLite database browser so I can created a new table. But the problem is that my browser freezes and I can't do anything. This is part of the code:
Код:
CREATE TABLE users(
Name TEXT,
			 Gender INTEGER,
			 PayCheck INTEGER,
			 Hours INTEGER,
			 Age INTEGER,
			 Cash INTEGER,
			 Coupon INTEGER,
			 Bank INTEGER,
			 Checks INTEGER,
			 Skin INTEGER,
			 AdminLevel INTEGER,
			 Banned INTEGER,
			 Phnumber INTEGER,
			 PCredit INTEGER,
			 X FLOAT,
			 Y FLOAT,
			 Z FLOAT,
			 Int INTEGER,
			 VW INTEGER,
			 WalkStyle INTEGER,
			 Fac INTEGER,
			 FacRank INTEGER,
			 wSlot0 INTEGER,
			 wSlot1 INTEGER,
			 wSlot2 INTEGER,
			 wSlot3 INTEGER,
			 wSlot4 INTEGER,
			 wSlot5 INTEGER,
			 wSlot6 INTEGER,
			 wSlot7 INTEGER,
			 wSlot8 INTEGER,
			 wSlot9 INTEGER,
			 wSlot10 INTEGER,
			 wSlot11 INTEGER,
			 wSlot12 INTEGER,
			 Hospital INTEGER,
			 Business INTEGER,
			 House INTEGER,
			 wtSlot1 INTEGER,
			 wtSlot2 INTEGER,
			 HouseOwner INTEGER);
// 281 fields
This fields are all from my pInfo enum which contains all user stats. I want to create a table with 281 fields. Does anyone know why does SQLite browser freeze and there isn't any error?
Reply
#2

The code above was executed fine on the Browser. If you got any errors in the SQL syntax, then it'd either say what's wrong or not respond.
Reply
#3

well I divided 281 fields by 70 and I tried to create table for each 70 fields. I got no errors. But when I try to create it with 281 of them, my browser freezes and it doesn't do anything. It's so weird...
Reply
#4

Try writing it directly into your script using strlib specifically strimplode function to create large queries and since it's done programmatically you could just delete your table and reload your server to debug any problems.

http://forum.sa-mp.com/showthread.ph...t=slice+string

Ex.

pawn Код:
// Create query
    strimplode(" ",
        q,
        sizeof(q),
        "CREATE TABLE IF NOT EXISTS `GangHouses`",
        "(IndexID INTEGER,",
        "GangSpawnEnabled INTEGER,",
        "GangID INTEGER,",
        "GangVW INTEGER,",
        "GangInterior INTEGER,",
        "TeleportFreeze INTEGER,",
        "EnterSize REAL,",
        "ExitSize REAL,",
        "EnterFA REAL,",
        "ExitFA REAL,",
        "GangAreaEnterX REAL,",
        "GangAreaEnterY REAL,",
        "GangAreaEnterZ REAL,",
        "GangAreaExitX REAL,",
        "GangAreaExitY REAL,",
        "GangAreaExitZ REAL,",
        "GangTeleEnterX REAL,",
        "GangTeleEnterY REAL,",
        "GangTeleEnterZ REAL,",
        "GangTeleExitX REAL,",
        "GangTeleExitY REAL,",
        "GangTeleExitZ REAL);"
    );
Reply
#5

I did what you say, and when I try to create new variable query, my compiler crashes :S Do you know why?
pawn Код:
new query[266];
    UserDatabase = db_open("Users.db");
    strimplode(" ",
        query,
        sizeof(query),
        "CREATE TABLE IF NOT EXISTS `users`",
            "(Name TEXT,",
             "Gender INTEGER,",
             "PayCheck INTEGER,",
             "Hours INTEGER,",
             "Age INTEGER,",
             "Cash INTEGER,",
// and so on with fields
I wish I can just create this inside SQLite browser, because this is killing me :/ I will never be able to switch to SQL just because of so many stupid indexes from my enum.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)