sqlite_open

From Liberty Unleashed Wiki
Revision as of 16:58, 26 October 2010 by Juppi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events
Note: This function requires the external module lu_sqlite.

This function opens an SQLite database or creates a new one.

Syntax

  1. UserPointer sqlite_open( string filename )

Arguments

  • filename - This is the filename of the previously saved database or filename for the new database

Example

For a larger example, check the general SQLite database example from the wiki tutorials.

Example 2.

This example shows how to open to a database with a single command. The command loads a previously saved database from 'database.db', or if the file doesn't exist, creates a new database.

  1.  
  2. function onConsoleInput( cmd, text )
  3. {
  4. if ( cmd == "connectsql" )
  5. {
  6. local db = sqlite_open( "database.db" );
  7. print( "Opening an SQLite database..." );
  8. }
  9. return 1;
  10. }
  11.  

Notes

The call onConsoleInput was used in in this example. More info about it in corresponding page.

Related Functions

These functions are provided by the official module lu_sqlite.

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox