I should have thought about it.
You can get a look at the javascript code in this reply.
Regards, ~Nuno Lucas
Nuno Lucas, dando pulos de alegria, escreveu :
Hi all.
I just finished a first version of the SQLite OLE/DB provider. It only implements the basic ADO functionality (execute SQL command and Recordset view).
I make it available for all (free of charge, with no limitations), so I can get feedback on the OLE/DB functionality people want most.
You can get it at: http://xpto.ath.cx/sqlite It includes a sqlite3.dll, so you can change to a more recent sqlite version without problems.
You need to register it using "regsvr32.exe sqliteoledb.dll"
A basic ADO usage case (in javascript, as I don't know/remember VB), is attached (and can be found at the directory).
Let me know what it doesn't work in your case, so I know what I need to implement next (and any bugs, off course ;)
You can contact me at: [EMAIL PROTECTED] or [EMAIL PROTECTED]
Best regards, ~Nuno Lucas
------------------------------------------------------------------------
// // Run this in a command prompt using a line like this: // c:\> cscript demo.js //
/************************************************************************ * Utility functions ***********************************************************************/
function JustLeft( str, n ) { if ( str.length > n ) return str; for ( left = n - str.length; left >= 0; --left ) str += ' '; return str; }
function PrintProps( out, props ) { for ( n = 0; n < props.Count; ++n ) { tmp = JustLeft( props(n).Name, 40 ); out.Write( " " + tmp ); out.WriteLine( props(n) ); } }
function DumpRecordset( out, rs ) { // Print column names out.WriteLine( "===================================================" ); flds = rs.Fields; for ( i = 0; i < flds.Count; ++i ) { f = flds.Item(i); out.Write( JustLeft(f.Name,8) ); } if ( flds.Count > 0 ) { out.WriteLine( ); out.WriteLine( "---------------------------------------------------" ); } else out.WriteLine( "[No records]" ); while ( !rs.EOF ) { flds = rs.Fields; for ( i = 0; i < flds.Count; ++i ) { f = flds.Item(i); out.Write( JustLeft(f.Value,8) ); } out.WriteLine( ); rs.MoveNext( ); } out.WriteLine( "===================================================" ); }
/************************************************************************ * Main Program ***********************************************************************/
connString = "Provider=OleDb.SqliteProv; Location='demo.db'"; out = WScript.StdOut; // Create the ADO conection object and open the database conn = new ActiveXObject( "ADODB.Connection" ); conn.Open( connString );
// Show Connection properties out.WriteLine( "ADO.Connection.Properties:" ); PrintProps( out, conn.Properties ); out.writeLine( );
// Do a simple integrey check out.WriteLine( "PRAGMA integrity_check" ); rs = conn.Execute( "PRAGMA integrity_check" ); DumpRecordset( out, rs );
// Create a table (will fail on second time, off course) // and insert some rows conn.Execute( "CREATE TABLE t1 ( x INTEGER PRIMARY KEY, y, z )" ); conn.Execute( "INSERT INTO t1(x,y,z) VALUES(NULL,'a field','1 more field')") conn.Execute( "INSERT INTO t1(x,y,z) VALUES(NULL,'hello',76342)") conn.Execute( "INSERT INTO t1(x,y,z) VALUES(NULL,'hello','world!')")
// Show existing tables out.WriteLine( "SELECT * FROM sqlite_master:" ); rs = conn.Execute( "SELECT * FROM sqlite_master" ); DumpRecordset( out, rs );
// Show rows of the table 't1' out.WriteLine( "SELECT * FROM t1:" ); rs = conn.Execute( "SELECT * FROM t1" ); DumpRecordset( out, rs );