Skip to content

Commit

Permalink
use sqlparser instead of custom PEG
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-rubio committed Apr 29, 2017
1 parent f08538d commit 9ff4c06
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 1,156 deletions.
18 changes: 9 additions & 9 deletions README.md
Expand Up @@ -50,19 +50,19 @@ If you want to use, only add this in rebar.config:

### <a name="Configuration">Configuration</a> ###

For configuration you can check [configure and running](http://github.com/altenwald/myproto/blob/simply-and-rebar3/doc/config.md) entry.
For configuration you can check [configure and running](http://github.com/altenwald/myproto/blob/edown/doc/config.md) entry.


## Modules ##


<table width="100%" border="0" summary="list of modules">
<tr><td><a href="http://github.com/altenwald/myproto/blob/simply-and-rebar3/doc/gen_myproto.md" class="module">gen_myproto</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/simply-and-rebar3/doc/my_acceptor.md" class="module">my_acceptor</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/simply-and-rebar3/doc/my_datatypes.md" class="module">my_datatypes</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/simply-and-rebar3/doc/my_dummy_handler.md" class="module">my_dummy_handler</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/simply-and-rebar3/doc/my_packet.md" class="module">my_packet</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/simply-and-rebar3/doc/my_request.md" class="module">my_request</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/simply-and-rebar3/doc/my_response.md" class="module">my_response</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/simply-and-rebar3/doc/myproto_app.md" class="module">myproto_app</a></td></tr></table>
<tr><td><a href="http://github.com/altenwald/myproto/blob/edown/doc/gen_myproto.md" class="module">gen_myproto</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/edown/doc/my_acceptor.md" class="module">my_acceptor</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/edown/doc/my_datatypes.md" class="module">my_datatypes</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/edown/doc/my_dummy_handler.md" class="module">my_dummy_handler</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/edown/doc/my_packet.md" class="module">my_packet</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/edown/doc/my_request.md" class="module">my_request</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/edown/doc/my_response.md" class="module">my_response</a></td></tr>
<tr><td><a href="http://github.com/altenwald/myproto/blob/edown/doc/myproto_app.md" class="module">myproto_app</a></td></tr></table>

2 changes: 1 addition & 1 deletion include/myproto.hrl
Expand Up @@ -145,7 +145,7 @@

-define(DATA_NULL, (<<16#fb>>)).

-include("sql.hrl").
-include_lib("sqlparser/include/sql.hrl").

-record(user, {
name :: user_string(),
Expand Down
55 changes: 0 additions & 55 deletions include/sql.hrl

This file was deleted.

7 changes: 5 additions & 2 deletions rebar.config
Expand Up @@ -3,7 +3,11 @@
warnings_as_errors
]}.

{deps, [neotoma]}.
{deps, [
neotoma,
{sqlparser, ".*", {git, "https://github.com/altenwald/sqlparser",
{branch, master}}}
]}.

{cover_enabled, true}.
{cover_opts, [verbose]}.
Expand Down Expand Up @@ -31,7 +35,6 @@
{profiles, [
{test, [
{deps, [
eper,
{mysql, ".*", {git, "https://github.com/mysql-otp/mysql-otp",
{tag, "1.2.0"}}}
]}
Expand Down
6 changes: 5 additions & 1 deletion rebar.lock
@@ -1,5 +1,9 @@
{"1.1.0",
[{<<"neotoma">>,{pkg,<<"neotoma">>,<<"1.7.3">>},0}]}.
[{<<"neotoma">>,{pkg,<<"neotoma">>,<<"1.7.3">>},0},
{<<"sqlparser">>,
{git,"https://github.com/altenwald/sqlparser",
{ref,"91ab3520bcd6e5b679712f6c7e480d799c167581"}},
0}]}.
[
{pkg_hash,[
{<<"neotoma">>, <<"D8BD5404B73273989946E4F4F6D529E5C2088F5FA1CA790B4DBE81F4BE408E61">>}]}
Expand Down
2 changes: 1 addition & 1 deletion src/my_request.erl
Expand Up @@ -154,7 +154,7 @@ normal(#request{id = Id, info = Info, command = Command} = Request,
false ->
Request#request{info = FullPacket};
true ->
case mysql_proto:parse(FullPacket) of
case mysql_parser:parse(FullPacket) of
{fail,Expected} ->
?ERROR_MSG("SQL invalid: ~p~n", [Expected]),
Request#request{info = FullPacket};
Expand Down
3 changes: 2 additions & 1 deletion src/myproto.app.src
Expand Up @@ -4,7 +4,8 @@
{registered, []},
{applications, [
kernel,
stdlib
stdlib,
sqlparser
]},
{mod, {myproto_app, []}},
{env, [
Expand Down

0 comments on commit 9ff4c06

Please sign in to comment.