Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.
/ gobolt Public archive

Commit

Permalink
Update size parameter casts to be precise
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-ince committed Oct 31, 2018
1 parent 8310c8a commit 66b9b67
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (connection *neo4jConnection) Server() string {
}

func (connection *neo4jConnection) Begin(bookmarks []string, txTimeout time.Duration, txMetadata map[string]interface{}) (RequestHandle, error) {
var res C.int
var res C.int32_t

res = C.BoltConnection_clear_begin(connection.cInstance)
if res != C.BOLT_SUCCESS {
Expand Down Expand Up @@ -145,23 +145,23 @@ func (connection *neo4jConnection) Rollback() (RequestHandle, error) {
}

func (connection *neo4jConnection) Run(cypher string, params map[string]interface{}, bookmarks []string, txTimeout time.Duration, txMetadata map[string]interface{}) (RequestHandle, error) {
var res C.int
var res C.int32_t

res = C.BoltConnection_clear_run(connection.cInstance)
if res != C.BOLT_SUCCESS {
return -1, newError(connection, "unable to clear run message")
}

cypherStr := C.CString(cypher)
res = C.BoltConnection_set_run_cypher(connection.cInstance, cypherStr, C.size_t(len(cypher)), C.int32_t(len(params)))
res = C.BoltConnection_set_run_cypher(connection.cInstance, cypherStr, C.uint64_t(len(cypher)), C.int32_t(len(params)))
C.free(unsafe.Pointer(cypherStr))
if res != C.BOLT_SUCCESS {
return -1, newError(connection, "unable to set cypher statement")
}

var index C.int32_t
for paramName, paramValue := range params {
paramNameLen := C.size_t(len(paramName))
paramNameLen := C.uint64_t(len(paramName))
paramNameStr := C.CString(paramName)

boltValue := C.BoltConnection_set_run_cypher_parameter(connection.cInstance, index, paramNameStr, paramNameLen)
Expand Down

0 comments on commit 66b9b67

Please sign in to comment.