1.Dd March 11, 2017 2.Dt SQLITE3SESSION_ATTACH 3 3.Os 4.Sh NAME 5.Nm sqlite3session_attach 6.Nd Attach A Table To A Session Object 7.Sh SYNOPSIS 8.Ft int 9.Fo sqlite3session_attach 10.Fa "sqlite3_session *pSession" 11.Fa "const char *zTab " 12.Fc 13.Sh DESCRIPTION 14If argument zTab is not NULL, then it is the name of a table to attach 15to the session object passed as the first argument. 16All subsequent changes made to the table while the session object is 17enabled will be recorded. 18See documentation for sqlite3session_changeset() 19for further details. 20.Pp 21Or, if argument zTab is NULL, then changes are recorded for all tables 22in the database. 23If additional tables are added to the database (by executing "CREATE 24TABLE" statements) after this call is made, changes for the new tables 25are also recorded. 26.Pp 27Changes can only be recorded for tables that have a PRIMARY KEY explicitly 28defined as part of their CREATE TABLE statement. 29It does not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid 30alias) or not. 31The PRIMARY KEY may consist of a single column, or may be a composite 32key. 33.Pp 34It is not an error if the named table does not exist in the database. 35Nor is it an error if the named table does not have a PRIMARY KEY. 36However, no changes will be recorded in either of these scenarios. 37.Pp 38Changes are not recorded for individual rows that have NULL values 39stored in one or more of their PRIMARY KEY columns. 40.Pp 41SQLITE_OK is returned if the call completes without error. 42Or, if an error occurs, an SQLite error code (e.g. 43SQLITE_NOMEM) is returned. 44.Sh SEE ALSO 45.Xr sqlite3session_changeset 3 46