slConnect

Creates a database object.

Syntax:

slConnect ( db-uri )

Parameters:

(s) db-uri: database file name or other SQLite supported URI.

Returns:

(s) database-handle: An SQLite extender handle to a database object. 

SlConnect opens a connection to a new or existing SQLite database. Pass the returned database-handle to other extender functions to query, update and add to the associated database.

 

db-uri

This parameter can be a filename of a new or existing SQLite database with an optional full path. It can also be the SQLite ":memory:" URI to create a memory only database.

  

Note: a memory only database can still be saved to a file using the slSerialize extender function.

Example:
AddExtender('ilcsl44i.dll', 0, 'ilcsl64i.dll')
; Connect to an existing database
northwinddb = slConnect("northwind.db")
slClose(northwinddb) ; Clean up
; Connect to a new database
testdb = slConnect("C:\tmp\test123.db")
slClose(testdb) ; Clean up
;Connect to a memory database
memorydb = slConnect(":memory:")
; Can't save a zero size database.
slExecute(memorydb, "CREATE TABLE memtest(Col1 INTEGER PRIMARY KEY, Col2);")
slSerialize(memorydb, "C:\tmp\wasmem.db")
slClose(memorydb) ; Clean up
See Also:

slExecute, slClose, slSerialize