mirror of
https://github.com/etlegacy/etlegacy-lua-docs.git
synced 2024-11-21 19:51:40 +00:00
added database connection comment
This commit is contained in:
parent
72dffc1aad
commit
48626e4837
1 changed files with 6 additions and 4 deletions
10
database.rst
10
database.rst
|
@ -58,13 +58,15 @@ env:connect(sourcename[,username[,password]])
|
|||
---------------------------------------------
|
||||
|
||||
Connects to a data source specified in sourcename using username and password if they are supplied.
|
||||
The sourcename may vary according to each driver. SQLite3 uses a simple database name.
|
||||
The sourcename may vary according to each driver. SQLite3 uses a simple database name::
|
||||
|
||||
-- get database path
|
||||
local dbpath = string.gsub(et.trap_Cvar_Get("fs_homepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/"
|
||||
-- connection
|
||||
conn = assert(env:connect(dbpath .. "etl.db"))
|
||||
|
||||
.. Some use a simple database name, like PostgreSQL, MySQL and SQLite; the ODBC driver expects the name of the DSN; the Oracle driver expects the service name; See also: PostgreSQL, and MySQL extensions.
|
||||
|
||||
local dbpath = string.gsub(et.trap_Cvar_Get("fs_homepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/"
|
||||
conn = assert(env:connect(dbpath .. "etl.db"))
|
||||
|
||||
Returns a `connection object <database.html#connection-objects>`__.
|
||||
|
||||
If desired, Lua scripts can also connect to the engine memory database by the following Lua command::
|
||||
|
|
Loading…
Reference in a new issue