Info [url]http://wiki.garrysmod.com/page/sql/Query[/url]
Hello, every1
When I use my dynamic SQL Query generator library, I get the following output.
SQLCreateTable: Table PIECES Dropped !
SQLCreateTable: Indexed Table PIECES Created !
SQLCreateTable: Table BODYGROUPS Dropped !
SQLCreateTable: Table BODYGROUPS failed to create because of false !
As U see here I got 2 tables, the first one creates perfectly, but the second one does not want to as I use the code below I am afraid.
Also it will be good to know many columns I can create in this thing ( ORACLE is 1000, but in GMOD SQL has to be different )
[code]
DROP TABLE BODYGROUPS;
CREATE TABLE BODYGROUPS ( MODELBASE TEXT,
MODELADD TEXT,
ENTCLASS TEXT,
CHIELDID INTEGER,
CHWITHID TEXT,
SETSOLID INTEGER,
MOVETYPE INTEGER,
PHYSINIT INTEGER,
DRSHADOW INTEGER,
PHMOTION INTEGER,
PHYSLEEP INTEGER,
TIMTIME REAL,
TIMSOLID INTEGER,
POSOFF TEXT,
ANGOFF TEXT );
CREATE INDEX IND_BODYGROUPS_MODELBASE ON BODYGROUPS ( MODELBASE );
CREATE INDEX IND_BODYGROUPS_MODELADD ON BODYGROUPS ( MODELADD );
CREATE INDEX IND_BODYGROUPS_ENTCLASS ON BODYGROUPS ( ENTCLASS );
CREATE INDEX IND_BODYGROUPS_CHIELDID ON BODYGROUPS ( CHIELDID );
CREATE INDEX IND_BODYGROUPS_MODELBASE_MODELADD ON BODYGROUPS ( MODELBASE, MODELADD );
CREATE INDEX IND_BODYGROUPS_MODELBASE_ENTCLASS ON BODYGROUPS ( MODELBASE, ENTCLASS );
CREATE INDEX IND_BODYGROUPS_MODELBASE_CHIELDID ON BODYGROUPS ( MODELBASE, CHIELDID );
[/code]
[code]
local qRez = SqlQuery(tQ.Create)
if (SqlTableExists(tDefinition.Name)) then
for _, v in pairs(tQ.Index) do
qRez = SqlQuery(v)
end
print("SQLCreateTable: Indexed Table "..tDefinition.Name.." Created !")
return
else
print("SQLCreateTable: Table "..tDefinition.Name
.." failed to create because of "..tostring(qRez).." !")
return
end
[/code]
The queryes are executed sequentially ( Top to bottom, as the CREATE statement is only one row here, as I edited this with a test editor before pasting it, for you to see the definition better). I think I only can make one table.
Any suggestions ??
Hello, any1 ??
Not sure if you can have TEXT indexes in sqlite.
Just make sure and print the error message using [URL="http://wiki.garrysmod.com/page/sql/LastError"]sql.LastError( )[/URL]
Also, why do you need so many indexes?
Ninjas, ninjas everywhere.
As stated, give us the error and we can work from there.
Hi,
Its TEXT to bottom of its bones xD
[url]http://www.sqlite.org/datatype3.html[/url]
[url]http://www.sqlite.org/lang_createindex.html[/url]
SQLCreateTable: Table PIECES Dropped !
SQLCreateTable: Indexed Table PIECES Created !
SQLCreateTable: Table BODYGROUPS Dropped !
SQLCreateTable: Table BODYGROUPS failed to create because of duplicate column name: DRSHADOW !
I guess it was only too late... how did i not see this LoL ;)
AssemblyLib.BodyGroups = {
Name = "BODYGROUPS",
Size = 15,
[1] = {"MODELBASE", "TEXT"},
[2] = {"MODELADD" , "TEXT"},
[3] = {"ENTCLASS" , "TEXT"},
[4] = {"CHIELDID" , "INTEGER"},
[5] = {"CHWITHID" , "INTEGER"},
[6] = {"SETSOLID" , "INTEGER"},
[7] = {"MOVETYPE" , "INTEGER"},
[8] = {"PHYSINIT" , "INTEGER"},
[9] = {"DRSHADOW" , "INTEGER"},
[highlight] [10] = {"DRSHADOW" , "INTEGER"}, [/highlight]
[11] = {"PHYSLEEP" , "INTEGER"},
[12] = {"TIMTIME" , "REAL"},
[13] = {"TIMSOLID" , "INTEGER"},
[14] = {"POSOFF" , "TEXT"},
[15] = {"ANGOFF" , "TEXT"}
}
As for the indexes, I need them, for example subqueryes xD.
Besides one index wont hurt that is :)
SQLCreateTable: Table BODYGROUPS Dropped !
SQLCreateTable: Indexed Table BODYGROUPS Created !
Cheers :)
Sorry, you need to Log In to post a reply to this thread.