← Back to Stormify Documentation
KDBC
Unified C Database Connectivity — SQLite, PostgreSQL, MariaDB, Oracle, MSSQL
Loading...
Searching...
No Matches
Error Handling

Functions

const char * kdbc_error (kdbc_conn *conn)
 Get the last error message for a connection.
const char * kdbc_stmt_error (kdbc_stmt *stmt)
 Get the last error message for a statement.
const char * kdbc_global_error (void)
 Get the last global (connection-less) error message.

Detailed Description

Retrieve error messages from connections, statements, or global context.

Each handle (kdbc_conn, kdbc_stmt) maintains its own error buffer (1024 bytes). The global error buffer is thread-local, used for errors that occur outside a connection context (e.g. driver not available, connection failure).

Returned pointers are valid until the next KDBC call on the same handle, or until the handle is closed. Returns "" (empty string) when no error has occurred.

Function Documentation

◆ kdbc_error()

const char * kdbc_error ( kdbc_conn * conn)

Get the last error message for a connection.

Parameters
connThe connection to query.
Returns
The error message, or "" if no error.

◆ kdbc_stmt_error()

const char * kdbc_stmt_error ( kdbc_stmt * stmt)

Get the last error message for a statement.

Parameters
stmtThe statement to query.
Returns
The error message, or "" if no error.

◆ kdbc_global_error()

const char * kdbc_global_error ( void )

Get the last global (connection-less) error message.

Used for errors that occur before a connection exists, such as driver-not-available or connection failure. Thread-local — safe to call from any thread.

Returns
The error message, or "" if no error.