Name

sqlite3_column_name() — Get the name of a result column

Definition

const char* sqlite3_column_name(   sqlite3_stmt* stmt, int cidx );
const void* sqlite3_column_name16( sqlite3_stmt* stmt, int cidx );
stmt

A prepared statement.

cidx

A column index. The first column has an index of zero (0).

Returns

The name of a result column.

Description

These functions return the name of a result column. This is the name provided by the AS clause of a select header. If no AS clause was provided, the name will be derived from the expression used to define the SELECT header. The format of derived names is not defined by the SQL standard and may change from one release of SQLite to another. If an application depends on explicit column names, it should always use AS clauses in the select header.

Returned pointers will remain valid until sqlite3_finalize() is called on the statement, or until one of these functions is called with the same column index. SQLite will take care of all memory management for the buffers returned by these functions.

See Also

SELECT [SQL Cmd, Ap C], full_column_names [PRAGMA, Ap F], short_column_names [PRAGMA, Ap F]

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.