Name

sqlite3_data_count() — Get the number of valid result columns in a statement

Definition

int sqlite3_data_count( sqlite3_stmt* stmt );
stmt

A prepared statement.

Returns

The number of columns available in a prepared statement.

Description

This function returns the number of columns available in a row result. Column indexes start at zero (0), so if this function returns 5, value column indexes are 0 to 4. The value zero (0) will be returned if there is no current result row.

This function is almost identical to sqlite3_column_count(). The main difference is that this function will return zero (0) if no valid result row is currently available (for example, before sqlite3_step() is called), while sqlite3_column_count() will always return the number of expected columns, even if no row is currently available.

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.