// Minimal SQLite3 C API wrapper.
// This module is for internal use and should not be used directly.
module sqlite/capi

pub import std/num/int32

extern import
  c file "sqlite-define.c"
extern import
  c file "sqlite3.c"
extern import
  c file "sqlite-inline.c"

extern make-sqlite-ok(): int32
  c inline "SQLITE_OK"
pub val int32/sqlite-ok: int32 = make-sqlite-ok()

pub extern initialize(): int32
  c inline "sqlite3_initialize()"

pub extern shutdown(): int32
  c inline "sqlite3_shutdown()"

pub extern errstr(x: int32): string
  c "kk_sqlite3_errstr"

pub extern extended-errcode(^db: any): int32
  c "kk_sqlite3_extended_errcode"

pub extern error-offset(^db: any): int
  c "kk_sqlite3_error_offset"

pub extern open-v2(^filename: string, flags: int32, ^vfs: string): (any, int32)
  c "kk_sqlite3_open_v2"

pub extern close(^db: any): int32
  c "kk_sqlite3_close"

pub extern prepare-v3(^db: any, ^sql: sslice, flags: int32): (any, sslice, int32)
  c "kk_sqlite3_prepare_v3"

pub extern finalize(^stmt: any): int32
  c "kk_sqlite3_finalize"

pub extern step(^stmt: any): int32
  c "kk_sqlite3_step"

pub extern reset(^stmt: any): int32
  c "kk_sqlite3_reset"
