This project contains a collection of parboiled based parsers for SQL statements. It can be used to test SQL statements prior to running them against a database.
val statement = "some sql statement"
val rule = Oracle.parser
val runner = ReportingParseRunner(rule)
val result = runner.run(statement)
if (result.matched) {
"Valid SQL statement"
} else {
"Not a valid SQL statement"
}
val statement = "some sql statement"
val rule = Oracle.VERSION_11g.parser // Changed reference
val runner = ReportingParseRunner(rule)
val result = runner.run(statement)
assert(result.parseErrors isEmpty)
val statement = "some sql statement"
val rule = Oracle.CREATE_TABLE.parser // Changed reference
val runner = ReportingParseRunner(rule)
val result = runner.run(statement)
assert(!result.result.isEmpty)
val statement = "some sql statement"
val rule = Oracle.VERSION_11g.CREATE_TABLE.parser // Changed reference
val runner = ReportingParseRunner(rule)
val result = runner.run(statement)
assert(result.parseErrors isEmpty)
<dependency>
<groupId>com.github.sebhoss</groupId>
<artifactId>sequel-parser</artifactId>
<version>1.0.0</version>
</dependency>
libraryDependencies += "com.github.sebhoss" % "sequel-parser" % 1.0.0
Statement | Oracle 11g |
---|---|
ALTER CLUSTER | No |
ALTER DATABASE | No |
ALTER DATABASE LINK | No |
ALTER DIMENSION | No |
ALTER DISKGROUP | No |
ALTER FLASHBACK ARCHIVE | No |
ALTER FUNCTION | No |
ALTER INDEX | Yes |
ALTER INDEXTYPE | No |
ALTER JAVA | No |
ALTER LIBRARY | No |
ALTER MATERIALIZED VIEW | No |
ALTER MATERIALIZED VIEW LOG | No |
ALTER OPERATOR | No |
ALTER OUTLINE | No |
ALTER PACKAGE | No |
ALTER PROCEDURE | No |
ALTER PROFILE | No |
ALTER RESOURCE COST | No |
ALTER ROLE | No |
ALTER ROLLBACK SEGMENT | No |
ALTER SEQUENCE | No |
ALTER SESSION | No |
ALTER SYSTEM | No |
ALTER TABLE | No |
ALTER TABLESPACE | No |
ALTER TRIGGER | No |
ALTER TYPE | No |
ALTER USER | No |
ALTER VIEW | No |
ANALYZE | No |
ASSOCIATE STATISTICS | No |
AUDIT | No |
CALL | No |
COMMENT | Yes |
COMMIT | No |
CREATE CLUSTER | No |
CREATE CONTEXT | No |
CREATE CONTROLFILE | No |
CREATE DATABASE | No |
CREATE DATABASE LINK | No |
CREATE DIMENSION | No |
CREATE DIRECTORY | No |
CREATE DISKGROUP | No |
CREATE EDITION | No |
CREATE FLASHBACK ARCHIVE | No |
CREATE FUNCTION | No |
CREATE INDEX | Yes |
CREATE INDEXTYPE | No |
CREATE JAVA | No |
CREATE LIBRARY | No |
CREATE MATERIALIZED VIEW | No |
CREATE MATERIALIZED VIEW LOG | No |
CREATE OPERATOR | No |
CREATE OUTLINE | No |
CREATE PACKAGE | No |
CREATE PACKAGE BODY | No |
CREATE PFILE | No |
CREATE PROCEDURE | No |
CREATE PROFILE | No |
CREATE RESTORE POINT | No |
CREATE ROLE | No |
CREATE ROLLBACK SEGMENT | No |
CREATE SCHEMA | No |
CREATE SEQUENCE | No |
CREATE SPFILE | No |
CREATE SYNONYM | No |
CREATE TABLE | Yes |
CREATE TABLESPACE | No |
CREATE TRIGGER | No |
CREATE TYPE | No |
CREATE TYPE BODY | No |
CREATE USER | No |
CREATE VIEW | No |
DELETE | No |
DISASSOCIATE STATISTICS | No |
DROP CLUSTER | No |
DROP CONTEXT | No |
DROP DATABASE | No |
DROP DATABASE LINK | No |
DROP DIMENSION | No |
DROP DIRECTORY | No |
DROP DISKGROUP | No |
DROP EDITION | No |
DROP FLASHBACK ARCHIVE | No |
DROP FUNCTION | No |
DROP INDEX | No |
DROP INDEXTYPE | No |
DROP JAVA | No |
DROP LIBRARY | No |
DROP MATERIALIZED VIEW | No |
DROP MATERIALIZED VIEW LOG | No |
DROP OPERATOR | No |
DROP OUTLINE | No |
DROP PACKAGE | No |
DROP PROCEDURE | No |
DROP PROFILE | No |
DROP RESTORE POINT | No |
DROP ROLE | No |
DROP ROLLBACK SEGMENT | No |
DROP SEQUENCE | No |
DROP SYNONYM | No |
DROP TABLE | No |
DROP TABLESPACE | No |
DROP TRIGGER | No |
DROP TYPE | No |
DROP TYPE BODY | No |
DROP USER | No |
DROP VIEW | No |
EXPLAIN PLAN | No |
FLASHBACK DATABASE | No |
FLASHBACK TABLE | No |
GRANT | No |
INSERT | No |
LOCK TABLE | No |
MERGE | No |
NOAUDIT | No |
PURGE | No |
RENAME | No |
REVOKE | No |
ROLLBACK | No |
SAVEPOINT | No |
SELECT | Partial |
SET CONSTRAINT[S] | No |
SET ROLE | No |
SET TRANSACTION | No |
TRUNCATE CLUSTER | No |
TRUNCATE TABLE | No |
UPDATE | No |
This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
This projects uses Scala, Maven and Git as the main development tools. To build the project yourself just download & install at least Maven 3.0 and call mvn install inside the project folder. Maven should then proceed to clean, build, package and install this project.
This project follows the semantic versioning guidelines.