Skip to content

Commit

Permalink
fixes #273
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Jul 6, 2018
1 parent 12b4a1e commit 6cd5481
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Also I would like to know about needed examples or documentation stuff.

## Extensions in the latest SNAPSHOT version 1.3

* support for special oracle type syntax **varchar2(255 BYTE)** (issue #273)
* introduced dotted multipart names for uservariables (issue #608)
* changed behaviour of dotted multipart names for tables and columns to accept ORM class names (issue #163)
** the parser allows now empty inner names, to still accept missing schema names for SQLServer (db..col)
Expand Down
7 changes: 4 additions & 3 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
| <K_CAST:"CAST">
| <K_CHARACTER:"CHARACTER">
| <K_CHECK:"CHECK">
| <K_CHAR:"CHAR">
| <K_COLUMN:"COLUMN">
| <K_COMMIT:"COMMIT">
| <K_CONNECT:"CONNECT">
Expand Down Expand Up @@ -967,7 +968,7 @@ Not all names should be allowed for aliases.
String RelObjectNameWithoutValue() :
{ Token tk = null; }
{
(tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER> | tk=<K_BYTE>
(tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER> | tk=<K_BYTE> | <K_CHAR>
| tk=<K_CAST> | tk=<K_DO> | tk=<K_EXTRACT> | tk=<K_FIRST> | tk=<K_FOLLOWING>
| tk=<K_LAST> | tk=<K_MATERIALIZED> | tk=<K_NULLS> | tk=<K_PARTITION> | tk=<K_RANGE>
| tk=<K_ROW> | tk=<K_ROWS> | tk=<K_SIBLINGS> | tk=<K_XML>
Expand Down Expand Up @@ -3220,12 +3221,12 @@ ColDataType ColDataType():
(
(tk=<K_CHARACTER> | tk=<K_BIT>) [tk2=<K_VARYING>] { colDataType.setDataType(tk.image + (tk2!=null?" " + tk2.image:"")); }
| tk=<K_DOUBLE> [LOOKAHEAD(2) tk2=<K_PRECISION>] { colDataType.setDataType(tk.image + (tk2!=null?" " + tk2.image:"")); }
| ( tk=<S_IDENTIFIER> | tk=<K_DATETIMELITERAL> | tk=<K_XML> | tk=<K_INTERVAL> | tk=<DT_ZONE> )
| ( tk=<S_IDENTIFIER> | tk=<K_DATETIMELITERAL> | tk=<K_XML> | tk=<K_INTERVAL> | tk=<DT_ZONE> | tk=<K_CHAR> )
{ colDataType.setDataType(tk.image); }
| tk=<K_UNSIGNED> tk2=<S_IDENTIFIER> {colDataType.setDataType(tk.image + " " + tk2.image);}
)

[LOOKAHEAD(2) "(" {tk2 =null;} ( (tk=<S_LONG> [ tk2=<K_BYTE> ] | tk=<S_CHAR_LITERAL> | tk=<S_IDENTIFIER> )
[LOOKAHEAD(2) "(" {tk2 =null;} ( (tk=<S_LONG> [ tk2=<K_BYTE> | tk2=<K_CHAR> ] | tk=<S_CHAR_LITERAL> | tk=<S_IDENTIFIER> )
{ argumentsStringList.add(tk.image + (tk2!=null?" " + tk2.image:"")); } ["," {/*argumentsStringList.add(",");*/}] )* ")"]
[( "[" {tk=null;} [ tk=<S_LONG> ] { array.add(tk!=null?Integer.valueOf(tk.image):null); } "]" )+ { colDataType.setArrayData(array); } ]
[<K_CHARACTER> <K_SET> tk=<S_IDENTIFIER> { colDataType.setCharacterSet(tk.image); } ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ public void testKeySyntaxWithLengthColumnParameter() throws JSQLParserException
public void testIssue273Varchar2Byte() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("CREATE TABLE IF NOT EXISTS \"TABLE_OK\" (\"SOME_FIELD\" VARCHAR2 (256 BYTE))");
}

public void testIssue273Varchar2Char() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("CREATE TABLE IF NOT EXISTS \"TABLE_OK\" (\"SOME_FIELD\" VARCHAR2 (256 CHAR))");
}

public void testRUBiSCreateList() throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(CreateTableTest.class.
Expand Down

0 comments on commit 6cd5481

Please sign in to comment.