package nosqldb_sdk import ( "C" ) import ( "nosql_db_sdk_ffi/util/ptrproxy" "strings" "unsafe" "github.com/oracle/nosql-go-sdk/nosqldb" ) //export ffi_nosqldb_prepared_statement_new func ffi_nosqldb_prepared_statement_new() NosqldbPreparedStatement { nosqldb_prepared_statement_ptr := nosqldb.PreparedStatement {} return NosqldbPreparedStatement(ptrproxy.Ref(unsafe.Pointer(&nosqldb_prepared_statement_ptr))) } //export ffi_nosqldb_prepared_statement_set_number_variable func ffi_nosqldb_prepared_statement_set_number_variable(unsafe_nosqldb_prepared_statement_ptr NosqldbPreparedStatement, name string, value C.int) Error { nosqldb_prepared_statement_ptr, ok := ptrproxy.Deref(unsafe.Pointer(unsafe_nosqldb_prepared_statement_ptr)) if !ok { return C.CString("NosqldbPreparedStatementPtr cannot deref") } prepared_statement := (*nosqldb.PreparedStatement)(nosqldb_prepared_statement_ptr) name_cpy := strings.Clone(name) err := prepared_statement.SetVariable(name_cpy, value) if err != nil { return C.CString(err.Error()) } return nil } //export ffi_nosqldb_prepared_statement_set_string_variable func ffi_nosqldb_prepared_statement_set_string_variable(unsafe_nosqldb_prepared_statement_ptr NosqldbPreparedStatement, name string, value string) Error { nosqldb_prepared_statement_ptr, ok := ptrproxy.Deref(unsafe.Pointer(unsafe_nosqldb_prepared_statement_ptr)) if !ok { return C.CString("NosqldbPreparedStatementPtr cannot deref") } prepared_statement := (*nosqldb.PreparedStatement)(nosqldb_prepared_statement_ptr) name_cpy := strings.Clone(name) value_cpy := strings.Clone(value) err := prepared_statement.SetVariable(name_cpy, value_cpy) if err != nil { return C.CString(err.Error()) } return nil }