July 17th, 2008 | Published in Google Desktop API
While saving into the
optionsobject is very easy, you sometimes need more power and storage. Here is a tip on how to use an SQLite3 database in a Windows-only gadget.
The first thing you need is the SQLite3 ActiveX object from http://www.assembla.com/wiki/show/litex. Just download the zip archive in the files section. The DLL file is called
sqlite3.dlland is in the
\litex\bin\folder of the zip archive. Copy
sqlite3.dllinto your gadget's root folder. Then open your gadget's
gadget.gmanifestin your favorite editor.
Add this after the
sqlite3object, as shown in the following code:
var sqlite = new sqlite3();Take a look at the LiteX documentation to find all supported functions.
debug.trace("SQLite3 version: " + sqlite.version(true));
sqlite.open(":memory:"); // Open in memory as opposed to disk.
sqlite.execute("CREATE TABLE Test(a);");
sqlite.execute("INSERT INTO test VALUES (4);");
Have a tip you'd like to share? Send it to gd-developer AT google DOT com. To see all tips, choose the Tips label.