File: bug823000.sql

package info (click to toggle)
geany 2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 39,300 kB
  • sloc: ansic: 168,600; cpp: 77,562; sh: 5,344; makefile: 1,694; cs: 1,233; javascript: 1,024; python: 580; f90: 537; vhdl: 504; sql: 503; lisp: 436; fortran: 389; php: 278; ada: 201; ruby: 163; java: 131; asm: 131; perl: 119; cobol: 88; tcl: 77; erlang: 73; xml: 66; ml: 27; sed: 16; pascal: 15; haskell: 6
file content (80 lines) | stat: -rw-r--r-- 2,119 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
Bugs item #823000, was opened at 2003-10-13 21:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106556&aid=823000&group_id=6556

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jozsef Nagy (brutal)
Assigned to: Nobody/Anonymous (nobody)
Summary: PL/SQL functions and procedures

Initial Comment:
I've tried to use ctags (version 5.5.2) to navigate
PL/SQL source codes in vim but jumping to
function/procedure definitions worked not properly. I
figured out that the problem was that I've defined
these functions/procedures in multiline format, for
example:

test.pkb:
*/
CREATE OR REPLACE PACKAGE TEST IS

PROCEDURE TestFunc1
(
  arg1  IN NUMBER,
  arg2  IN NUMBER
)
IS
BEGIN
  NULL;
END TestFunc1;

PROCEDURE TestFunc2
(
  arg1  IN NUMBER,
  arg2  IN NUMBER
)
IS
BEGIN
  NULL;
END TestFunc2;

END TEST;
/
/*
ctags creates a regexp type pattern for my
functions/procedures but unfortunately the pattern was
/^IS$/ for each function/procedure, that's why the
jumping method worked really crappy. (see the output of
ctags 5.5.2 on this example code below)

ctags -f - --language-force=sql test.pkb
TEST    test.pkb        /^CREATE OR REPLACE PACKAGE
TEST IS$/;" P
TestFunc1       test.pkb        /^IS$/;"        p
TestFunc2       test.pkb        /^IS$/;"        p

I've looked into the ctags source code and I saw that
in parseSubProgram() in sql.c called makeSqlTag() only
when KEYWORD_is reached. I have modified this function
 so that makeSqlTag() is called immediately after a
function/procedure keyword and name is read (I have
attached the output of diff sql.c.5.5.2 sql.c). I don't
know much of ctags internals so I am not sure if this
is the best solution but it worked for me. (see the
output of my modified ctags below)

ctags -f - --language-force=sql test.pkb
TEST    test.pkb        /^CREATE OR REPLACE PACKAGE
TEST IS$/;" P
TestFunc1       test.pkb        /^PROCEDURE
TestFunc1$/;"       p
TestFunc2       test.pkb        /^PROCEDURE
TestFunc2$/;"       p
*/