Skip to content

Commit

Permalink
Version 4.6.1. (#170)
Browse files Browse the repository at this point in the history
Former-commit-id: 900dff239e2fe452a26fd3ff7e1607581982e324
  • Loading branch information
walter-weinmann authored and c-bik committed Apr 11, 2019
1 parent a0e29ec commit e84bea2
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![GitHub](https://img.shields.io/github/license/K2InformaticsGmbH/sqlparse.svg)
![GitHub release](https://img.shields.io/github/release/K2InformaticsGmbH/sqlparse.svg)
![GitHub Release Date](https://img.shields.io/github/release-date/K2InformaticsGmbH/sqlparse.svg)
![GitHub commits since latest release](https://img.shields.io/github/commits-since/K2InformaticsGmbH/sqlparse/4.6.0.svg)
![GitHub commits since latest release](https://img.shields.io/github/commits-since/K2InformaticsGmbH/sqlparse/4.6.1.svg)

**sqlparse** is a production-ready SQL parser written in pure Erlang.
**sqlparse** is aligned to the Oracle SQL language and enriched with [imem](https://github.com/K2InformaticsGmbH/imem) and [JSONPath](https://github.com/K2InformaticsGmbH/jpparse) specific features.
Expand Down
2 changes: 1 addition & 1 deletion priv/bnf_converter/ParSqlparse.info.REMOVED.git-id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
471644b0110f1d68fb0a60fff44588d03901c6db
f1c099d07630eba772d9b7d8dc4d2de19299a51d
34 changes: 18 additions & 16 deletions priv/bnf_converter/sqlparse.cf
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,7 @@ ColumnRef11. ColumnRef ::= Identifier "." Identifier "." "*
-- data_type -> NUMBER : unwrap_bin('$1').
-- data_type -> RAW : unwrap_bin('$1').
-- data_type -> ROWID : unwrap_bin('$1').
-- data_type -> STRING : unwrap_bin('$1').
-- data_type -> TIMESTAMP : unwrap_bin('$1').
-- data_type -> UROWID : unwrap_bin('$1').
-- data_type -> VARCHAR2 : unwrap_bin('$1').
Expand Down Expand Up @@ -1980,22 +1981,23 @@ DataType13. DataType ::= "NCLOB"
DataType14. DataType ::= "NUMBER" ;
DataType15. DataType ::= "RAW" ;
DataType16. DataType ::= "ROWID" ;
DataType17. DataType ::= "TIMESTAMP" ;
DataType18. DataType ::= "UROWID" ;
DataType19. DataType ::= "VARCHAR2" ;
DataType20. DataType ::= "XMLTYPE" ;
DataType21. DataType ::= "CHAR" "(" SgnNum ")" ;
DataType22. DataType ::= "FLOAT" "(" SgnNum ")" ;
DataType23. DataType ::= "NAME" "(" SgnNum ")" ;
DataType24. DataType ::= "NCHAR" "(" SgnNum ")" ;
DataType25. DataType ::= "NUMBER" "(" SgnNum ")" ;
DataType26. DataType ::= "NVARCHAR2" "(" SgnNum ")" ;
DataType27. DataType ::= "RAW" "(" SgnNum ")" ;
DataType28. DataType ::= "TIMESTAMP" "(" SgnNum ")" ;
DataType29. DataType ::= "UROWID" "(" SgnNum ")" ;
DataType30. DataType ::= "VARCHAR2" "(" SgnNum ")" ;
DataType31. DataType ::= "NAME" "(" SgnNum "," SgnNum ")" ;
DataType32. DataType ::= "NUMBER" "(" SgnNum "," SgnNum ")" ;
DataType17. DataType ::= "STRING" ;
DataType18. DataType ::= "TIMESTAMP" ;
DataType19. DataType ::= "UROWID" ;
DataType20. DataType ::= "VARCHAR2" ;
DataType21. DataType ::= "XMLTYPE" ;
DataType22. DataType ::= "CHAR" "(" SgnNum ")" ;
DataType23. DataType ::= "FLOAT" "(" SgnNum ")" ;
DataType24. DataType ::= "NAME" "(" SgnNum ")" ;
DataType25. DataType ::= "NCHAR" "(" SgnNum ")" ;
DataType26. DataType ::= "NUMBER" "(" SgnNum ")" ;
DataType27. DataType ::= "NVARCHAR2" "(" SgnNum ")" ;
DataType28. DataType ::= "RAW" "(" SgnNum ")" ;
DataType29. DataType ::= "TIMESTAMP" "(" SgnNum ")" ;
DataType30. DataType ::= "UROWID" "(" SgnNum ")" ;
DataType31. DataType ::= "VARCHAR2" "(" SgnNum ")" ;
DataType32. DataType ::= "NAME" "(" SgnNum "," SgnNum ")" ;
DataType33. DataType ::= "NUMBER" "(" SgnNum "," SgnNum ")" ;

-- sgn_num -> INTNUM : unwrap_bin('$1').
-- sgn_num -> '-' INTNUM : list_to_binary(["-",unwrap_bin('$2')]).
Expand Down
3 changes: 2 additions & 1 deletion priv/railroad_diagram_generator/sqlparse.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,7 @@ data_type -> NCLOB : unwrap_bin('$1').
data_type -> NUMBER : unwrap_bin('$1').
data_type -> RAW : unwrap_bin('$1').
data_type -> ROWID : unwrap_bin('$1').
data_type -> STRING : unwrap_bin('$1').
data_type -> TIMESTAMP : unwrap_bin('$1').
data_type -> UROWID : unwrap_bin('$1').
data_type -> VARCHAR2 : unwrap_bin('$1').
Expand All @@ -2014,7 +2015,7 @@ data_type -> NAME '(' sgn_num ',' sgn_num ')' : {unwrap_bin('$1'), '$3', '$
data_type -> NUMBER '(' sgn_num ',' sgn_num ')' : {unwrap_bin('$1'), '$3', '$5'}.
============================================================================= */

data_type ::= ( BFILE | BINARY_DOUBLE | BINARY_FLOAT | BLOB | CHAR | CLOB | DATE | FLOAT | LONG | ( LONG RAW ) | ( identifier '.' )? NAME | NCLOB | NUMBER | RAW | ROWID | TIMESTAMP | UROWID | VARCHAR2 | XMLTYPE )
data_type ::= ( BFILE | BINARY_DOUBLE | BINARY_FLOAT | BLOB | CHAR | CLOB | DATE | FLOAT | LONG | ( LONG RAW ) | ( identifier '.' )? NAME | NCLOB | NUMBER | RAW | ROWID | STRING | TIMESTAMP | UROWID | VARCHAR2 | XMLTYPE )
| ( ( CHAR | FLOAT | NAME | NCHAR | NUMBER | NVARCHAR2 c| RAW | TIMESTAMP | UROWID | VARCHAR2 ) '(' sgn_num ')' )
| ( ( NAME | NUMBER ) '(' sgn_num ',' sgn_num ')' )

Expand Down
66 changes: 33 additions & 33 deletions src/sqlparse.app.src
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
%% -----------------------------------------------------------------------------
%%
%% sqlparse.app.src: SQL - tool configuration.
%%
%% Copyright (c) 2012-18 K2 Informatics GmbH. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing,
%% software distributed under the License is distributed on an
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
%% KIND, either express or implied. See the License for the
%% specific language governing permissions and limitations
%% under the License.
%%
%% -----------------------------------------------------------------------------

{application, sqlparse,
[
{description, "A LALR SQL parser and compiler"},
{vsn, "4.6.0"},
{applications, [
kernel,
stdlib,
jpparse
]},
{modules, [sqlparse]}
]}.
%% -----------------------------------------------------------------------------
%%
%% sqlparse.app.src: SQL - tool configuration.
%%
%% Copyright (c) 2012-18 K2 Informatics GmbH. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing,
%% software distributed under the License is distributed on an
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
%% KIND, either express or implied. See the License for the
%% specific language governing permissions and limitations
%% under the License.
%%
%% -----------------------------------------------------------------------------

{application, sqlparse,
[
{description, "A LALR SQL parser and compiler"},
{vsn, "4.6.1"},
{applications, [
kernel,
stdlib,
jpparse
]},
{modules, [sqlparse]}
]}.
1 change: 1 addition & 0 deletions src/sqlparse.yrl
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,7 @@ data_type -> NCLOB : unwrap_bin('$1').
data_type -> NUMBER : unwrap_bin('$1').
data_type -> RAW : unwrap_bin('$1').
data_type -> ROWID : unwrap_bin('$1').
data_type -> STRING : unwrap_bin('$1').
data_type -> TIMESTAMP : unwrap_bin('$1').
data_type -> UROWID : unwrap_bin('$1').
data_type -> VARCHAR2 : unwrap_bin('$1').
Expand Down
1 change: 1 addition & 0 deletions test/eunit.create.tst
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ create table table_1 (
)
".
"CREATE TABLE test(fld CHAR)".
"create table key_test (col1 '{atom,integer}', col2 '{string,binstr}');".

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% create_user_def
Expand Down
17 changes: 12 additions & 5 deletions test/src/sqlparse_generator.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1495,8 +1495,12 @@ create_code(cursor_def = Rule) ->
?CREATE_CODE_END;

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% data_type ::= ( BFILE | BINARY_DOUBLE | BINARY_FLOAT | BLOB | CHAR | CLOB | DATE | FLOAT | LONG | ( LONG RAW ) | ( identifier '.' )? NAME | NCLOB | NUMBER | RAW | ROWID | TIMESTAMP | UROWID | VARCHAR2 | XMLTYPE )
%% | ( ( CHAR | FLOAT | NAME | NCHAR | NUMBER | NVARCHAR2 c| RAW | TIMESTAMP | UROWID | VARCHAR2 ) '(' sgn_num ')' )
%% data_type ::= ( BFILE | BINARY_DOUBLE | BINARY_FLOAT | BLOB | CHAR | CLOB
%% | DATE | FLOAT | LONG | ( LONG RAW ) | ( identifier '.' )? NAME
%% | NCLOB | NUMBER | RAW | ROWID | STRING | TIMESTAMP | UROWID
%% | VARCHAR2 | XMLTYPE )
%% | ( ( CHAR | FLOAT | NAME | NCHAR | NUMBER | NVARCHAR2 c| RAW
%% | TIMESTAMP | UROWID | VARCHAR2 ) '(' sgn_num ')' )
%% | ( ( NAME | NUMBER ) '(' sgn_num ',' sgn_num ')' )
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Expand All @@ -1508,6 +1512,8 @@ create_code(data_type = Rule) ->
Name_Length = length(Name),
[{sgn_num, Sgn_Num}] = ets:lookup(?CODE_TEMPLATES, sgn_num),
Sgn_Num_Length = length(Sgn_Num),
[{string, String}] = ets:lookup(?CODE_TEMPLATES, string),
String_Length = length(String),

Code =
[
Expand All @@ -1530,15 +1536,16 @@ create_code(data_type = Rule) ->
"Varchar2 ",
"Xmltype "
] ++ [
case rand:uniform(4) rem 4 of
case rand:uniform(5) rem 5 of
1 -> lists:nth(rand:uniform(Name_Length), Name) ++ " ";
2 -> lists:append([
2 -> lists:nth(rand:uniform(String_Length), String) ++ " ";
3 -> lists:append([
lists:nth(rand:uniform(Identifier_Length), Identifier),
".",
lists:nth(rand:uniform(Name_Length), Name),
" "
]);
3 -> lists:append([
4 -> lists:append([
case rand:uniform(10) rem 10 of
1 -> "Char";
2 -> "Float";
Expand Down

0 comments on commit e84bea2

Please sign in to comment.