xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_data_directory.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
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.In sqlite3.h
9.Vt char *sqlite3_data_directory;
10.Sh DESCRIPTION
11If this global variable is made to point to a string which is the name
12of a folder (a.k.a.
13directory), then all database files specified with a relative pathname
14and created or accessed by SQLite when using a built-in windows VFS
15will be assumed to be relative to that directory.
16If this variable is a NULL pointer, then SQLite assumes that all database
17files specified with a relative pathname are relative to the current
18directory for the process.
19Only the windows VFS makes use of this global variable; it is ignored
20by the unix VFS.
21.Pp
22Changing the value of this variable while a database connection is
23open can result in a corrupt database.
24.Pp
25It is not safe to read or modify this variable in more than one thread
26at a time.
27It is not safe to read or modify this variable if a database connection
28is being used at the same time in a separate thread.
29It is intended that this variable be set once as part of process initialization
30and before any SQLite interface routines have been called and that
31this variable remain unchanged thereafter.
32.Pp
33The data_store_directory pragma may modify
34this variable and cause it to point to memory obtained from sqlite3_malloc.
35Furthermore, the data_store_directory pragma
36always assumes that any string that this variable points to is held
37in memory obtained from sqlite3_malloc and the pragma
38may attempt to free that memory using sqlite3_free.
39Hence, if this variable is modified directly, either it should be made
40NULL or made to point to memory obtained from sqlite3_malloc
41or else the use of the data_store_directory pragma
42should be avoided.
43.Sh IMPLEMENTATION NOTES
44These declarations were extracted from the
45interface documentation at line 6482.
46.Bd -literal
47SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;
48.Ed
49.Sh SEE ALSO
50.Xr sqlite3 3 ,
51.Xr sqlite3_malloc 3 ,
52.Xr sqlite3_vfs 3
53