Skip to content

Commit d44fd5c

Browse files
bagyi0vim-scripts
authored andcommitted
Version 19.0
Posted by David Fishburn New Features ------------ - Added support for parsing C# files (Raul Segura Acevedo). - Updated the PostgreSQL message when the .pgpass file is missing (Dav Clark). Bug Fixes --------- - When prompting for connection parameters a second time, the previously chosen profile number was not defaulted. - If a dbext login script was stored in the $HOME directory it would never be found (Tim Teufel). - The first host variable was prompted for replacement, but the second one was not (Stanimir Mladenov). - Selecting a visual region with leading and ending double quotes (like a table name) could report invalid arguments for the following commands: DBSelectFromTable, DBSelectFromTableTopX, DBDescribeTable, DBDescribeProcedure, DBListColumn - For DB2 on the mainframe the command line utilities do not support the -t switch. If you override the buffer specific cmd_terminator setting and set this value to an empty string the -t will be left off. This can be most easily specified in a dbext connection profile (Michael McDermott): let g:dbext_default_profile_MyDB2 = 'type=DB2:user=me:passwd=mypass:dbname=SSD:cmd_terminator=' Or while within a buffer: DBSetOption cmd_terminator= DBSetOption cmd_terminator=;
1 parent 3214a61 commit d44fd5c

File tree

4 files changed

+164
-96
lines changed

4 files changed

+164
-96
lines changed

autoload/dbext.vim

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
" dbext.vim - Commn Database Utility
22
" Copyright (C) 2002-10, Peter Bagyinszki, David Fishburn
33
" ---------------------------------------------------------------
4-
" Version: 18.00
4+
" Version: 19.00
55
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
66
" Authors: Peter Bagyinszki <petike1 at dpg dot hu>
77
" David Fishburn <dfishburn dot vim at gmail dot com>
8-
" Last Modified: 2012 Oct 31
8+
" Last Modified: 2013 Apr 29
99
" Based On: sqlplus.vim (author: Jamis Buck)
1010
" Created: 2002-05-24
1111
" Homepage: http://vim.sourceforge.net/script.php?script_id=356
@@ -38,7 +38,7 @@ if v:version < 700
3838
echomsg "dbext: Version 4.00 or higher requires Vim7. Version 3.50 can stil be used with Vim6."
3939
finish
4040
endif
41-
let g:loaded_dbext_auto = 1800
41+
let g:loaded_dbext_auto = 1900
4242

4343
" Turn on support for line continuations when creating the script
4444
let s:cpo_save = &cpo
@@ -133,6 +133,7 @@ function! s:DB_buildLists()
133133
call add(s:conn_params_mv, 'driver')
134134
call add(s:conn_params_mv, 'conn_parms')
135135
call add(s:conn_params_mv, 'driver_parms')
136+
call add(s:conn_params_mv, 'cmd_terminator')
136137

137138
" Saved connection parameters
138139
let s:saved_conn_params_mv = []
@@ -152,6 +153,7 @@ function! s:DB_buildLists()
152153
call add(s:saved_conn_params_mv, 'saved_driver')
153154
call add(s:saved_conn_params_mv, 'saved_conn_parms')
154155
call add(s:saved_conn_params_mv, 'saved_driver_parms')
156+
call add(s:saved_conn_params_mv, 'saved_cmd_terminator')
155157

156158
" Configuration parameters
157159
let s:config_params_mv = []
@@ -541,10 +543,19 @@ function! s:DB_set(name, value)
541543
" Now set the connection parameters from the profile
542544
if s:DB_parseProfile(value) == -1
543545
return -1
546+
else
547+
return 0
544548
endif
545549
endif
546550

547-
if index(s:script_params_mv, a:name) > -1
551+
if index(s:db_params_mv, tolower(a:name)) > -1
552+
" Only when the database type has been specified
553+
" as these parameters are reset often when changing
554+
" profiles
555+
if b:dbext_type != ''
556+
call s:DB_setWType(tolower(a:name), value)
557+
endif
558+
elseif index(s:script_params_mv, a:name) > -1
548559
let s:dbext_{a:name} = value
549560
else
550561
let b:dbext_{a:name} = value
@@ -1299,16 +1310,19 @@ function! s:DB_promptForParameters(...)
12991310
endif
13001311

