age icon indicating copy to clipboard operation
age copied to clipboard

Created support for `MATCH` and `RETURN` queries using backslash command

Open kenwoon opened this issue 2 years ago • 0 comments

Changes

MATCH, WHERE, WITH, and RETURN queries are made able to be parsed.

  • Modified tokens in 'cypher.l'
  • Modified grammars in 'cypher.y' grammars
  • Created headers, objects, and executables by making Makefile

Instructions

  1. Have Posgres 15 installed
  2. Create a database and start the pgsql server
  3. From the age repo directory, run the following lines of code
export PATH={location of pgsql-15}/bin:$PATH
export PGDATA={location of pgsql-15}/bin/data
export USE_PGXS=TRUE
flex -b -Cfe -p -p -o 'cypher.c' cypher.l
bison -d cypher.y
make
  1. Run ./agesql
  2. Enter a backslash \ followed by a newline to start typing in Cypher query
  3. End each Cypher query with a semicolon ;

Example

MATCH (n:Person {age: 22}) RETURN n.name AS name; should return:

match = true
node {
	alias = n
	labels = Person
	property {
		identifier = age
		expression = 22
	}
}

return = true
item {
	expression = n.name
	alias = name
}

where = false

with = false

kenwoon avatar May 10 '23 21:05 kenwoon