neo4j-rstats / neo4r

A Modern and Flexible Neo4J Driver
https://neo4j-rstats.github.io/user-guide/
Other
106 stars 30 forks source link

when data from value has ' or " vec_to_cypher failed to escape and result "Neo.ClientError.Statement.SyntaxError" #61

Open databunnysg opened 5 years ago

ColinFay commented 5 years ago

Hello,

Thanks for reporting that.

Can you provide an example of code you're trying to convert to cypher?

Thanks, Colin

databunnysg commented 5 years ago

Dear Colin,

Here you go! I tried to use stringr package fix this issue but not successful yet.

t<-data.frame(name="mac book 17\"", name2="mac air'",stringsAsFactors = FALSE) call_neo4j(paste("create",vec_to_cypher(t,"mac")),con,type="row") $error_code [1] "Neo.ClientError.Statement.SyntaxError"

$error_message [1] "Invalid input ''': expected whitespace, '.', node labels, '[', \"=~\", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', '~', \"<>\", \"!=\", '<', '>', \"<=\", \">=\", AND, XOR, OR, ',' or '}' (line 1, column 38 (offset: 37))\r\n\"create (:mac {name: 'mac book 17'', name2: 'mac air''})\"\r\n ^"

Will let you know if I can fix it from my side.

thanks in advance! Yi Huang