orasaurus 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/orasaurus +27 -1
- data/lib/orasaurus/cli.rb +17 -0
- data/lib/orasaurus/version.rb +1 -1
- data/lib/orasaurus.rb +2 -0
- data/orasaurus.gemspec +4 -4
- metadata +29 -28
- data/test/db/Notes/Packages/build.sql +0 -35
- data/test/db/Notes/Packages/pkg_note_comments.pkg +0 -164
- data/test/db/Notes/Packages/pkg_note_tags.pkg +0 -146
- data/test/db/Notes/Packages/pkg_notebooks.pkg +0 -135
- data/test/db/Notes/Packages/pkg_notes.pkg +0 -418
- data/test/db/Notes/Packages/teardown.sql +0 -36
- data/test/db/Notes/Sequences/build.sql +0 -35
- data/test/db/Notes/Sequences/note_comments_seq.sql +0 -1
- data/test/db/Notes/Sequences/note_tags_seq.sql +0 -1
- data/test/db/Notes/Sequences/notebooks_seq.sql +0 -1
- data/test/db/Notes/Sequences/notes_seq.sql +0 -1
- data/test/db/Notes/Sequences/teardown.sql +0 -36
- data/test/db/Notes/Tables/build.sql +0 -35
- data/test/db/Notes/Tables/note_comments.sql +0 -27
- data/test/db/Notes/Tables/note_tags.sql +0 -25
- data/test/db/Notes/Tables/notebooks.sql +0 -26
- data/test/db/Notes/Tables/notes.sql +0 -30
- data/test/db/Notes/Tables/teardown.sql +0 -36
- data/test/db/Rakefile +0 -75
- data/test/db/build.sql +0 -26
- data/test/db/create_test_user.sql +0 -3
- data/test/db/teardown.sql +0 -36
@@ -1,36 +0,0 @@
|
|
1
|
-
|
2
|
-
SET SERVEROUTPUT ON
|
3
|
-
SET DEFINE OFF
|
4
|
-
SPOOL teardown.log
|
5
|
-
|
6
|
-
DECLARE
|
7
|
-
CURSOR cur_drop_list
|
8
|
-
IS
|
9
|
-
SELECT *
|
10
|
-
FROM USER_OBJECTS
|
11
|
-
WHERE OBJECT_NAME IN ( 'NOTE_COMMENTS', 'NOTE_TAGS', 'NOTEBOOKS', 'NOTES' )
|
12
|
-
AND OBJECT_TYPE != 'PACKAGE BODY';
|
13
|
-
x BOOLEAN := FALSE;
|
14
|
-
BEGIN
|
15
|
-
DBMS_OUTPUT.PUT_LINE( 'starting work' );
|
16
|
-
FOR i IN cur_drop_list LOOP
|
17
|
-
x := TRUE;
|
18
|
-
BEGIN
|
19
|
-
EXECUTE IMMEDIATE 'DROP '||i.object_type||' '||i.object_name||' CASCADE CONSTRAINTS';
|
20
|
-
DBMS_OUTPUT.PUT_LINE( 'DROPPED '||i.object_name );
|
21
|
-
EXCEPTION
|
22
|
-
WHEN OTHERS THEN
|
23
|
-
DBMS_OUTPUT.PUT_LINE( 'WHILE DROPPING '||i.object_type||' '||i.object_name );
|
24
|
-
DBMS_OUTPUT.PUT_LINE( SUBSTR( SQLERRM, 1, 255 ) );
|
25
|
-
END;
|
26
|
-
END LOOP;
|
27
|
-
IF NOT x THEN
|
28
|
-
DBMS_OUTPUT.PUT_LINE( 'NOTHING FOUND TO DROP' );
|
29
|
-
END IF;
|
30
|
-
DBMS_OUTPUT.PUT_LINE( 'completed successfully' );
|
31
|
-
END;
|
32
|
-
/
|
33
|
-
|
34
|
-
EXIT
|
35
|
-
/
|
36
|
-
|
data/test/db/Rakefile
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require "oci8"
|
2
|
-
require "highline/import"
|
3
|
-
require "orasaurus"
|
4
|
-
|
5
|
-
$db_name = ""
|
6
|
-
$db_user = ""
|
7
|
-
$db_user_password = ""
|
8
|
-
|
9
|
-
def process_db_connect_params
|
10
|
-
|
11
|
-
if ENV['db_user'].nil? then
|
12
|
-
$db_user = ask("Database User: ") { |q| q.echo = true }
|
13
|
-
else
|
14
|
-
$db_user = ENV['db_user']
|
15
|
-
end
|
16
|
-
|
17
|
-
if ENV['db_user_password'].nil? then
|
18
|
-
$db_user_password = ask("Database User Password: ") { |q| q.echo = "*" }
|
19
|
-
else
|
20
|
-
$db_user_password = ENV['db_user_password']
|
21
|
-
end
|
22
|
-
|
23
|
-
if ENV['db_name'].nil? then
|
24
|
-
$db_name = ask("Database Instance: ") { |q| q.echo = true }
|
25
|
-
else
|
26
|
-
$db_name = ENV['db_name']
|
27
|
-
end
|
28
|
-
|
29
|
-
if not $db_user.nil? and not $db_user_password.nil? and not $db_name.nil? then
|
30
|
-
return true
|
31
|
-
else
|
32
|
-
puts "INVALID DATABASE CONNECTION PARAMETERS"
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
def sqlplus_connect_string
|
38
|
-
return $db_user + "/" + $db_user_password + "@" + $db_name
|
39
|
-
end
|
40
|
-
|
41
|
-
desc "Test database connection"
|
42
|
-
task :test_connection do
|
43
|
-
if not process_db_connect_params then
|
44
|
-
exit
|
45
|
-
puts "test failed"
|
46
|
-
else
|
47
|
-
puts "valid parameters"
|
48
|
-
end
|
49
|
-
puts "Starting database connection test"
|
50
|
-
begin
|
51
|
-
conn = OCI8.new( $db_user, $db_user_password, $db_name )
|
52
|
-
conn.logoff
|
53
|
-
puts "Connection successful"
|
54
|
-
rescue
|
55
|
-
puts $!
|
56
|
-
puts "Connection failed"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
desc "Rebuild all build and teardown scripts"
|
61
|
-
task :rebuild_build_scripts do
|
62
|
-
if not process_db_connect_params then
|
63
|
-
exit
|
64
|
-
end
|
65
|
-
|
66
|
-
s = Orasaurus::ScriptBuilder.new( '.' )
|
67
|
-
puts "building simple build scripts"
|
68
|
-
s.build_all_scripts( 'build.sql', 'teardown.sql' )
|
69
|
-
|
70
|
-
#puts "re-doing table build scripts for proper order"
|
71
|
-
#t = Orasaurus::TableScriptBuilder.new( $db_user, $db_user_password, $db_name, './Tables/' )
|
72
|
-
#puts 'build_tables has finished'
|
73
|
-
|
74
|
-
puts 'done'
|
75
|
-
end
|
data/test/db/build.sql
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
SET SERVEROUTPUT ON
|
3
|
-
SET DEFINE OFF
|
4
|
-
SPOOL build.log
|
5
|
-
|
6
|
-
PROMPT
|
7
|
-
PROMPT *****************************GETTING STARTED************************
|
8
|
-
PROMPT
|
9
|
-
/
|
10
|
-
BEGIN DBMS_OUTPUT.PUT_LINE( 'BEGIN TIME: '||TO_CHAR( SYSDATE, 'MM/DD/YYYY HH:MI:SS' ) ); END;
|
11
|
-
/
|
12
|
-
|
13
|
-
PROMPT ***** create_test_user.sql *****
|
14
|
-
@create_test_user.sql;
|
15
|
-
SHOW ERRORS
|
16
|
-
|
17
|
-
BEGIN DBMS_OUTPUT.PUT_LINE( 'END TIME: '||TO_CHAR( SYSDATE, 'MM/DD/YYYY HH:MI:SS' ) ); END;
|
18
|
-
/
|
19
|
-
PROMPT
|
20
|
-
PROMPT *******************************FINISHED*******************************
|
21
|
-
PROMPT
|
22
|
-
|
23
|
-
|
24
|
-
EXIT
|
25
|
-
/
|
26
|
-
|
data/test/db/teardown.sql
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
|
2
|
-
SET SERVEROUTPUT ON
|
3
|
-
SET DEFINE OFF
|
4
|
-
SPOOL teardown.log
|
5
|
-
|
6
|
-
DECLARE
|
7
|
-
CURSOR cur_drop_list
|
8
|
-
IS
|
9
|
-
SELECT *
|
10
|
-
FROM USER_OBJECTS
|
11
|
-
WHERE OBJECT_NAME IN ( 'CREATE_TEST_USER' )
|
12
|
-
AND OBJECT_TYPE != 'PACKAGE BODY';
|
13
|
-
x BOOLEAN := FALSE;
|
14
|
-
BEGIN
|
15
|
-
DBMS_OUTPUT.PUT_LINE( 'starting work' );
|
16
|
-
FOR i IN cur_drop_list LOOP
|
17
|
-
x := TRUE;
|
18
|
-
BEGIN
|
19
|
-
EXECUTE IMMEDIATE 'DROP '||i.object_type||' '||i.object_name||' CASCADE CONSTRAINTS';
|
20
|
-
DBMS_OUTPUT.PUT_LINE( 'DROPPED '||i.object_name );
|
21
|
-
EXCEPTION
|
22
|
-
WHEN OTHERS THEN
|
23
|
-
DBMS_OUTPUT.PUT_LINE( 'WHILE DROPPING '||i.object_type||' '||i.object_name );
|
24
|
-
DBMS_OUTPUT.PUT_LINE( SUBSTR( SQLERRM, 1, 255 ) );
|
25
|
-
END;
|
26
|
-
END LOOP;
|
27
|
-
IF NOT x THEN
|
28
|
-
DBMS_OUTPUT.PUT_LINE( 'NOTHING FOUND TO DROP' );
|
29
|
-
END IF;
|
30
|
-
DBMS_OUTPUT.PUT_LINE( 'completed successfully' );
|
31
|
-
END;
|
32
|
-
/
|
33
|
-
|
34
|
-
EXIT
|
35
|
-
/
|
36
|
-
|