xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_file_control.3 (revision 51db93b1e55befe059298d8824a0c056de72eba2)
1.Dd December 19, 2018
2.Dt SQLITE3_FILE_CONTROL 3
3.Os
4.Sh NAME
5.Nm sqlite3_file_control
6.Nd Low-Level Control Of Database Files
7.Sh SYNOPSIS
8.Ft int
9.Fo sqlite3_file_control
10.Fa "sqlite3*"
11.Fa "const char *zDbName"
12.Fa "int op"
13.Fa "void*"
14.Fc
15.Sh DESCRIPTION
16The sqlite3_file_control() interface makes a
17direct call to the xFileControl method for the sqlite3_io_methods
18object associated with a particular database identified by the second
19argument.
20The name of the database is "main" for the main database or "temp"
21for the TEMP database, or the name that appears after the AS keyword
22for databases that are added using the ATTACH SQL command.
23A NULL pointer can be used in place of "main" to refer to the main
24database file.
25The third and fourth parameters to this routine are passed directly
26through to the second and third parameters of the xFileControl method.
27The return value of the xFileControl method becomes the return value
28of this routine.
29.Pp
30A few opcodes for sqlite3_file_control() are
31handled directly by the SQLite core and never invoke the sqlite3_io_methods.xFileControl
32method.
33The SQLITE_FCNTL_FILE_POINTER value for the
34op parameter causes a pointer to the underlying sqlite3_file
35object to be written into the space pointed to by the 4th parameter.
36The SQLITE_FCNTL_JOURNAL_POINTER works
37similarly except that it returns the sqlite3_file object
38associated with the journal file instead of the main database.
39The SQLITE_FCNTL_VFS_POINTER opcode returns
40a pointer to the underlying sqlite3_vfs object for the file.
41The SQLITE_FCNTL_DATA_VERSION returns the
42data version counter from the pager.
43.Pp
44If the second parameter (zDbName) does not match the name of any open
45database file, then SQLITE_ERROR is returned.
46This error code is not remembered and will not be recalled by sqlite3_errcode()
47or sqlite3_errmsg().
48The underlying xFileControl method might also return SQLITE_ERROR.
49There is no way to distinguish between an incorrect zDbName and an
50SQLITE_ERROR return from the underlying xFileControl method.
51.Pp
52.Sh SEE ALSO
53.Xr SQLITE_FCNTL_LOCKSTATE 3 ,
54.Xr sqlite3_errcode 3 ,
55.Xr sqlite3_file 3 ,
56.Xr sqlite3_file_control 3 ,
57.Xr sqlite3_io_methods 3 ,
58.Xr sqlite3_vfs 3 ,
59.Xr SQLITE_FCNTL_LOCKSTATE 3
60