xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_data_directory.3 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.Dd March 11, 2017
2.Dt SQLITE3_DATA_DIRECTORY 3
3.Os
4.Sh NAME
5.Nm sqlite3_data_directory
6.Nd Name Of The Folder Holding Database Files
7.Sh SYNOPSIS
8.Vt char *sqlite3_data_directory;
9.Sh DESCRIPTION
10If this global variable is made to point to a string which is the name
11of a folder (a.k.a.
12directory), then all database files specified with a relative pathname
13and created or accessed by SQLite when using a built-in windows  VFS
14will be assumed to be relative to that directory.
15If this variable is a NULL pointer, then SQLite assumes that all database
16files specified with a relative pathname are relative to the current
17directory for the process.
18Only the windows VFS makes use of this global variable; it is ignored
19by the unix VFS.
20.Pp
21Changing the value of this variable while a database connection is
22open can result in a corrupt database.
23.Pp
24It is not safe to read or modify this variable in more than one thread
25at a time.
26It is not safe to read or modify this variable if a database connection
27is being used at the same time in a separate thread.
28It is intended that this variable be set once as part of process initialization
29and before any SQLite interface routines have been called and that
30this variable remain unchanged thereafter.
31.Pp
32The data_store_directory pragma may modify
33this variable and cause it to point to memory obtained from sqlite3_malloc.
34Furthermore, the data_store_directory pragma
35always assumes that any string that this variable points to is held
36in memory obtained from sqlite3_malloc and the pragma
37may attempt to free that memory using sqlite3_free.
38Hence, if this variable is modified directly, either it should be made
39NULL or made to point to memory obtained from sqlite3_malloc
40or else the use of the data_store_directory pragma
41should be avoided.
42.Sh SEE ALSO
43.Xr sqlite3 3 ,
44.Xr sqlite3_malloc 3 ,
45.Xr sqlite3_vfs 3
46