Es sql open

From EventScripts Community Encyclopedia


Overview

Syntax: es_sql open <db-name> [dbdir]

Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.

Variation of this command that doesn't expand variables: es_xsql open

Description

Opens or creates a SQLite database file by the name of es_db-name.sqldb in the directory mentioned.

Parameters

  • db-name - The name of the database to open. The db-name should be referenced in all future es_sql statements.
  • [dbdir] - Directory of the database file on disk, supports same syntax as keygroup databases, e.g. "¦servermail"). You can also specify ":memory:" (with quotes) to store the DB only in memory.


Examples

See the ServerMail example in ES v1.5 for a detailed example.

// open a SQLite database file
es_sql open mydb |myscriptdir
// other es_sql query commands
// ...
es_sql close mydb

Or, if you don't want to save to a file:

// open a SQLite database file, but it will be lost when server shuts down or the DB is closed
es_sql open memoryonlydb ":memory:"
// other es_sql query commands
// ...
es_sql close memoryonlydb


Notes

  • Must be used before any other es_sql command will work.
  • Requires EventScripts v1.5.


See also

blog comments powered by Disqus