Skip to content

Instantly share code, notes, and snippets.

@greentornado
Created November 13, 2016 16:09
Show Gist options
  • Save greentornado/61b3e8e2f77f352d78b92badede9a122 to your computer and use it in GitHub Desktop.
Save greentornado/61b3e8e2f77f352d78b92badede9a122 to your computer and use it in GitHub Desktop.
🚀 crystal src/main.cr -- examples/sqlite3.cr
/usr/include/sqlite3.h:35:10: fatal error: 'stdarg.h' file not found
@[Link("sqlite3")]
lib LibSQLite3
type Sqlite3 = Void*
fun open = sqlite3_open(filename : LibC::Char*, pp_db : Sqlite3*) : LibC::Int
fun open = sqlite3_open_v2(filename : LibC::Char*, pp_db : Sqlite3*, flags : LibC::Int, z_vfs : LibC::Char*) : LibC::Int
fun errcode = sqlite3_errcode(db : Sqlite3) : LibC::Int
fun errmsg = sqlite3_errmsg(x0 : Sqlite3) : LibC::Char*
type Sqlite3Stmt = Void*
fun prepare_v2 = sqlite3_prepare_v2(db : Sqlite3, z_sql : LibC::Char*, n_byte : LibC::Int, pp_stmt : Sqlite3Stmt*, pz_tail : LibC::Char**) : LibC::Int
fun step = sqlite3_step(x0 : Sqlite3Stmt) : LibC::Int
fun column_count = sqlite3_column_count(p_stmt : Sqlite3Stmt) : LibC::Int
fun column_type = sqlite3_column_type(x0 : Sqlite3Stmt, i_col : LibC::Int) : LibC::Int
alias SqliteInt64 = LibC::LongLong
alias Sqlite3Int64 = SqliteInt64
fun column_int64 = sqlite3_column_int64(x0 : Sqlite3Stmt, i_col : LibC::Int) : Sqlite3Int64
fun column_double = sqlite3_column_double(x0 : Sqlite3Stmt, i_col : LibC::Int) : LibC::Double
fun column_text = sqlite3_column_text(x0 : Sqlite3Stmt, i_col : LibC::Int) : UInt8*
fun column_bytes = sqlite3_column_bytes(x0 : Sqlite3Stmt, i_col : LibC::Int) : LibC::Int
fun column_blob = sqlite3_column_blob(x0 : Sqlite3Stmt, i_col : LibC::Int) : Void*
fun bind_int = sqlite3_bind_int(x0 : Sqlite3Stmt, x1 : LibC::Int, x2 : LibC::Int) : LibC::Int
fun bind_int64 = sqlite3_bind_int64(x0 : Sqlite3Stmt, x1 : LibC::Int, x2 : Sqlite3Int64) : LibC::Int
fun bind_text = sqlite3_bind_text(x0 : Sqlite3Stmt, x1 : LibC::Int, x2 : LibC::Char*, x3 : LibC::Int, x4 : (Void* -> Void)) : LibC::Int
fun bind_blob = sqlite3_bind_text(x0 : Sqlite3Stmt, x1 : LibC::Int, x2 : LibC::Char*, x3 : LibC::Int, x4 : (Void* -> Void)) : LibC::Int
fun bind_null = sqlite3_bind_null(x0 : Sqlite3Stmt, x1 : LibC::Int) : LibC::Int
fun bind_double = sqlite3_bind_double(x0 : Sqlite3Stmt, x1 : LibC::Int, x2 : LibC::Double) : LibC::Int
fun bind_parameter_index = sqlite3_bind_parameter_index(x0 : Sqlite3Stmt, z_name : LibC::Char*) : LibC::Int
fun reset = sqlite3_reset(p_stmt : Sqlite3Stmt) : LibC::Int
fun column_name = sqlite3_column_name(x0 : Sqlite3Stmt, n : LibC::Int) : LibC::Char*
fun last_insert_rowid = sqlite3_last_insert_rowid(x0 : Sqlite3) : Sqlite3Int64
fun finalize = sqlite3_finalize(p_stmt : Sqlite3Stmt) : LibC::Int
fun close_v2 = sqlite3_close_v2(x0 : Sqlite3) : LibC::Int
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment