icedsun

All SQL query limitation....

Recommended Posts

Whenever you use a SQLite command in MTA, it is limited to 512 characters. This means that you cannot do things like create a large table with many columns, because it will give you a "ERROR: Database query failed: Query is too long! (none)"

Here is a function that will trigger the error:

executeSQLCreateTable("worldObjects","type TEXT,owner TEXT,loctype TEXT,xloc REAL,yloc REAL,zloc REAL,xrot REAL,yrot REAL,zrot REAL,interior INT,dimension INT,model INT,health INT,paintjob INT,color1 TEXT,color2 TEXT,color3 TEXT,color4 TEXT,wheelFL INT,wheelRL INT,wheelFR INT,wheelRR INT,door0 INT,door1 INT,door2 INT,door3 INT,door4 INT,door5 INT,lightstoggle INT,light0 INT,light1 INT,light2 INT,light3 INT,pan0 INT,pan1 INT,pan2 INT,pan3 INT,pan4 INT,pan5 INT,pan6 INT,up0 INT,up1 INT,up2 INT,up3 INT,up4 INT,up5 INT,up6 INT,up7 INT,up8 INT,up9 INT,up10 INT,up11 INT,up12 INT,up13 INT,up14 INT,up15 INT,up16 INT,turretx INT,turrety INT,siren INT,landinggear INT,enginetoggle INT,enginedamage INT,frozen INT,locked INT,fueltankexp INT,damageproof INT,fuel INT,stereo INT,alarm INT,visible INT,bombtype INT,numberplate TEXT, size INT, weight INT,storagespace INT,slot1 TEXT,slot2 TEXT,slot3 TEXT,slot4 TEXT,slot5 TEXT,slot6 TEXT,slot7 TEXT,slot8 TEXT,slot9 TEXT,slot10 TEXT,attrib1 TEXT, attrib2 TEXT, attrib3 TEXT, attrib4 TEXT, attrib5 TEXT,attrib6 TEXT, attrib7 TEXT, attrib8 TEXT, attrib9 TEXT, attrib10 TEXT") 

I don't know if it is a limitation of the maximum string size, or maximum length of an SQLite query through MTA, or something else...

Share this post


Link to post

Wow, wouldn't it be easier to design your database with relational tables instead of creating one big bulk of redundant fields?

Share this post


Link to post

That was just an example - the problem of having only around 512 characters per query makes any large operation impossible, regardless of how the database tables are structured.

Share this post


Link to post

  • Recently Browsing   0 members

    No registered users viewing this page.