xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_column_name.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
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.In sqlite3.h
10.Ft const char *
11.Fo sqlite3_column_name
12.Fa "sqlite3_stmt*"
13.Fa "int N"
14.Fc
15.Ft const void *
16.Fo sqlite3_column_name16
17.Fa "sqlite3_stmt*"
18.Fa "int N"
19.Fc
20.Sh DESCRIPTION
21These routines return the name assigned to a particular column in the
22result set of a SELECT statement.
23The sqlite3_column_name() interface returns a pointer to a zero-terminated
24UTF-8 string and sqlite3_column_name16() returns a pointer to a zero-terminated
25UTF-16 string.
26The first parameter is the prepared statement that
27implements the SELECT statement.
28The second parameter is the column number.
29The leftmost column is number 0.
30.Pp
31The returned string pointer is valid until either the prepared statement
32is destroyed by
33.Fn sqlite3_finalize
34or until the statement is automatically reprepared by the first call
35to
36.Fn sqlite3_step
37for a particular run or until the next call to sqlite3_column_name()
38or sqlite3_column_name16() on the same column.
39.Pp
40If sqlite3_malloc() fails during the processing of either routine (for
41example during a conversion from UTF-8 to UTF-16) then a NULL pointer
42is returned.
43.Pp
44The name of a result column is the value of the "AS" clause for that
45column, if there is an AS clause.
46If there is no AS clause then the name of the column is unspecified
47and may change from one release of SQLite to the next.
48.Sh IMPLEMENTATION NOTES
49These declarations were extracted from the
50interface documentation at line 4792.
51.Bd -literal
52SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
53SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
54.Ed
55.Sh SEE ALSO
56.Xr sqlite3_finalize 3 ,
57.Xr sqlite3_step 3 ,
58.Xr sqlite3_stmt 3
59