Cancelled

ANTLR parser for SQL-like grammar, in java ,antlrworks2

BID ONLY IF YOU HAVE EXPERIENCE IN ANTLR ,ANTLRWORKS2 and JAVA

I want a query parser engine .Consider this example

SELECT [url removed, login to view], COUNT ([url removed, login to view]) AS NumberOfOrders FROM Orders

INNER JOIN Employees

ON Orders.EmployeeID=[url removed, login to view]

WHERE LastName='Davolio' OR LastName='Fuller'

GROUP BY LastName

HAVING COUNT ([url removed, login to view]) > 25;

I want to parse this select statement and retrieve this elements by calling methods.

For example

getStatement() -> “select”

getColumn() -> [[url removed, login to view], COUNT ([url removed, login to view])]

getColumnAliase() ->[null, NumberOfOrders]

getJoin() -> [Orders INNER JOIN Employees]

getJoinCondition() -> [ON Orders.EmployeeID=[url removed, login to view]]

getWhere() -> [OR]

getOr() -> [LastName='Davolio', LastName='Fuller']

getGroupBy() -> [LastName]

getHaving() -> [COUNT ([url removed, login to view]) > 25]

The parser engine should support select , insert , delete and update only.

Use antlr 4.1 and antlrworks2.

Avoid using pakages and comments a few word on the coding

See the syntaxes below

1.0 SELECT STATEMENT

SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]

* | expression [ [ AS ] output_name ] [, ...]

[ FROM from_item [, ...] ]

[ WHERE condition ]

[ GROUP BY expression [, ...] ]

[ HAVING condition [, ...] ]

[ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ]

where from_item can be one of:

[ ONLY ] table_name [ * ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ]

( select )-> i.e a sub query [ AS ] alias [ ( column_alias [, ...] ) ]

from_item [ NATURAL ] join_type from_item [ ON join_condition | USING ( join_column [, ...] ) ]

METHODS:

getStatement() -> return first token i.e select

getColumn() -> return all field name or * found after select

getArithmeticOperator -> return arithmetic operator

getColumnAliase()-> return aliase from table

getFrom () -> return all table name along with aliases

getJoin() -> return all join found in the from_item

getJoinCondition() -> return all the conditions of join

getTableAliase()

getWhere() -> return all conditions i.e and , or , like

getAnd() -> return the 2 conditions found between and condition

getOr() -> return the 2 condition lies between or

getLike()

getBetween()

getSubSelect() -> return sub select statement

getGroupBy()

getHaving()

ALL THE METHODS ABOVE SHOULD RETURN AS AN ARRAY OF STRING EXCEPT THE getSubSelect() , which should return as string which contain the subselect string that can parse again.

2.0 INSERT STATEMENT

INSERT INTO table_name [ ( column_name [, ...] ) ]

{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }

REFER TO SELECT STATEMENT TO KNOW RETURN VALUE

getStatement() -> return first token i.e insert

getTableName()

getFieldName()

getSubSelect()

3.0 DELETE STATEMENT

DELETE FROM [ ONLY ] table_name [ * ] [ [ AS ] alias ]

[ WHERE condition]

REFER TO SELECT STATEMENT TO KNOW RETURN VALUE

getStatement() -> return first token i.e delete

getTableName() -> table name

getWhere() -> return all conditions i.e and , or , like

getAnd() -> return the 2 conditions found between and condition

getOr() -> return the 2 condition lies between or

getLike()

getBetween()

4.0 UPDATE STATEMENT

UPDATE [ ONLY ] table_name [ * ] [ [ AS ] alias ]

SET { column_name = { expression | DEFAULT } |

( column_name [, ...] ) = ( { expression | DEFAULT } [, ...] ) } [, ...]

[ FROM from_list ]

[ WHERE condition]

REFER TO SELECT STATEMENT TO KNOW RETURN VALUE

getStatement() -> return first token i.e update

getTableName() -> table name

getWhere() -> return all conditions i.e and , or , like

getAnd() -> return the 2 conditions found between and condition

getOr() -> return the 2 condition lies between or

getLike()

getBetween()

getSubSelect()

Skills: Java, SQL

See more: antlr sql grammar, antlrworks2, java antlr sql, where can i found employees, coding in java, sql support, Java SQL, parse expression, sql retrieve table, parser java string, java group, java sql parser, antlr sql parser java, sql parser table, update insert sql, sql parser, sql select select, parse array, antlr select, antlr select statement grammar, expression parser, update field sql field field, sql select order, java count, insert sql

About the Employer:
( 4 reviews ) llllkkk, Mauritius

Project ID: #5134991

3 freelancers are bidding on average $481 for this job

AlejandroCuba

Hello, ready to start. I had made some simple parser before in Java, for Tiger Language. I can deliver you the parser in approx 30 days. We can check details as project goes on. Best Regards

$666 USD in 30 days
(1 Review)
1.4
danielaraujo

Ainda não foi fornecida uma proposta

$333 USD in 40 days
(0 Reviews)
0.0
Cybermancer

Bis jetzt wurde noch kein Vorschlag eingegeben

$444 USD in 20 days
(0 Reviews)
0.0