Reputation: 57
Let's say I have the following query passed to Neo4j as string in a C#/.NET application:
MATCH (e)-[:BELONGS_TO]->(t:Tenant) WHERE t.id={id} AND ( e:Unit OR e:UnitInactive ) AND e.name contains {queryName} RETURN e
How do I format the query string to retrieve an specific e.name like "Mary's" or "João", escaping quotes and diacritics and case-insensitive?
Upvotes: 0
Views: 627
Reputation: 2746
In case the query is used in a programming language (e.g. python), I think the recommendation way would be using parameter. For instance:
e.name contains $queryName
And when calling the session query:
session.run(query, queryName=NameValue)
Upvotes: 0
Reputation: 12684
You can treat special characters (diacritics) as regular chars. Then single quote in Mary's can be escaped with \.
For example, in neo4j cypher:
toLower(e.name) = "joão" OR toLower(e.name) = "mary\'s"
Upvotes: 2