Skip to content

Commit 56a8588

Browse files
bagyi0vim-scripts
authored andcommitted
Version 4.10
Posted by David Fishburn. New Features ------------ - Updated DBGetOption to additionally display a list of all database profiles and their types. All dbext options that have been overriden via the vimrc are also displayed. Bug Fixes ------------ - db2 support had issues with the queries when running DBCompleteTable, DBCompleteProcedure, DBCompleteView which also affected the sqlcomplete.vim plugin included with Vim7 (Peter Princz). - The documentation was still indicating there was a plugin dependency which has been removed with Vim7.
1 parent 164e8d2 commit 56a8588

File tree

2 files changed

+89
-33
lines changed

2 files changed

+89
-33
lines changed

doc/dbext.txt

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*dbext.txt* For Vim version 6.0. Last change: Sun Sep 17 2006 11:22:54 AM
1+
*dbext.txt* For Vim version 6.0. Last change: Tue Nov 21 2006 11:45:54 AM
22

33

44
VIM REFERENCE MANUAL
@@ -7,7 +7,7 @@
77
David Fishburn <[email protected]>
88

99
Database extension plugin (dbext.vim) manual
10-
dbext.vim version 4.03
10+
dbext.vim version 4.10
1111

1212
For instructions on installing this file, type
1313
:help add-local-help
@@ -53,6 +53,23 @@ SourceForge: $Revision: 1.23 $
5353
------------------------------------------------------------------------------
5454
What's New *dbext-new*
5555

56+
Version 4.10
57+
58+
New Features
59+
------------
60+
- Updated DBGetOption to additionally display a list of all database profiles
61+
and their types. All dbext options that have been overriden via the
62+
vimrc are also displayed.
63+
64+
Bug Fixes
65+
------------
66+
- db2 support had issues with the queries when running DBCompleteTable,
67+
DBCompleteProcedure, DBCompleteView which also affected the sqlcomplete.vim
68+
plugin included with Vim7 (Peter Princz).
69+
- The documentation was still indicating there was a plugin dependency which
70+
has been removed with Vim7.
71+
72+
5673
Version 4.00
5774

5875
New Features
@@ -214,13 +231,15 @@ Version 2.20
214231
removal of the INTO clause to ensure it does not interfer with an
215232
INSERT or MERGE statement.
216233

234+
217235
Version 2.11
218236

219237
Bug Fixes
220238
---------
221239
- On some platforms the temporary file created to execute SQL statements must
222240
end in ".sql". Corrected this for all databases
223241

242+
224243
Version 2.10
225244

226245
New Features
@@ -247,6 +266,7 @@ Version 2.10
247266
- bin_path did not work correctly on windows platforms.
248267
- Updated the connection text in the Result buffer.
249268

269+
250270
Version 2.00
251271

252272
- In version 2.00 the following new features have been added to dbext.
@@ -326,9 +346,6 @@ Version 2.00
326346
:helptags $VIM/vimfiles/doc (Windows)
327347
:helptags $VIM/.vim/doc (Unix)
328348

329-
dbext has a dependency on the multvals.vim plugin. Download from:
330-
http://www.vim.org/script.php?script_id=171
331-
332349
------------------------------------------------------------------------------
333350
3. Configuration *dbext-configure*
334351

plugin/dbext.vim

Lines changed: 67 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
" dbext.vim - Commn Database Utility
22
" ---------------------------------------------------------------
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
1111
" Contributors: Joerg Schoppet <[email protected]>
1212
" Hari Krishna Dara <[email protected]>
1313
" Ron Aaron
14-
" Dependencies:
15-
" - Requires multvals.vim to be installed. Download from:
16-
" http://www.vim.org/script.php?script_id=171
1714
"
18-
" SourceForge: $Revision: 1.38 $
15+
" SourceForge: $Revision: 1.38 $
1916
"
20-
" Help: :h dbext.txt
17+
" Help: :h dbext.txt
2118

2219
if exists('g:loaded_dbext') || &cp
2320
finish
@@ -26,7 +23,7 @@ if v:version < 700
2623
echomsg "dbext: Version 4.00 or higher requires Vim7. Version 3.50 can stil be used with Vim6."
2724
finish
2825
endif
29-
let g:loaded_dbext = 403
26+
let g:loaded_dbext = 410
3027

3128
" Script variable defaults, these are used internal and are never displayed
3229
" to the end user via the DBGetOption command {{{
@@ -457,9 +454,9 @@ function! DB_listOption(...)
457454
elseif option_cnt == (conn_params_cnt +
458455
\ config_params_cnt + 1)
459456
let option_list = option_list .
460-
\ "----------------------\n" .
457+
\ "--------------------------\n" .
461458
\ "** Script Level Options **\n" .
462-
\ "----------------------\n"
459+
\ "--------------------------\n"
463460
elseif option_cnt == (conn_params_cnt +
464461
\ config_params_cnt +
465462
\ script_params_cnt + 1)
@@ -474,6 +471,48 @@ function! DB_listOption(...)
474471
let option_cnt = option_cnt + 1
475472
endfor
476473

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+
477516
call s:DB_addToResultBuffer(option_list, "clear")
478517

479518
return ""
@@ -1987,30 +2026,30 @@ endfunction
19872026

19882027
function! s:DB_DB2_getDictionaryTable()
19892028
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"
19942033
\ )
19952034
return s:DB_DB2_stripHeaderFooter(result)
19962035
endfunction
19972036

19982037
function! s:DB_DB2_getDictionaryProcedure()
19992038
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"
20042043
\ )
20052044
return s:DB_DB2_stripHeaderFooter(result)
20062045
endfunction
20072046

20082047
function! s:DB_DB2_getDictionaryView()
20092048
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"
20142053
\ )
20152054
return s:DB_DB2_stripHeaderFooter(result)
20162055
endfunction

0 commit comments

Comments
 (0)