13011312
let diag_prompt = s:DB_getDefault("prompt_" . param)
1302-
let l:old_value = s:DB_get(param, no_default)
1303-
let l:new_value = s:DB_getInput(
1304-
\ diag_prompt,
1305-
\ l:old_value,
1306-
\ "-1"
1307-
\ )
1313+
let l:new_value = '-1'
1314+
if diag_prompt != ''
1315+
let l:old_value = s:DB_get(param, no_default)
1316+
let l:new_value = s:DB_getInput(
1317+
\ diag_prompt,
1318+
\ l:old_value,
1319+
\ "-1"
1320+
\ )
1321+
endif
13081322
endif
13091323
" If the user cancelled the input, break from the loop
13101324
" this is a new 602 feature
1311-
if l:new_value == "-1"
1325+
if l:new_value == '-1'
13121326
let retval = l:new_value
13131327
break
13141328
elseif l:new_value !=# l:old_value
@@ -2235,7 +2249,7 @@ function! s:DB_DB2_execSql(str)
22352249
let cmd = cmd .
22362250
\ s:DB_option(' ', dbext#DB_getWTypeDefault("extra"), ' ') .
22372251
\ s:DB_option('-d ', s:DB_get("dbname"), ' ') .
2238-
\ s:DB_option('-l ', dbext#DB_getWType("cmd_terminator"), ' ').
2252+
\ ((dbext#DB_getWType("cmd_terminator")!='')?(s:DB_option('-l ', dbext#DB_getWType("cmd_terminator"), ' ')):' ') .
22392253
\ ' -f ' . s:dbext_tempfile
22402254

22412255
else
@@ -2280,7 +2294,7 @@ function! s:DB_DB2_execSql(str)
22802294

22812295
let cmd = dbext_bin . ' ' . dbext#DB_getWType("db2cmd_cmd_options")
22822296
let cmd = cmd . ' ' . s:DB_option('', dbext#DB_getWTypeDefault("extra"), ' ') .
2283-
\ s:DB_option('-t', dbext#DB_getWType("cmd_terminator"), ' ') .
2297+
\ ((dbext#DB_getWType("cmd_terminator")!='')?(s:DB_option('-t', dbext#DB_getWType("cmd_terminator"), ' ')):' ') .
22842298
\ '-f ' . s:dbext_tempfile
22852299
endif
22862300

@@ -3089,9 +3103,10 @@ function! s:DB_PGSQL_check_pgpass()
30893103
call s:DB_warningMsg(
30903104
\ "dbext:PostgreSQL requires a '".
30913105
\ dbext#DB_getWType("pgpass").
3092-
\ "' file in order to authenticate. ".
3093-
\ 'This file is missing. '.
3094-
\ "The binary '".
3106+
\ "' file in order to authenticate. ".
3107+
\ "This file is missing. If you are using ".
3108+
\ "a local connection, you can create an ".
3109+
\ "empty .pgpass file. The binary '".
30953110
\ dbext#DB_getWType("bin").
30963111
\ "' does not accept commandline passwords."
30973112
\ )
@@ -5477,12 +5492,12 @@ function! s:DB_getLoginScript(filename)
54775492
endif
54785493

54795494
if custom_login_script_dir == ''
5480-
let filename = expand('$VIM').'/'.filename
5495+
let filename = expand('$VIM').'/'.matchstr(a:filename, '\f\+')
54815496
" Check if the filename is readable
54825497
if filereadable(filename)
54835498
let sqlf = readfile(filename)
54845499
else
5485-
let filename = expand('$HOME').'/'.filename
5500+
let filename = expand('$HOME').'/'.matchstr(a:filename, '\f\+')
54865501
if filereadable(filename)
54875502
let sqlf = readfile(filename)
54885503
else
@@ -5496,7 +5511,7 @@ function! s:DB_getLoginScript(filename)
54965511
endif
54975512
endif
54985513

5499-
if len(sqlf) > 0
5514+
if !empty(sqlf)
55005515
let sql = join(sqlf, "\n")."\n"
55015516
endif
55025517
endif
@@ -7055,7 +7070,7 @@ function! s:DB_searchReplace(str, exp_find_str, exp_get_value, count_matches)
70557070
" The above query gathers the preceeding text to make the above
70567071
" determination
70577072
" if inout !~? '\(in\|out\|inout\|declare\|set\|variable\|''\|/\|@\)'
7058-
if inout !~? s:DB_get('ignore_variable_regex')
7073+
if s:DB_get('ignore_variable_regex') !~? inout
70597074
" Check if the variable name is preceeded by a comment character.
70607075
" If so, ignore and continue.
70617076
if strpart(str, 0, (index-1)) !~ '\(--\|\/\/\)\s*$'
@@ -7487,7 +7502,7 @@ function! s:DB_parseJava(query)
74877502
" These can be single or double quotes
74887503
let leading_quote_regex = '\%(^[\t "]*\)\?'
74897504
let leading_quote = matchstr( query, leading_quote_regex )
7490-
if leading_quote != ''
7505+
if substitute(leading_quote, '\s\+', '', 'g') != ''
74917506
let query = substitute(query,
74927507
\ leading_quote_regex,
74937508
\ '',
@@ -7738,6 +7753,7 @@ function! s:DB_parseProfile(value)
77387753
let profile_name = "g:dbext_default_profile_" . a:value
77397754

77407755
if exists(profile_name)
7756+
let b:dbext_profile = a:value
77417757
let profile_value = g:dbext_default_profile_{a:value}
77427758
else
77437759
let rc = -1

autoload/dbext_dbi.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
" It adds transaction support and the ability
55
" to reach any database currently supported
66
" by Perl and DBI.
7-
" Version: 18.00
7+
" Version: 19.00
88
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
99
" Authors: David Fishburn <dfishburn dot vim at gmail dot com>
10-
" Last Modified: 2012 Oct 29
10+
" Last Modified: 2013 Apr 29
1111
" Created: 2007-05-24
1212
" Homepage: http://vim.sourceforge.net/script.php?script_id=356
1313
"
@@ -119,7 +119,7 @@
119119
if exists("g:loaded_dbext_dbi")
120120
finish
121121
endif
122-
let g:loaded_dbext_dbi = 1800
122+
let g:loaded_dbext_dbi = 1900
123123

124124
" Turn on support for line continuations when creating the script
125125
let s:cpo_save = &cpo

0 commit comments

Comments
 (0)