11" dbext.vim - Commn Database Utility
22" ---------------------------------------------------------------
3- " Version: 4.10
3+ " Version: 4.20
44" Maintainer: David Fishburn <fishburn@ianywhere.com>
55" Authors: Peter Bagyinszki <petike1@dpg.hu>
66" David Fishburn <fishburn@ianywhere.com>
7- " Last Modified: Tue Nov 21 2006 11:46:07 AM
7+ " Last Modified: Tue Dec 19 2006 10:39:10 PM
88" Based On: sqlplus.vim (author: Jamis Buck)
99" Created: 2002-05-24
1010" Homepage: http://vim.sourceforge.net/script.php?script_id=356
@@ -23,7 +23,7 @@ if v:version < 700
2323 echomsg " dbext: Version 4.00 or higher requires Vim7. Version 3.50 can stil be used with Vim6."
2424 finish
2525endif
26- let g: loaded_dbext = 410
26+ let g: loaded_dbext = 420
2727
2828" Script variable defaults, these are used internal and are never displayed
2929" to the end user via the DBGetOption command {{{
@@ -112,6 +112,9 @@ function! s:DB_buildLists()
112112 call add (s: script_params_mv , ' history_max_entry' )
113113 call add (s: script_params_mv , ' dbext_version' )
114114 call add (s: script_params_mv , ' inputdialog_cancel_support' )
115+ call add (s: script_params_mv , ' buffers_with_dict_files' )
116+ call add (s: script_params_mv , ' use_win32_filenames' )
117+ call add (s: script_params_mv , ' temp_file' )
115118
116119 " DB server specific params
117120 " See below for 3 additional DB2 items
@@ -184,6 +187,20 @@ function! s:DB_buildLists()
184187 let loop_count += 1
185188 endfor
186189
190+ " Check if we are using Cygwin, if so, let the user override
191+ " the temporary filename to use backslashes
192+ if has (' win32unix' ) && s: DB_get (' use_win32_filenames' ) == 1
193+ let l: dbext_tempfile = system (' cygpath -w ' .s: dbext_tempfile )
194+ if v: shell_error
195+ call s: DB_warningMsg (' dbext:Failed to convert Cygwin path:' .v: errmsg )
196+ else
197+ " If executing the Windows path inside a Cygwin shell, you must
198+ " double up the backslashes
199+ let s: dbext_tempfile = substitute (l: dbext_tempfile , ' \\' , ' \\\\' , ' g' )
200+ endif
201+ " let s:dbext_tempfile = substitute(s:dbext_tempfile, '/', '\', 'g')
202+ endif
203+
187204endfunction
188205" }}}
189206
@@ -590,6 +607,9 @@ function! s:DB_getDefault(name)
590607 elseif a: name == # " replace_title" |return (exists (" g:dbext_default_replace_title" )?g: dbext_default_replace_title .' ' :0 )
591608 elseif a: name == # " use_tbl_alias" |return (exists (" g:dbext_default_use_tbl_alias" )?g: dbext_default_use_tbl_alias .' ' :' a' )
592609 elseif a: name == # " delete_temp_file" |return (exists (" g:dbext_default_delete_temp_file" )?g: dbext_default_delete_temp_file .' ' :' 1' )
610+ elseif a: name == # " buffers_with_dict_files" |return s: dbext_buffers_with_dict_files
611+ elseif a: name == # " temp_file" |return s: dbext_tempfile
612+ elseif a: name == # " use_win32_filenames" |return (exists (" g:dbext_default_use_win32_filenames" )?g: dbext_default_use_win32_filenames .' ' :' 0' )
593613 elseif a: name == # " dbext_version" |return (g: loaded_dbext )
594614 elseif a: name == # " history_file" |return (exists (" g:dbext_default_history_file" )?g: dbext_default_history_file .' ' :(has (' win32' )?$VIM .' /dbext_sql_history.txt' :$HOME .' /dbext_sql_history.txt' ))
595615 elseif a: name == # " history_bufname" |return (fnamemodify (s: DB_get (' history_file' ), " :t:r" ))
@@ -2897,7 +2917,7 @@ function! s:DB_SQLSRV_getListView(view_prefix)
28972917endfunction
28982918function ! s: DB_SQLSRV_getDictionaryTable () " {{{
28992919 let result = s: DB_SQLSRV_execSql (
2900- \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" convert(varchar,u.name)|| '.'|| " :' ' ).
2920+ \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" convert(varchar,u.name)+ '.'+ " :' ' ).
29012921 \ " convert(varchar,o.name) " .
29022922 \ " from sysobjects o, sysusers u " .
29032923 \ " where o.uid=u.uid " .
@@ -2908,7 +2928,7 @@ function! s:DB_SQLSRV_getDictionaryTable() "{{{
29082928endfunction " }}}
29092929function ! s: DB_SQLSRV_getDictionaryProcedure () " {{{
29102930 let result = s: DB_SQLSRV_execSql (
2911- \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" convert(varchar,u.name)|| '.'|| " :' ' ).
2931+ \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" convert(varchar,u.name)+ '.'+ " :' ' ).
29122932 \ " convert(varchar,o.name) " .
29132933 \ " from sysobjects o, sysusers u " .
29142934 \ " where o.uid=u.uid " .
@@ -2919,7 +2939,7 @@ function! s:DB_SQLSRV_getDictionaryProcedure() "{{{
29192939endfunction " }}}
29202940function ! s: DB_SQLSRV_getDictionaryView () " {{{
29212941 let result = s: DB_SQLSRV_execSql (
2922- \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" convert(varchar,u.name)|| '.'|| " :' ' ).
2942+ \ " select " .(s: DB_get (' dict_show_owner' )== 1 ?" convert(varchar,u.name)+ '.'+ " :' ' ).
29232943 \ " convert(varchar,o.name) " .
29242944 \ " from sysobjects o, sysusers u " .
29252945 \ " where o.uid=u.uid " .
@@ -3627,6 +3647,9 @@ endfunction "}}}
36273647function ! s: DB_runCmd (cmd, sql)
36283648 let s: dbext_prev_sql = a: sql
36293649
3650+ if has (' win32unix' ) && s: DB_get (' use_win32_filenames' ) == 1
3651+ endif
3652+
36303653 let l: display_cmd_line = s: DB_get (' display_cmd_line' )
36313654
36323655 if l: display_cmd_line == 1
0 commit comments