Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for the latest Odin std lib #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sql_helpers.odin
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ db_bind :: proc(stmt: ^Stmt, args: ..any) -> (err: Result_Code) {
// data from the struct has to match wanted column names
// changes the cmd string to the arg which should be a struct
db_select :: proc(cmd_end: string, struct_arg: any, args: ..any) -> (err: Result_Code) {
b := strings.make_builder_len_cap(0, 128)
defer strings.destroy_builder(&b)
b := strings.builder_make_len_cap(0, 128)
defer strings.builder_destroy(&b)

strings.write_string(&b, "SELECT ")

Expand Down Expand Up @@ -261,8 +261,8 @@ db_any_column :: proc(stmt: ^Stmt, column_index: i32, arg: any) -> (err: Result_

// auto insert INSERT INTO cmd_names VALUES (...)
db_insert :: proc(cmd_names: string, args: ..any) -> (err: Result_Code) {
b := strings.make_builder_len_cap(0, 128)
defer strings.destroy_builder(&b)
b := strings.builder_make_len_cap(0, 128)
defer strings.builder_destroy(&b)

strings.write_string(&b, "INSERT INTO ")
strings.write_string(&b, cmd_names)
Expand Down
1 change: 1 addition & 0 deletions sqlite3.odin
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "core:os"

// when os.OS == "windows" do foreign import sqlite { "sqlite3.lib" }
when os.OS == "linux" do foreign import sqlite { "sqlite3.a", "system:pthread", "system:dl" }
when os.OS == "darwin" do foreign import sqlite { "sqlite3.o" }

callback :: proc"c"(data: rawptr, a: c.int, b: [^]cstring, c: [^]cstring) -> ResultCode

Expand Down