Skip to content

Commit 60b0223

Browse files
committed
Initial commit
0 parents  commit 60b0223

27 files changed

+968
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.cache
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>query=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}
9+
10+
. "$TM_SUPPORT_PATH/lib/webpreview.sh"
11+
html_header "Describe $query"
12+
13+
NLS_LANG=AMERICAN_AMERICA.UTF8
14+
export NLS_LANG
15+
16+
sqlplus -S -L /NOLOG &lt;&lt;EOF
17+
set define off
18+
whenever sqlerror exit failure rollback
19+
prompt &lt;pre&gt;
20+
connect "$ORA_USER"/"$ORA_PWD"@"$ORA_CONNECT"
21+
show user
22+
prompt &lt;/pre&gt;
23+
set markup html on
24+
desc $query
25+
set markup html off
26+
EOF
27+
28+
echo "SQL*Plus exited."
29+
html_footer
30+
</string>
31+
<key>fallbackInput</key>
32+
<string>word</string>
33+
<key>input</key>
34+
<string>selection</string>
35+
<key>keyEquivalent</key>
36+
<string>@d</string>
37+
<key>name</key>
38+
<string>Describe Selection or Word</string>
39+
<key>output</key>
40+
<string>showAsHTML</string>
41+
<key>scope</key>
42+
<string>source.plsql.oracle</string>
43+
<key>uuid</key>
44+
<string>65257C54-A07C-4764-961C-B892F28A89DF</string>
45+
</dict>
46+
</plist>

