xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_column_name.3 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.Dd March 11, 2017
2.Dt SQLITE3_COLUMN_NAME 3
3.Os
4.Sh NAME
5.Nm sqlite3_column_name ,
6.Nm sqlite3_column_name16
7.Nd Column Names In A Result Set
8.Sh SYNOPSIS
9.Ft const char *
10.Fo sqlite3_column_name
11.Fa "sqlite3_stmt*"
12.Fa "int N"
13.Fc
14.Ft const void *
15.Fo sqlite3_column_name16
16.Fa "sqlite3_stmt*"
17.Fa "int N"
18.Fc
19.Sh DESCRIPTION
20These routines return the name assigned to a particular column in the
21result set of a SELECT statement.
22The sqlite3_column_name() interface returns a pointer to a zero-terminated
23UTF-8 string and sqlite3_column_name16() returns a pointer to a zero-terminated
24UTF-16 string.
25The first parameter is the prepared statement that
26implements the SELECT statement.
27The second parameter is the column number.
28The leftmost column is number 0.
29.Pp
30The returned string pointer is valid until either the prepared statement
31is destroyed by sqlite3_finalize() or until the statement
32is automatically reprepared by the first call to sqlite3_step()
33for a particular run or until the next call to sqlite3_column_name()
34or sqlite3_column_name16() on the same column.
35.Pp
36If sqlite3_malloc() fails during the processing of either routine (for
37example during a conversion from UTF-8 to UTF-16) then a NULL pointer
38is returned.
39.Pp
40The name of a result column is the value of the "AS" clause for that
41column, if there is an AS clause.
42If there is no AS clause then the name of the column is unspecified
43and may change from one release of SQLite to the next.
44.Sh SEE ALSO
45.Xr sqlite3_stmt 3 ,
46.Xr sqlite3_finalize 3 ,
47.Xr sqlite3_step 3
48