1
1
" dbext.vim - Commn Database Utility
2
2
" ---------------------------------------------------------------
3
- " Version: 4.03
4
- " Maintainer: David Fishburn <[email protected] >
5
- " Authors: Peter Bagyinszki <[email protected] >
6
- " David Fishburn <[email protected] >
7
- " Last Modified: Sun Sep 17 2006 11:20:33 AM
8
- " Based On: sqlplus.vim (author: Jamis Buck <[email protected] > )
9
- " Created: 2002-05-24
10
- " Homepage: http://vim.sourceforge.net/script.php?script_id=356
3
+ " Version: 4.10
4
+ " Maintainer: David Fishburn <[email protected] >
5
+ " Authors: Peter Bagyinszki <[email protected] >
6
+ " David Fishburn <[email protected] >
7
+ " Last Modified: Tue Nov 21 2006 11:46:07 AM
8
+ " Based On: sqlplus.vim (author: Jamis Buck)
9
+ " Created: 2002-05-24
10
+ " Homepage: http://vim.sourceforge.net/script.php?script_id=356
11
11
" Contributors: Joerg Schoppet <[email protected] >
12
12
" Hari Krishna Dara <[email protected] >
13
13
" Ron Aaron
14
- " Dependencies:
15
- " - Requires multvals.vim to be installed. Download from:
16
- " http://www.vim.org/script.php?script_id=171
17
14
"
18
- " SourceForge: $Revision: 1.38 $
15
+ " SourceForge: $Revision: 1.38 $
19
16
"
20
- " Help: :h dbext.txt
17
+ " Help: :h dbext.txt
21
18
22
19
if exists (' g:loaded_dbext' ) || &cp
23
20
finish
@@ -26,7 +23,7 @@ if v:version < 700
26
23
echomsg " dbext: Version 4.00 or higher requires Vim7. Version 3.50 can stil be used with Vim6."
27
24
finish
28
25
endif
29
- let g: loaded_dbext = 403
26
+ let g: loaded_dbext = 410
30
27
31
28
" Script variable defaults, these are used internal and are never displayed
32
29
" to the end user via the DBGetOption command {{{
@@ -457,9 +454,9 @@ function! DB_listOption(...)
457
454
elseif option_cnt == (conn_params_cnt +
458
455
\ config_params_cnt + 1 )
459
456
let option_list = option_list .
460
- \ " ----------------------\n " .
457
+ \ " -------------------------- \n " .
461
458
\ " ** Script Level Options **\n " .
462
- \ " ----------------------\n "
459
+ \ " -------------------------- \n "
463
460
elseif option_cnt == (conn_params_cnt +
464
461
\ config_params_cnt +
465
462
\ script_params_cnt + 1 )
@@ -474,6 +471,48 @@ function! DB_listOption(...)
474
471
let option_cnt = option_cnt + 1
475
472
endfor
476
473
474
+ let option_list = option_list .
475
+ \ " --------------\n " .
476
+ \ " ** Profiles **\n " .
477
+ \ " --------------\n "
478
+ for profile_mv in s: conn_profiles_mv
479
+ let opt_name = profile_mv
480
+ " let opt_value = opt_name . ' = ' . s:DB_get(opt_name)
481
+ let opt_value = ' '
482
+ if exists (' g:dbext_default_profile_' .opt_name)
483
+ let opt_value = matchstr (g: dbext_default_profile_ {opt_name}, ' type=\zs\w\+\ze\(:\|$\)' )
484
+ endif
485
+ let option_list = option_list . opt_name . ' T(' . opt_value . " )\n "
486
+ endfor
487
+
488
+ let option_list = option_list .
489
+ \ " -------------------------------\n " .
490
+ \ " ** Overrides (via the vimrc) **\n " .
491
+ \ " -------------------------------\n "
492
+ " Check if the user has any profiles defined in his vimrc
493
+ let saveA = @a
494
+ redir @a
495
+ silent ! exec ' let'
496
+ redir END
497
+ let l: global_vars = @a
498
+ let @a = saveA
499
+
500
+ let dbext_default_prefix = ' dbext_default_\zs\(\w\+\)'
501
+ let index = match (l: global_vars , dbext_default_prefix)
502
+ while index > -1
503
+ " Retrieve the name of option
504
+ let opt_name = matchstr (l: global_vars , ' \w\+' , index )
505
+ if strlen (opt_name) > 0
506
+ let opt_value = matchstr (l: global_vars , ' \s*\zs[^' ." \<C-J> " .' ]\+' ,
507
+ \ (index + strlen (opt_name)) )
508
+ if opt_name !~ ' profile_'
509
+ let option_list = option_list . opt_name . ' = ' . opt_value . " \n "
510
+ endif
511
+ endif
512
+ let index = index + strlen (opt_name)+ strlen (opt_value) + 1
513
+ let index = match (l: global_vars , dbext_default_prefix, index )
514
+ endwhile
515
+
477
516
call s: DB_addToResultBuffer (option_list, " clear" )
478
517
479
518
return " "
@@ -1987,30 +2026,30 @@ endfunction
1987
2026
1988
2027
function ! s: DB_DB2_getDictionaryTable ()
1989
2028
let result = s: DB_DB2_execSql (
1990
- \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" CAST(tabschema AS VARCHAR(15)) AS tabschema|| '.'|| " :' ' ).
1991
- \ " CAST(tabname AS VARCHAR(40)) AS tabname " .
1992
- \ " from syscat.tables " .
1993
- \ " order by " .(s: DB_get (' dict_show_owner' )== 1 ?" CAST( tabschema AS VARCHAR(15)) , " :' ' )." tabname"
2029
+ \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" TRIM( CAST(tabschema AS VARCHAR(15))) || '.' || " :' ' ).
2030
+ \ " CAST(tabname AS VARCHAR(40)) AS tabschema_tabname " .
2031
+ \ " from syscat.tables " .
2032
+ \ " order by " .(s: DB_get (' dict_show_owner' )== 1 ?" tabschema, " :' ' )." tabname"
1994
2033
\ )
1995
2034
return s: DB_DB2_stripHeaderFooter (result)
1996
2035
endfunction
1997
2036
1998
2037
function ! s: DB_DB2_getDictionaryProcedure ()
1999
2038
let result = s: DB_DB2_execSql (
2000
- \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" CAST(procschema AS VARCHAR(15)) AS procschema|| '.'|| " :' ' ).
2001
- \ " CAST(procname AS VARCHAR(40)) AS procname " .
2002
- \ " from syscat.procedures " .
2003
- \ " order by " .(s: DB_get (' dict_show_owner' )== 1 ?" CAST( procschema AS VARCHAR(15)) , " :' ' )." procname"
2039
+ \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" TRIM( CAST(procschema AS VARCHAR(15))) || '.' || " :' ' ).
2040
+ \ " CAST(procname AS VARCHAR(40)) AS procschema_procname " .
2041
+ \ " from syscat.procedures " .
2042
+ \ " order by " .(s: DB_get (' dict_show_owner' )== 1 ?" procschema, " :' ' )." procname"
2004
2043
\ )
2005
2044
return s: DB_DB2_stripHeaderFooter (result)
2006
2045
endfunction
2007
2046
2008
2047
function ! s: DB_DB2_getDictionaryView ()
2009
2048
let result = s: DB_DB2_execSql (
2010
- \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" CAST(viewschema AS VARCHAR(15)) AS viewschema|| '.'|| " :' ' ).
2011
- \ " CAST(viewname AS VARCHAR(40)) AS viewname " .
2012
- \ " from syscat.views " .
2013
- \ " order by " .(s: DB_get (' dict_show_owner' )== 1 ?" CAST( viewschema AS VARCHAR(15)) , " :' ' )." viewname"
2049
+ \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" TRIM( CAST(viewschema AS VARCHAR(15))) || '.' || " :' ' ).
2050
+ \ " CAST(viewname AS VARCHAR(40)) AS viewschema_viewname " .
2051
+ \ " from syscat.views " .
2052
+ \ " order by " .(s: DB_get (' dict_show_owner' )== 1 ?" viewschema, " :' ' )." viewname"
2014
2053
\ )
2015
2054
return s: DB_DB2_stripHeaderFooter (result)
2016
2055
endfunction
0 commit comments