Commands/Find Procedure.tmCommand

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>#!/usr/bin/env ruby
9+
10+
require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
11+
require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes'
12+
13+
proj = ENV['TM_PROJECT_DIRECTORY']
14+
file = ENV['TM_FILEPATH']
15+
16+
line = ENV['TM_CURRENT_LINE']
17+
proc = ENV['TM_CURRENT_WORD']
18+
19+
if line.match(%r{\b([-a-z0-9_]+)\.#{proc}}i)
20+
pkg = $1
21+
file = %x{egrep -il -r "create.*package *body *#{pkg}\\b" "#{proj}"}.split(/\n/).last
22+
if file
23+
res = %x{egrep -in "(function|procedure) *#{proc}" "#{file}"}.split(/\n/).last
24+
else
25+
TextMate.exit_show_tool_tip "Package #{pkg} not available"
26+
end
27+
else
28+
res = %x{egrep -in "(function|procedure) *#{proc}" "#{file}"}.split(/\n/).last
29+
end
30+
31+
if res
32+
data = res.split(/:/)
33+
TextMate.go_to :file =&gt; file, :line =&gt; data[0], :column =&gt; 0
34+
else
35+
file = file.sub(%r{#{proj}/?}, '')
36+
TextMate.exit_show_tool_tip "Procedure #{proc} not found in #{file}"
37+
end
38+
</string>
39+
<key>fallbackInput</key>
40+
<string>word</string>
41+
<key>input</key>
42+
<string>selection</string>
43+
<key>keyEquivalent</key>
44+
<string>^f</string>
45+
<key>name</key>
46+
<string>Find Procedure</string>
47+
<key>output</key>
48+
<string>showAsTooltip</string>
49+
<key>scope</key>
50+
<string>source.plsql.oracle</string>
51+
<key>uuid</key>
52+
<string>1222BE8A-15D8-4C06-8965-F139A153DD97</string>
53+
</dict>
54+
</plist>

Commands/Help.tmCommand

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>. "$TM_SUPPORT_PATH/lib/webpreview.sh"
9+
html_header "Oracle PL/SQL Bundle Help" "Oracle"
10+
11+
Markdown.pl &lt;&lt;'EOF'
12+
# Help for the Oracle PL/SQL Bundle
13+
14+
## Search Oracle Docs for Selection or Word
15+
16+
The _Search Oracle Docs for Selection or Word_ command searches for the selected text or current word in the Oracle online documentation.
17+
18+
## Run Script
19+
20+
The _Run Script_ command takes the current file and runs it using SQL*Plus.
21+
22+
## Run Selection or Line
23+
24+
The _Run Selection or Line_ command takes the selected text or current line and submits it as a query using SQL*Plus.
25+
26+
## Describe Selection or Word
27+
28+
The _Describe Selection or Word_ command takes the selected text or current word and submits a describe command to SQL*Plus.
29+
30+
## Open SQL*Plus
31+
32+
The _Open SQL*Plus_ command opens up SQL*Plus in the project folder and logs in using the username, password and connectstring supplied as environment variables. Useful for running "interactive" SQL-scripts.
33+
34+
## Find Procedure
35+
36+
The _Find Procedure_ command will search for a procedure or function in a package body with the name of the current word. If it is found, the file containing it is shown and the cursor moves to the start of the procedure or function.
37+
38+
### Environment Variables
39+
40+
The commands assumes the following environment variables are properly set:
41+
42+
* `$ORA_USER` - schema/username e.g. SCOTT
43+
* `$ORA_PWD ` - password, e.g. TIGER
44+
* `$ORA_CONNECT` - connect string, e.g. localhost:1521/ORCL
45+
46+
These variables may be set in the parent shell of TextMate, global variables in TextMate preferences, or as project local variables.
47+
48+
The commands all assume UTF-8 formatted files.
49+
50+
## Extras
51+
52+
### Importing a File
53+
54+
You can import the contents of another file into the currently open file by dragging
55+
it into the window. The contents will appear at the place you release it.
56+
57+
### Tab Triggers
58+
59+
There are a number of "tab triggers" defined which will insert useful code snippets into the current file. Look at the Oracle menu to see what these are and how to activate them.
60+
61+
EOF
62+
63+
html_footer
64+
</string>
65+
<key>input</key>
66+
<string>none</string>
67+
<key>keyEquivalent</key>
68+
<string>^H</string>
69+
<key>name</key>
70+
<string>Help</string>
71+
<key>output</key>
72+
<string>showAsHTML</string>
73+
<key>scope</key>
74+
<string>source.plsql.oracle</string>
75+
<key>uuid</key>
76+
<string>69B47504-F6E5-44BB-A758-51DB35270B9C</string>
77+
</dict>
78+
</plist>

Commands/Run Script.tmCommand

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>. "$TM_SUPPORT_PATH/lib/webpreview.sh"
9+
html_header "Run ‘${TM_FILENAME}’"
10+
11+
cd "$TM_DIRECTORY"
12+
13+
NLS_LANG=AMERICAN_AMERICA.UTF8
14+
export NLS_LANG
15+
16+
sqlplus -S -L /NOLOG &lt;&lt;EOF
17+
set define off
18+
whenever sqlerror exit failure rollback
19+
prompt &lt;pre&gt;
20+
connect "$ORA_USER"/"$ORA_PWD"@"$ORA_CONNECT"
21+
show user
22+
prompt Running $TM_FILENAME
23+
@"$TM_FILENAME"
24+
show errors
25+
prompt &lt;/pre&gt;
26+
EOF
27+
28+
echo "SQL*Plus exited."
29+
html_footer
30+
</string>
31+
<key>input</key>
32+
<string>none</string>
33+
<key>keyEquivalent</key>
34+
<string>@r</string>
35+
<key>name</key>
36+
<string>Run Script</string>
37+
<key>output</key>
38+
<string>showAsHTML</string>
39+
<key>scope</key>
40+
<string>source.plsql.oracle</string>
41+
<key>uuid</key>
42+
<string>BA59AADC-85C6-4215-BEFA-DF6BAAEFC7F5</string>
43+
</dict>
44+
</plist>
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>query=${TM_SELECTED_TEXT:-$TM_CURRENT_LINE}
9+
10+
. "$TM_SUPPORT_PATH/lib/webpreview.sh"
11+
html_header "Run Selection or Line"
12+
13+
NLS_LANG=AMERICAN_AMERICA.UTF8
14+
export NLS_LANG
15+
16+
sqlplus -S -L /NOLOG &lt;&lt;EOF
17+
set define off
18+
whenever sqlerror exit failure rollback
19+
prompt &lt;pre&gt;
20+
connect "$ORA_USER"/"$ORA_PWD"@"$ORA_CONNECT"
21+
show user
22+
prompt &lt;/pre&gt;
23+
set markup html on
24+
$query
25+
set markup html off
26+
prompt &lt;pre&gt;
27+
show errors
28+
prompt &lt;/pre&gt;
29+
EOF
30+
31+
echo "SQL*Plus exited."
32+
html_footer
33+
</string>
34+
<key>fallbackInput</key>
35+
<string>line</string>
36+
<key>input</key>
37+
<string>selection</string>
38+
<key>keyEquivalent</key>
39+
<string>@R</string>
40+
<key>name</key>
41+
<string>Run Selection or Line</string>
42+
<key>output</key>
43+
<string>showAsHTML</string>
44+
<key>scope</key>
45+
<string>source.plsql.oracle</string>
46+
<key>uuid</key>
47+
<string>57DAAB63-8B29-4599-B25C-0A2661A702E3</string>
48+
</dict>
49+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>query=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}
9+
10+
. "$TM_SUPPORT_PATH/lib/html.sh"
11+
redirect "http://www.oracle.com/pls/db111/search?remark=quick_search&amp;word=$query"
12+
</string>
13+
<key>fallbackInput</key>
14+
<string>word</string>
15+
<key>input</key>
16+
<string>selection</string>
17+
<key>keyEquivalent</key>
18+
<string>^h</string>
19+
<key>name</key>
20+
<string>Search Oracle Docs for Selection or Word</string>
21+
<key>output</key>
22+
<string>showAsHTML</string>
23+
<key>scope</key>
24+
<string>source.plsql.oracle</string>
25+
<key>uuid</key>
26+
<string>2D735CC6-DF05-4725-A4FD-08DE33AAD9E4</string>
27+
</dict>
28+
</plist>
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>cat "$TM_DROPPED_FILE"</string>
9+
<key>draggedFileExtensions</key>
10+
<array>
11+
<string>sql</string>
12+
</array>
13+
<key>input</key>
14+
<string>selection</string>
15+
<key>name</key>
16+
<string>Import File</string>
17+
<key>output</key>
18+
<string>insertAsSnippet</string>
19+
<key>scope</key>
20+
<string>source.plsql.oracle</string>
21+
<key>uuid</key>
22+
<string>7CFC443C-623B-405B-8691-F109033BEA39</string>
23+
</dict>
24+
</plist>

Preferences/Indent.tmPreferences

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>name</key>
6+
<string>Indent</string>
7+
<key>scope</key>
8+
<string>source.plsql.oracle</string>
9+
<key>settings</key>
10+
<dict>
11+
<key>decreaseIndentPattern</key>
12+
<string>(?i)^\s*(is|as|begin|end|then|else|elsif|exception)\b</string>
13+
<key>increaseIndentPattern</key>
14+
<string>(?i)^\s*(is|as|begin|if|then|else|elsif|loop|exception)\b</string>
15+
</dict>
16+
<key>uuid</key>
17+
<string>6A30BCDD-20CB-4E24-A1DC-5187E6AA36A6</string>
18+
</dict>
19+
</plist>

Snippets/New Function.tmSnippet

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>content</key>
6+
<string>FUNCTION ${1:func_name}(
7+
po_result_code OUT NUMBER)
8+
RETURN ${2:RETURN_TYPE}
9+
IS
10+
l_procname VARCHAR2(30) := '${1/_(.)/\u$1/g}';
11+
BEGIN
12+
Corelogger.Log_Open_Print_Close(pi_pkg_name, l_procname,
13+
${3:INITIAL STATE});
14+
po_result_code := Corecontainertask.c_result_success;
15+
16+
$0
17+
18+
EXCEPTION
19+
WHEN OTHERS THEN
20+
Corelogger.Log_Open_PrintError_Close(pi_pkg_name, l_procname,
21+
'Exception: ' || SUBSTR(SQLERRM(SQLCODE), 1, 100));
22+
po_result_code := Corecontainertask.c_result_failure;
23+
END $1;</string>
24+
<key>name</key>
25+
<string>New Function</string>
26+
<key>scope</key>
27+
<string>source.plsql.oracle</string>
28+
<key>tabTrigger</key>
29+
<string>func</string>
30+
<key>uuid</key>
31+
<string>5873A2DA-C72C-40DB-8859-368CA8B3809E</string>
32+
</dict>
33+
</plist>

0 commit comments

Comments
 (0)