xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3session_create.3 (revision 51db93b1e55befe059298d8824a0c056de72eba2)
1.Dd December 19, 2018
2.Dt SQLITE3SESSION_CREATE 3
3.Os
4.Sh NAME
5.Nm sqlite3session_create
6.Nd Create A New Session Object
7.Sh SYNOPSIS
8.Ft int
9.Fo sqlite3session_create
10.Fa "sqlite3 *db"
11.Fa "const char *zDb"
12.Fa "sqlite3_session **ppSession     "
13.Fc
14.Sh DESCRIPTION
15Create a new session object attached to database handle db.
16If successful, a pointer to the new object is written to *ppSession
17and SQLITE_OK is returned.
18If an error occurs, *ppSession is set to NULL and an SQLite error code
19(e.g.
20SQLITE_NOMEM) is returned.
21.Pp
22It is possible to create multiple session objects attached to a single
23database handle.
24.Pp
25Session objects created using this function should be deleted using
26the sqlite3session_delete() function before
27the database handle that they are attached to is itself closed.
28If the database handle is closed before the session object is deleted,
29then the results of calling any session module function, including
30sqlite3session_delete() on the session object
31are undefined.
32.Pp
33Because the session module uses the sqlite3_preupdate_hook()
34API, it is not possible for an application to register a pre-update
35hook on a database handle that has one or more session objects attached.
36Nor is it possible to create a session object attached to a database
37handle for which a pre-update hook is already defined.
38The results of attempting either of these things are undefined.
39.Pp
40The session object will be used to create changesets for tables in
41database zDb, where zDb is either "main", or "temp", or the name of
42an attached database.
43It is not an error if database zDb is not attached to the database
44when the session object is created.
45.Sh SEE ALSO
46.Xr sqlite3_preupdate_hook 3 ,
47.Xr sqlite3session_delete 3
48