UseSQLiteDatabase()

Syntax

Result = UseSQLiteDatabase([LibraryName$])
Description
Initialize the SQLite database environment for future use.

Parameters

LibraryName$ (optional) Filename (and path if needed) of the dynamic library to use.
You will be able to use the latest version of the 'dll' file (so, dylib) without waiting for a PB update.
Without this file, the static library will be used as usual and the executable will be larger.

Return value

When using the optional 'LibraryName$' parameter, it will return #True if the dynamic library has been correctly loaded or #False otherwise. If the optional 'LibraryName$' parameter is not specified, it will always returns #True.

Remarks

SQLite is a file based, serverless database manager. There is no driver or additional files to install, all is ready to use. SQLite is widely spread across the industry and is considered to be one of the best embedded database manager available. For more information about SQLite: http://www.sqlite.org.

To create a new empty database, create a new file with CreateFile(). Database commands can now be used to create tables and add records.

A SQLite database has to be opened using OpenDatabase() before using any other database functions.

Example

  UseSQLiteDatabase()

  Filename$ = OpenFileRequester("Choose a file name", "PureBasic.sqlite", "*.sqlite|*.sqlite", 0)

  If CreateFile(0, Filename$)
    Debug "Database file created"
    CloseFile(0)
  EndIf
  
  If OpenDatabase(0, Filename$, "", "")
    Debug "Connected to PureBasic.sqlite"
    If DatabaseUpdate(0, "CREATE TABLE info (test VARCHAR(255));")
      Debug "Table created"
    EndIf
  EndIf

See Also

OpenDatabase(), UsePostgreSQLDatabase(), UseODBCDatabase(), UseMySQLDatabase()

Supported OS

All

<- UsePostgreSQLDatabase() - Database Index