USQLite [Not yet released, pending testing]
Posted: Sun Jul 01, 2012 4:42 am
So I finally got off my ass and made an SQLite database interface for Unreal.
Currently it uses name lookups instead of ID lookups, but I could add ID lookups in case extra speed is needed because the test function as shown below is pretty.. well.. slow. It freezes my unreal for about 1/4th a second or so.
Any suggestions? I still need to test the hell out of it since I just now got it working without any sort of consistent crashing, but I haven't tested literally every single function in depth; only what you see in the test code.
Interface code is as follows(including test poop)
Currently it uses name lookups instead of ID lookups, but I could add ID lookups in case extra speed is needed because the test function as shown below is pretty.. well.. slow. It freezes my unreal for about 1/4th a second or so.
Any suggestions? I still need to test the hell out of it since I just now got it working without any sort of consistent crashing, but I haven't tested literally every single function in depth; only what you see in the test code.
Interface code is as follows(including test poop)
Code: Select all
//============================================================================
// Holy shitballs! it's a SQLite3 Class for unreal!!!!!!!!
// Do you love local databases? I crappity smackING DO, NO SQL INSTALLATION REQUIRED
// v1.0 by []KAOS[]Casey using a wrapper I had to fix called easySQLite
// crappity smack google code
//==============================================================================
class USQLiteDB extends Object
native;
var native const editconst int InternalTableList;//If you touch these I hope you like crashes.
var native const editconst int InternalRecordList;
var native const editconst int InternalDB;
var native const editconst int InternalDBName; //yeah thats right,4 different ways to cause crashes. Don't be a dumbass.
native final function SetupDatabase(string Filename);//filename eg test.db
native final function CloseDatabase();//cleanup!
//sqlite3 syntax : CREATE TABLE person (_ID INTEGER PRIMARY KEY, fname TEXT NOT NULL, lname TEXT NOT NULL, birthdate INTEGER)
//USQLiteDB syntax : AddTable("person","_ID INTEGER PRIMARY KEY, fname TEXT NOT NULL, lname TEXT NOT NULL, birthdate INTEGER");
native final function AddTable(String TableName, String TableDefinition);
native final function RemoveTable(String TableName);
native final function bool PushRecord(String Table);//Adds one new record.
native final function PullRecord(String Table,optional string WhereCondition);
//PullRecord("person"); would grab the all entries from the person table
//PullRecord("person","_ID >= 10 and _ID 3");
}
function PrintTestDB(USQLiteDB DB,string TableName)
{
local int i, max;
max = DB.GetNumRecords(TableName);
for(i=0; i