vorax 0.1.0pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/.rspec +1 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +30 -0
- data/lib/vorax/base_funnel.rb +30 -0
- data/lib/vorax/output/html_convertor.rb +120 -0
- data/lib/vorax/output/html_funnel.rb +79 -0
- data/lib/vorax/output/pagezip_convertor.rb +20 -0
- data/lib/vorax/output/tablezip_convertor.rb +22 -0
- data/lib/vorax/output/vertical_convertor.rb +53 -0
- data/lib/vorax/output/zip_convertor.rb +117 -0
- data/lib/vorax/parser/argument.rb~ +125 -0
- data/lib/vorax/parser/body_split.rb +168 -0
- data/lib/vorax/parser/conn_string.rb +104 -0
- data/lib/vorax/parser/grammars/alias.rb +912 -0
- data/lib/vorax/parser/grammars/alias.rl +146 -0
- data/lib/vorax/parser/grammars/column.rb +454 -0
- data/lib/vorax/parser/grammars/column.rl +64 -0
- data/lib/vorax/parser/grammars/common.rl +98 -0
- data/lib/vorax/parser/grammars/package_spec.rb +1186 -0
- data/lib/vorax/parser/grammars/package_spec.rl +78 -0
- data/lib/vorax/parser/grammars/plsql_def.rb +469 -0
- data/lib/vorax/parser/grammars/plsql_def.rl +59 -0
- data/lib/vorax/parser/grammars/statement.rb +925 -0
- data/lib/vorax/parser/grammars/statement.rl +83 -0
- data/lib/vorax/parser/parser.rb +320 -0
- data/lib/vorax/parser/plsql_structure.rb +158 -0
- data/lib/vorax/parser/plsql_walker.rb +143 -0
- data/lib/vorax/parser/statement_inspector.rb~ +52 -0
- data/lib/vorax/parser/stmt_inspector.rb +78 -0
- data/lib/vorax/parser/target_ref.rb +110 -0
- data/lib/vorax/sqlplus.rb +281 -0
- data/lib/vorax/version.rb +7 -0
- data/lib/vorax/vorax_io.rb +70 -0
- data/lib/vorax.rb +60 -0
- data/spec/column_spec.rb +40 -0
- data/spec/conn_string_spec.rb +53 -0
- data/spec/package_spec_spec.rb +48 -0
- data/spec/pagezip_spec.rb +153 -0
- data/spec/parser_spec.rb +299 -0
- data/spec/plsql_structure_spec.rb +44 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/sql/create_objects.sql +69 -0
- data/spec/sql/dbms_crypto.spc +339 -0
- data/spec/sql/dbms_crypto.~spc +339 -0
- data/spec/sql/dbms_stats.spc +4097 -0
- data/spec/sql/drop_user.sql +10 -0
- data/spec/sql/muci.spc +24 -0
- data/spec/sql/setup_user.sql +22 -0
- data/spec/sql/test.pkg +67 -0
- data/spec/sqlplus_spec.rb +52 -0
- data/spec/stmt_inspector_spec.rb +84 -0
- data/spec/tablezip_spec.rb +111 -0
- data/spec/vertical_spec.rb +150 -0
- data/vorax.gemspec +21 -0
- metadata +139 -0
data/spec/sql/muci.spc
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
create or replace package muci as
|
2
|
+
|
3
|
+
MY_CONSTANT1 constant varchar2(100) := 'abc';
|
4
|
+
MY_CONSTANT2 constant integer := 10;
|
5
|
+
|
6
|
+
ex_no_data_found exception;
|
7
|
+
pragma exception_init(ex_no_data_found, -20000);
|
8
|
+
|
9
|
+
ex_custom exception;
|
10
|
+
pragma exception_init(ex_custom, -20001);
|
11
|
+
|
12
|
+
cursor my_cursor is
|
13
|
+
select * from user_tables;
|
14
|
+
|
15
|
+
type population_type is table of varchar2(100);
|
16
|
+
|
17
|
+
g_var1 integer;
|
18
|
+
g_var2 varchar2(100) := 'xyz';
|
19
|
+
|
20
|
+
procedure my_proc(p1 integer);
|
21
|
+
function my_func(param1 varchar2, param2 boolean := true) return boolean;
|
22
|
+
|
23
|
+
end;
|
24
|
+
/
|
@@ -0,0 +1,22 @@
|
|
1
|
+
set verify off
|
2
|
+
set feedback off
|
3
|
+
|
4
|
+
prompt Create VORAX_TEST user
|
5
|
+
|
6
|
+
grant create session,
|
7
|
+
create table,
|
8
|
+
create view,
|
9
|
+
create sequence,
|
10
|
+
create procedure,
|
11
|
+
create type,
|
12
|
+
create synonym,
|
13
|
+
unlimited tablespace
|
14
|
+
to vorax_test identified by xxx;
|
15
|
+
|
16
|
+
grant select on v_$sesstat to vorax_test;
|
17
|
+
grant select on v_$statname to vorax_test;
|
18
|
+
grant select on v_$mystat to vorax_test;
|
19
|
+
|
20
|
+
prompt Done.
|
21
|
+
|
22
|
+
quit
|
data/spec/sql/test.pkg
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
create or replace package test as
|
2
|
+
|
3
|
+
g_var varchar2(100);
|
4
|
+
|
5
|
+
procedure test(p1 integer);
|
6
|
+
function muci(x varchar2, y clob) return boolean;
|
7
|
+
|
8
|
+
end test;
|
9
|
+
/
|
10
|
+
|
11
|
+
create or replace package body test as
|
12
|
+
|
13
|
+
lg_var_private varchar2(100);
|
14
|
+
|
15
|
+
procedure private_proc(p integer) as
|
16
|
+
|
17
|
+
l_var varchar2(100);
|
18
|
+
|
19
|
+
/* local function */
|
20
|
+
funzcction abc return boolean as
|
21
|
+
begin
|
22
|
+
return true;
|
23
|
+
end;
|
24
|
+
|
25
|
+
procedure xyz as
|
26
|
+
begin
|
27
|
+
null;
|
28
|
+
end;
|
29
|
+
|
30
|
+
begin
|
31
|
+
l_var := 'abc';
|
32
|
+
for x in (select * from dual) loop
|
33
|
+
null;
|
34
|
+
end loop;
|
35
|
+
select dummy into l_var from dual;
|
36
|
+
if l_var is not null then
|
37
|
+
dbms_output.put_line('yessss baby!');
|
38
|
+
end if;
|
39
|
+
dbms_output.put_line('a loop is following');
|
40
|
+
loop
|
41
|
+
exit when l_var = 'X';
|
42
|
+
dbms_output.put_line('should not be here');
|
43
|
+
end loop;
|
44
|
+
dbms_output.put_line('that''s all folks!');
|
45
|
+
end;
|
46
|
+
|
47
|
+
procedure test(p1 integer) as
|
48
|
+
begin
|
49
|
+
dbms_output.put_line('just a test');
|
50
|
+
begin
|
51
|
+
null;
|
52
|
+
exception
|
53
|
+
when others then
|
54
|
+
null;
|
55
|
+
end;
|
56
|
+
end;
|
57
|
+
|
58
|
+
function muci(x varchar2, y clob) return boolean as
|
59
|
+
begin
|
60
|
+
return false;
|
61
|
+
end;
|
62
|
+
|
63
|
+
begin
|
64
|
+
g_var := 'test';
|
65
|
+
end test;
|
66
|
+
/
|
67
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
include Vorax
|
4
|
+
|
5
|
+
describe 'sqlplus' do
|
6
|
+
|
7
|
+
before(:each) do# {{{
|
8
|
+
@sp = Sqlplus.new('sqlplus')
|
9
|
+
@prep = [VORAX_CSTR,
|
10
|
+
"set tab off",
|
11
|
+
"set linesize 10000",
|
12
|
+
"set echo off",
|
13
|
+
"set pause off",
|
14
|
+
"set define &",
|
15
|
+
"set termout on",
|
16
|
+
"set verify off",
|
17
|
+
"set pagesize 4"].join("\n")
|
18
|
+
@result = ""
|
19
|
+
end# }}}
|
20
|
+
|
21
|
+
it 'should work with utf8' do# {{{
|
22
|
+
@sp.exec('select name from employees where id=1;', :prep => @prep + "\ncolumn name format a20")
|
23
|
+
@result << @sp.read_output(32767) while @sp.busy?
|
24
|
+
expected = "
|
25
|
+
SQL>
|
26
|
+
NAME
|
27
|
+
--------------------
|
28
|
+
Tică Șerban
|
29
|
+
|
30
|
+
SQL> "
|
31
|
+
@result.should eq(expected)
|
32
|
+
end# }}}
|
33
|
+
|
34
|
+
it 'should work with substitution variables' do# {{{
|
35
|
+
begin
|
36
|
+
pack_file = Tempfile.new(['vorax', '.sql'])
|
37
|
+
@sp.exec("accept var prompt \"Enter var: \"\nprompt &var", :prep => @prep, :pack_file => pack_file.path)
|
38
|
+
Timeout::timeout(10) {
|
39
|
+
@result << @sp.read_output(32767) while @result !~ /Enter var: \z/
|
40
|
+
@sp.send_text("muci\n")
|
41
|
+
@result << @sp.read_output(32767) while @result !~ /muci\n\z/
|
42
|
+
}
|
43
|
+
ensure
|
44
|
+
pack_file.unlink
|
45
|
+
end
|
46
|
+
end# }}}
|
47
|
+
|
48
|
+
after(:each) do# {{{
|
49
|
+
@sp.terminate
|
50
|
+
end# }}}
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
include Vorax
|
4
|
+
include Parser
|
5
|
+
|
6
|
+
describe 'stmt_inspector' do
|
7
|
+
|
8
|
+
it 'should work with a complex query' do# {{{
|
9
|
+
text = '
|
10
|
+
with
|
11
|
+
tab as (select * from dba_users),
|
12
|
+
t2 as (select * from v$session)
|
13
|
+
select d.*, c.table_name
|
14
|
+
from sys.dual d inner join
|
15
|
+
(select c. from cat c) c on (d.c = c.c) outer join
|
16
|
+
dba_tables on (x=y)
|
17
|
+
union
|
18
|
+
select t.*, x
|
19
|
+
from muci t, buci
|
20
|
+
where 1=2;
|
21
|
+
'
|
22
|
+
#puts text
|
23
|
+
inspector = StmtInspector.new(text)
|
24
|
+
#pp inspector.data_source
|
25
|
+
inspector.data_source.size.should == 7
|
26
|
+
inspector.data_source.should include(ExprRef.new("select * from dba_users", (29..51), "tab"))
|
27
|
+
inspector.data_source.should include(ExprRef.new("select * from v$session", (71..93), "t2"))
|
28
|
+
inspector.data_source.should include(TableRef.new("sys.dual", "d"));
|
29
|
+
inspector.data_source.should include(ExprRef.new("select c. from cat c", (179..198), 'c'));
|
30
|
+
inspector.data_source.should include(TableRef.new("dba_tables", nil));
|
31
|
+
inspector.data_source.should include(TableRef.new("muci", "t"));
|
32
|
+
inspector.data_source.should include(TableRef.new("buci", nil));
|
33
|
+
inspector.query_fields.should eq(["d.*", "c.table_name"])
|
34
|
+
end# }}}
|
35
|
+
|
36
|
+
it 'should get alias on an inner context' do# {{{
|
37
|
+
text = '
|
38
|
+
with
|
39
|
+
tab as (select * from dba_users),
|
40
|
+
t2 as (select * from v$session)
|
41
|
+
select d.*, c.table_name
|
42
|
+
from sys.dual d inner join
|
43
|
+
(select * from (select * from cat) c) c on (d.c = c.c) outer join
|
44
|
+
dba_tables on (x=y)
|
45
|
+
union
|
46
|
+
select t.*, x
|
47
|
+
from muci t, buci
|
48
|
+
where 1=2;
|
49
|
+
'
|
50
|
+
inspector = StmtInspector.new(text)
|
51
|
+
ds = inspector.data_source(186);
|
52
|
+
ds.size.should == 8
|
53
|
+
ds.should include(ExprRef.new("select * from cat", (15..31), "c"))
|
54
|
+
ds.should include(ExprRef.new("select * from dba_users", (29..51), "tab"))
|
55
|
+
ds.should include(ExprRef.new("select * from v$session", (71..93), "t2"))
|
56
|
+
ds.should include(TableRef.new("sys.dual", "d"));
|
57
|
+
ds.should include(ExprRef.new("select * from (select * from cat) c", (179..213), 'c'));
|
58
|
+
ds.should include(TableRef.new("dba_tables", nil));
|
59
|
+
ds.should include(TableRef.new("muci", "t"));
|
60
|
+
ds.should include(TableRef.new("buci", nil));
|
61
|
+
end# }}}
|
62
|
+
|
63
|
+
it 'should get columns for the provided alias' do# {{{
|
64
|
+
text = '
|
65
|
+
with
|
66
|
+
tab as (select * from (select user_id, user_name, password, x.* from dba_users, (select c1, c2, from dual) x)),
|
67
|
+
t2 as (select * from v$session)
|
68
|
+
select d.*, c.table_name
|
69
|
+
from sys.dual d inner join
|
70
|
+
(select * from (select * from cat) c) c on (d.c = c.c) outer join
|
71
|
+
dba_tables on (x=y)
|
72
|
+
union
|
73
|
+
select t.*, x.*
|
74
|
+
from muci t, buci x
|
75
|
+
where 1=2;
|
76
|
+
'
|
77
|
+
inspector = StmtInspector.new(text)
|
78
|
+
inspector.find_alias('x', 0).columns.should eq(["buci.*"])
|
79
|
+
inspector.find_alias('x', 63).columns.should eq(["c1", "c2"])
|
80
|
+
inspector.find_alias('tab', 0).columns.should eq(["user_id", "user_name", "password", "c1", "c2"])
|
81
|
+
end# }}}
|
82
|
+
|
83
|
+
end
|
84
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
include Vorax
|
4
|
+
|
5
|
+
describe 'tablezip layout' do
|
6
|
+
|
7
|
+
before(:each) do# {{{
|
8
|
+
@sp = Sqlplus.new('sqlplus')
|
9
|
+
@sp.default_convertor = :tablezip
|
10
|
+
@prep = [VORAX_CSTR,
|
11
|
+
"set tab off",
|
12
|
+
"set linesize 10000",
|
13
|
+
"set markup html on",
|
14
|
+
"set echo off",
|
15
|
+
"set pause off",
|
16
|
+
"set define &",
|
17
|
+
"set termout on",
|
18
|
+
"set verify off",
|
19
|
+
"set pagesize 4"].join("\n")
|
20
|
+
@result = ""
|
21
|
+
end# }}}
|
22
|
+
|
23
|
+
it 'should work with multiple statements' do# {{{
|
24
|
+
@sp.exec("select * from dual;\nselect * from departments where id <= 2;", :prep => @prep)
|
25
|
+
@result << @sp.read_output(32767) while @sp.busy?
|
26
|
+
expected = <<OUTPUT
|
27
|
+
|
28
|
+
SQL>
|
29
|
+
|
30
|
+
DUM
|
31
|
+
---
|
32
|
+
X
|
33
|
+
|
34
|
+
SQL>
|
35
|
+
|
36
|
+
ID NAME DESCRIPTION
|
37
|
+
-- ----------- -----------------------------------
|
38
|
+
1 Bookkeeping This department is responsible for:
|
39
|
+
- financial reporting
|
40
|
+
- analysis
|
41
|
+
- other boring tasks
|
42
|
+
2 Marketing
|
43
|
+
|
44
|
+
SQL>
|
45
|
+
OUTPUT
|
46
|
+
#puts @result
|
47
|
+
@result.should eq(expected)
|
48
|
+
end# }}}
|
49
|
+
|
50
|
+
it 'should work with multi line records' do# {{{
|
51
|
+
@sp.exec("select * from departments where id <= 10;", :prep => @prep)
|
52
|
+
@result << @sp.read_output(32767) while @sp.busy?
|
53
|
+
expected = <<OUTPUT
|
54
|
+
|
55
|
+
SQL>
|
56
|
+
|
57
|
+
ID NAME DESCRIPTION
|
58
|
+
-- ---------------- -----------------------------------
|
59
|
+
1 Bookkeeping This department is responsible for:
|
60
|
+
- financial reporting
|
61
|
+
- analysis
|
62
|
+
- other boring tasks
|
63
|
+
2 Marketing
|
64
|
+
3 Deliveries
|
65
|
+
4 CRM
|
66
|
+
|
67
|
+
ID NAME DESCRIPTION
|
68
|
+
-- ---------------- -----------------------------------
|
69
|
+
5 Legal Stuff
|
70
|
+
6 Management The bad guys department
|
71
|
+
7 Cooking
|
72
|
+
8 Public Relations
|
73
|
+
|
74
|
+
ID NAME DESCRIPTION
|
75
|
+
-- ---------------- -----------------------------------
|
76
|
+
9 Aquisitions
|
77
|
+
10 Cleaning
|
78
|
+
|
79
|
+
10 rows selected.
|
80
|
+
|
81
|
+
SQL>
|
82
|
+
OUTPUT
|
83
|
+
@result.should eq(expected)
|
84
|
+
end# }}}
|
85
|
+
|
86
|
+
it 'should work with accept prompts' do# {{{
|
87
|
+
begin
|
88
|
+
pack_file = Tempfile.new(['vorax', '.sql'])
|
89
|
+
@sp.exec("accept var prompt \"Enter var: \"\nprompt &var", :prep => @prep, :pack_file => pack_file.path)
|
90
|
+
Timeout::timeout(10) {
|
91
|
+
@result << @sp.read_output(32767) while @result !~ /Enter var:\z/
|
92
|
+
@sp.send_text("muci\n")
|
93
|
+
@result << @sp.read_output(32767) while @result !~ /muci\n\z/
|
94
|
+
}
|
95
|
+
ensure
|
96
|
+
pack_file.unlink
|
97
|
+
end
|
98
|
+
end# }}}
|
99
|
+
|
100
|
+
it 'should work with <pre> tags' do# {{{
|
101
|
+
@sp.exec("set autotrace traceonly explain\nselect * from dual;", :prep => @prep)
|
102
|
+
@result << @sp.read_output(32767) while @sp.busy?
|
103
|
+
@result.should match(/SELECT STATEMENT/)
|
104
|
+
end# }}}
|
105
|
+
|
106
|
+
after(:each) do# {{{
|
107
|
+
@sp.terminate
|
108
|
+
end# }}}
|
109
|
+
|
110
|
+
end
|
111
|
+
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
include Vorax
|
4
|
+
|
5
|
+
describe 'vertical layout' do
|
6
|
+
|
7
|
+
before(:each) do# {{{
|
8
|
+
@sp = Sqlplus.new('sqlplus')
|
9
|
+
@sp.default_convertor = :vertical
|
10
|
+
@prep = [VORAX_CSTR,
|
11
|
+
"set tab off",
|
12
|
+
"set linesize 10000",
|
13
|
+
"set markup html on",
|
14
|
+
"set echo off",
|
15
|
+
"set pause off",
|
16
|
+
"set define &",
|
17
|
+
"set termout on",
|
18
|
+
"set verify off",
|
19
|
+
"set pagesize 4"].join("\n")
|
20
|
+
@result = ""
|
21
|
+
end# }}}
|
22
|
+
|
23
|
+
it 'should work with pagesize=0' do# {{{
|
24
|
+
@sp.exec("select * from departments where id<=3;", :prep => @prep + "\nset pagesize 0")
|
25
|
+
@result << @sp.read_output(32767) while @sp.busy?
|
26
|
+
expected = <<OUTPUT
|
27
|
+
|
28
|
+
SQL>
|
29
|
+
|
30
|
+
: 1
|
31
|
+
: Bookkeeping
|
32
|
+
: This department is responsible for:
|
33
|
+
- financial reporting
|
34
|
+
- analysis
|
35
|
+
- other boring tasks
|
36
|
+
------------------------------------------------------------
|
37
|
+
: 2
|
38
|
+
: Marketing
|
39
|
+
:
|
40
|
+
------------------------------------------------------------
|
41
|
+
: 3
|
42
|
+
: Deliveries
|
43
|
+
:
|
44
|
+
------------------------------------------------------------
|
45
|
+
|
46
|
+
SQL>
|
47
|
+
OUTPUT
|
48
|
+
@result.should eq(expected)
|
49
|
+
end# }}}
|
50
|
+
|
51
|
+
it 'should work with unicode special chars' do# {{{
|
52
|
+
@sp.exec("select * from employees where id=1;", :prep => @prep)
|
53
|
+
@result << @sp.read_output(32767) while @sp.busy?
|
54
|
+
expected = <<OUTPUT
|
55
|
+
|
56
|
+
SQL>
|
57
|
+
|
58
|
+
ID : 1
|
59
|
+
NAME : Tică Șerban
|
60
|
+
SALARY : 570
|
61
|
+
DEPARTMENT_ID : 1
|
62
|
+
------------------------------------------------------------
|
63
|
+
|
64
|
+
SQL>
|
65
|
+
OUTPUT
|
66
|
+
#puts @result
|
67
|
+
@result.should eq(expected)
|
68
|
+
end# }}}
|
69
|
+
|
70
|
+
it 'should work with one single line record' do# {{{
|
71
|
+
@sp.exec("select * from departments where id=2;", :prep => @prep)
|
72
|
+
@result << @sp.read_output(32767) while @sp.busy?
|
73
|
+
expected = <<OUTPUT
|
74
|
+
|
75
|
+
SQL>
|
76
|
+
|
77
|
+
ID : 2
|
78
|
+
NAME : Marketing
|
79
|
+
DESCRIPTION :
|
80
|
+
------------------------------------------------------------
|
81
|
+
|
82
|
+
SQL>
|
83
|
+
OUTPUT
|
84
|
+
@result.should eq(expected)
|
85
|
+
end# }}}
|
86
|
+
|
87
|
+
it 'should work with one multiline record' do# {{{
|
88
|
+
@sp.exec("select * from departments where id=1;", :prep => @prep)
|
89
|
+
@result << @sp.read_output(32767) while @sp.busy?
|
90
|
+
expected = <<OUTPUT
|
91
|
+
|
92
|
+
SQL>
|
93
|
+
|
94
|
+
ID : 1
|
95
|
+
NAME : Bookkeeping
|
96
|
+
DESCRIPTION : This department is responsible for:
|
97
|
+
- financial reporting
|
98
|
+
- analysis
|
99
|
+
- other boring tasks
|
100
|
+
------------------------------------------------------------
|
101
|
+
|
102
|
+
SQL>
|
103
|
+
OUTPUT
|
104
|
+
@result.should eq(expected)
|
105
|
+
end# }}}
|
106
|
+
|
107
|
+
it 'should work with multiple lines' do# {{{
|
108
|
+
@sp.exec("select * from departments where id in (1, 2);", :prep => @prep)
|
109
|
+
@result << @sp.read_output(32767) while @sp.busy?
|
110
|
+
expected = <<OUTPUT
|
111
|
+
|
112
|
+
SQL>
|
113
|
+
|
114
|
+
ID : 1
|
115
|
+
NAME : Bookkeeping
|
116
|
+
DESCRIPTION : This department is responsible for:
|
117
|
+
- financial reporting
|
118
|
+
- analysis
|
119
|
+
- other boring tasks
|
120
|
+
------------------------------------------------------------
|
121
|
+
ID : 2
|
122
|
+
NAME : Marketing
|
123
|
+
DESCRIPTION :
|
124
|
+
------------------------------------------------------------
|
125
|
+
|
126
|
+
SQL>
|
127
|
+
OUTPUT
|
128
|
+
@result.should eq(expected)
|
129
|
+
end# }}}
|
130
|
+
|
131
|
+
it 'should work with accept prompts' do# {{{
|
132
|
+
begin
|
133
|
+
pack_file = Tempfile.new(['vorax', '.sql'])
|
134
|
+
@sp.exec("accept var prompt \"Enter var: \"\nprompt &var", :prep => @prep, :pack_file => pack_file.path)
|
135
|
+
Timeout::timeout(10) {
|
136
|
+
@result << @sp.read_output(32767) while @result !~ /Enter var:\z/
|
137
|
+
@sp.send_text("muci\n")
|
138
|
+
@result << @sp.read_output(32767) while @result !~ /muci\n\z/
|
139
|
+
}
|
140
|
+
ensure
|
141
|
+
pack_file.unlink
|
142
|
+
end
|
143
|
+
end# }}}
|
144
|
+
|
145
|
+
after(:each) do# {{{
|
146
|
+
@sp.terminate
|
147
|
+
end# }}}
|
148
|
+
|
149
|
+
end
|
150
|
+
|
data/vorax.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vorax/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "vorax"
|
8
|
+
gem.version = Vorax::VERSION
|
9
|
+
gem.authors = ["Alexandru Tica"]
|
10
|
+
gem.email = ["alexandru.tica@gmail.com"]
|
11
|
+
gem.description = %q{Provides the logic required by Vorax, an Oracle IDE for geeks. Even the main goal of this gem is to support Vorax, it can also be used as it is to interact with a hidden SqlPLUS process or to parse SQL/PLSQL code.}
|
12
|
+
gem.summary = %q{Vorax ruby code companion.}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_development_dependency "rspec", "~> 2.6"
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vorax
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0pre
|
5
|
+
prerelease: 5
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alexandru Tica
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.6'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.6'
|
30
|
+
description: Provides the logic required by Vorax, an Oracle IDE for geeks. Even the
|
31
|
+
main goal of this gem is to support Vorax, it can also be used as it is to interact
|
32
|
+
with a hidden SqlPLUS process or to parse SQL/PLSQL code.
|
33
|
+
email:
|
34
|
+
- alexandru.tica@gmail.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- .gitignore
|
40
|
+
- .rspec
|
41
|
+
- LICENSE.txt
|
42
|
+
- README.md
|
43
|
+
- Rakefile
|
44
|
+
- lib/vorax.rb
|
45
|
+
- lib/vorax/base_funnel.rb
|
46
|
+
- lib/vorax/output/html_convertor.rb
|
47
|
+
- lib/vorax/output/html_funnel.rb
|
48
|
+
- lib/vorax/output/pagezip_convertor.rb
|
49
|
+
- lib/vorax/output/tablezip_convertor.rb
|
50
|
+
- lib/vorax/output/vertical_convertor.rb
|
51
|
+
- lib/vorax/output/zip_convertor.rb
|
52
|
+
- lib/vorax/parser/argument.rb~
|
53
|
+
- lib/vorax/parser/body_split.rb
|
54
|
+
- lib/vorax/parser/conn_string.rb
|
55
|
+
- lib/vorax/parser/grammars/alias.rb
|
56
|
+
- lib/vorax/parser/grammars/alias.rl
|
57
|
+
- lib/vorax/parser/grammars/column.rb
|
58
|
+
- lib/vorax/parser/grammars/column.rl
|
59
|
+
- lib/vorax/parser/grammars/common.rl
|
60
|
+
- lib/vorax/parser/grammars/package_spec.rb
|
61
|
+
- lib/vorax/parser/grammars/package_spec.rl
|
62
|
+
- lib/vorax/parser/grammars/plsql_def.rb
|
63
|
+
- lib/vorax/parser/grammars/plsql_def.rl
|
64
|
+
- lib/vorax/parser/grammars/statement.rb
|
65
|
+
- lib/vorax/parser/grammars/statement.rl
|
66
|
+
- lib/vorax/parser/parser.rb
|
67
|
+
- lib/vorax/parser/plsql_structure.rb
|
68
|
+
- lib/vorax/parser/plsql_walker.rb
|
69
|
+
- lib/vorax/parser/statement_inspector.rb~
|
70
|
+
- lib/vorax/parser/stmt_inspector.rb
|
71
|
+
- lib/vorax/parser/target_ref.rb
|
72
|
+
- lib/vorax/sqlplus.rb
|
73
|
+
- lib/vorax/version.rb
|
74
|
+
- lib/vorax/vorax_io.rb
|
75
|
+
- spec/column_spec.rb
|
76
|
+
- spec/conn_string_spec.rb
|
77
|
+
- spec/package_spec_spec.rb
|
78
|
+
- spec/pagezip_spec.rb
|
79
|
+
- spec/parser_spec.rb
|
80
|
+
- spec/plsql_structure_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
- spec/sql/create_objects.sql
|
83
|
+
- spec/sql/dbms_crypto.spc
|
84
|
+
- spec/sql/dbms_crypto.~spc
|
85
|
+
- spec/sql/dbms_stats.spc
|
86
|
+
- spec/sql/drop_user.sql
|
87
|
+
- spec/sql/muci.spc
|
88
|
+
- spec/sql/setup_user.sql
|
89
|
+
- spec/sql/test.pkg
|
90
|
+
- spec/sqlplus_spec.rb
|
91
|
+
- spec/stmt_inspector_spec.rb
|
92
|
+
- spec/tablezip_spec.rb
|
93
|
+
- spec/vertical_spec.rb
|
94
|
+
- vorax.gemspec
|
95
|
+
homepage: ''
|
96
|
+
licenses: []
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>'
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.3.1
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 1.8.24
|
116
|
+
signing_key:
|
117
|
+
specification_version: 3
|
118
|
+
summary: Vorax ruby code companion.
|
119
|
+
test_files:
|
120
|
+
- spec/column_spec.rb
|
121
|
+
- spec/conn_string_spec.rb
|
122
|
+
- spec/package_spec_spec.rb
|
123
|
+
- spec/pagezip_spec.rb
|
124
|
+
- spec/parser_spec.rb
|
125
|
+
- spec/plsql_structure_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
- spec/sql/create_objects.sql
|
128
|
+
- spec/sql/dbms_crypto.spc
|
129
|
+
- spec/sql/dbms_crypto.~spc
|
130
|
+
- spec/sql/dbms_stats.spc
|
131
|
+
- spec/sql/drop_user.sql
|
132
|
+
- spec/sql/muci.spc
|
133
|
+
- spec/sql/setup_user.sql
|
134
|
+
- spec/sql/test.pkg
|
135
|
+
- spec/sqlplus_spec.rb
|
136
|
+
- spec/stmt_inspector_spec.rb
|
137
|
+
- spec/tablezip_spec.rb
|
138
|
+
- spec/vertical_spec.rb
|
139
|
+
has_rdoc:
|