If sqlite3_open_v2 is commentted, it gives an error: unknown function C.sqlite3
which is strange, why should the prototype affect db :=C.sqlite3(0)?
But if it is commented then I get a bad parameter or other API misuse.
What am I doing wrong?
import sqlite
//fn C.sqlite3_open_v2(charptr, &&C.sqlite3, int, charptr) int
struct C.sqlite3_stmt { }
fn main(){
    db := &C.sqlite3(0)
    stm := &C.sqlite3_stmt(0)
    db_path := ':memory:'
    query := 'select 1'
    C.sqlite3_open(db_path.str, &db)
    err := C.sqlite3_prepare_v2(&db, query.str, -1, &stm, C.NULL)
    if err != C.SQLITE_OK {
      C.puts(C.sqlite3_errstr(err))
    }
    C.sqlite3_close(db)
}
				
                        
You're importing
sqlitewithout really using it. In thesqlitemodule, there are wrapper functions to do what you want. This is how you would do it: