Module Interface
Access to the database is made available through connection objects. The module must provide the following constructor for these:
-
connect(parameters...) Constructor for creating a connection to the database. Returns a
Connectionobject. It takes a number of parameters that are database dependent.Note 1
These module globals must be defined:
-
apilevel String constant stating the supported DB API level. Currently only the strings 1.0 and 2.0 are allowed. If not given, a Database API 1.0 level interface should be assumed.
-
threadsafety Integer constant stating the level of thread safety the interface supports. Possible values are:
0 = Threads may not share the module.
1 = Threads may share the module, but not connections.
2 = Threads may share the module and connections.
3 = Threads may share the module, connections, and cursors.
Sharing in this context means that two threads may use a resource without wrapping it using a mutex semaphore to implement resource locking. You can’t always make external resources thread-safe by managing access using a mutex: the resource may rely on global variables or other external sources that are beyond your control.
-
paramstyle String constant stating the type of parameter marker formatting expected by the interface. Possible values are:Note 2
qmark= Question-mark style, e.g., ...WHEREname=?numeric= Numeric, positional style, e.g., ...WHEREname=:1named= Named style, e.g., ...WHEREname=:nameformat= ANSI Cprintfformat codes, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access