Player APIs (BrightScript & Ja...
...
Object Reference
Hashing and Storage Objects
roSqliteDatabase
7min
this is the main sqlite object that "owns" the database you can create as many of these objects as you need the javascript equivalent is to use the indexeddb ifsqlitedatabse open(path as string) as boolean opens an existing database file this method returns true upon success create(path as string) as boolean creates a new, empty database file this method returns true upon success passing "\ memory " to this method creates a database in non persistent storage this is useful for high volume database applications that might cause wear issues on an sd card close() closes an open database createstatement(sql text as string) as object creates a new rosqlitestatement object using the specified sql string runbackground(sql text as string, associative array as object) as integer runs the specified sql statement in the background and binds variables using the passed roassociativearray setmemorylimit(limit as integer) sets the "soft" memory limit under which sqlite will attempt to remain (see the sqlite documentation for details) the setmemorylimit() method sets global parameters it must, therefore, be called before any other calls are made on the database object ifmessageport setport(port as romessageport) posts messages of type rosqliteevent to the attached message port examples creating a database db = createobject("rosqlitedatabase") print db openresult = db create("sd /test db") if openresult print "created ok" else print "creation failed" end endif creating a table in a database createstmt = db createstatement("create table playback (md5 text primary key, path path, playback count int);") print createstmt if type(createstmt) <> "rosqlitestatement" then print "we didn't get a statement returned!!" end endif sqlresult = createstmt run() print sqlresult if sqlresult = sqlite complete print "table created ok" else print "table creation failed" endif createstmt finalise()