xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_value.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_VALUE 3
3.Os
4.Sh NAME
5.Nm sqlite3_value
6.Nd dynamically typed value object
7.Sh SYNOPSIS
8.In sqlite3.h
9.Vt typedef struct sqlite3_value sqlite3_value;
10.Sh DESCRIPTION
11SQLite uses the sqlite3_value object to represent all values that can
12be stored in a database table.
13SQLite uses dynamic typing for the values it stores.
14Values stored in sqlite3_value objects can be integers, floating point
15values, strings, BLOBs, or NULL.
16.Pp
17An sqlite3_value object may be either "protected" or "unprotected".
18Some interfaces require a protected sqlite3_value.
19Other interfaces will accept either a protected or an unprotected sqlite3_value.
20Every interface that accepts sqlite3_value arguments specifies whether
21or not it requires a protected sqlite3_value.
22The
23.Fn sqlite3_value_dup
24interface can be used to construct a new protected sqlite3_value from
25an unprotected sqlite3_value.
26.Pp
27The terms "protected" and "unprotected" refer to whether or not a mutex
28is held.
29An internal mutex is held for a protected sqlite3_value object but
30no mutex is held for an unprotected sqlite3_value object.
31If SQLite is compiled to be single-threaded (with SQLITE_THREADSAFE=0
32and with
33.Fn sqlite3_threadsafe
34returning 0) or if SQLite is run in one of reduced mutex modes SQLITE_CONFIG_SINGLETHREAD
35or SQLITE_CONFIG_MULTITHREAD then there is
36no distinction between protected and unprotected sqlite3_value objects
37and they can be used interchangeably.
38However, for maximum code portability it is recommended that applications
39still make the distinction between protected and unprotected sqlite3_value
40objects even when not strictly required.
41.Pp
42The sqlite3_value objects that are passed as parameters into the implementation
43of application-defined SQL functions
44are protected.
45The sqlite3_value objects returned by
46.Fn sqlite3_vtab_rhs_value
47are protected.
48The sqlite3_value object returned by
49.Fn sqlite3_column_value
50is unprotected.
51Unprotected sqlite3_value objects may only be used as arguments to
52.Fn sqlite3_result_value ,
53.Fn sqlite3_bind_value ,
54and
55.Fn sqlite3_value_dup .
56The sqlite3_value_type() family of interfaces require
57protected sqlite3_value objects.
58.Sh IMPLEMENTATION NOTES
59These declarations were extracted from the
60interface documentation at line 4485.
61.Bd -literal
62typedef struct sqlite3_value sqlite3_value;
63.Ed
64.Sh SEE ALSO
65.Xr sqlite3_bind_blob 3 ,
66.Xr sqlite3_column_blob 3 ,
67.Xr sqlite3_result_blob 3 ,
68.Xr sqlite3_threadsafe 3 ,
69.Xr sqlite3_value_blob 3 ,
70.Xr sqlite3_value_dup 3 ,
71.Xr sqlite3_vtab_rhs_value 3 ,
72.Xr SQLITE_CONFIG_SINGLETHREAD 3
73