KSQL_STMT_STEP(3) Library Functions Manual KSQL_STMT_STEP(3)

ksql_stmt_cstep, ksql_stmt_step
get the next row of results from a statement

library “ksql”

#include <sys/types.h>
#include <stdint.h>
#include <ksql.h>
enum ksqlc
ksql_stmt_step(struct ksqlstmt *stmt);
enum ksqlc
ksql_stmt_cstep(struct ksqlstmt *stmt);

The ksql_stmt_step() and ksql_stmt_cstep() functions query the next row of results from a statement prepared with ksql_stmt_alloc(3). The two functions differ in that ksql_stmt_step() fails when a constraint is violated, while ksql_stmt_cstep() returns KSQL_CONSTRAINT instead.
These functions handle a locked database (specifically, SQLITE_BUSY, SQLITE_LOCKED, or SQLITE_PROTOCOL) by sleeping for a random interval, then trying again infinitely.

These functions return several error conditions: KSQL_NOTOPEN if the database connection has not been opened; KSQL_DB on database errors, including constraint violations with ksql_stmt_step(); and KSQL_MEM on memory allocation failure.
It also returns the following non-error conditions: KSQL_ROW if a row is available for examining, KSQL_DONE if no more rows are available, or KSQL_CONSTRAINT if ksql_stmt_cstep() was used and a constraint was violated,

sqlite3_step(3)
May 9, 2018 OpenBSD 6.4