|
1 | 1 | " dbext.vim - Commn Database Utility |
2 | 2 | " Copyright (C) 2002-7, Peter Bagyinszki, David Fishburn |
3 | 3 | " --------------------------------------------------------------- |
4 | | -" Version: 11.00 |
| 4 | +" Version: 11.01 |
5 | 5 | " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> |
6 | 6 | " Authors: Peter Bagyinszki <petike1 at dpg dot hu> |
7 | 7 | " David Fishburn <dfishburn dot vim at gmail dot com> |
8 | | -" Last Modified: 2009 Aug 16 |
| 8 | +" Last Modified: 2009 Aug 27 |
9 | 9 | " Based On: sqlplus.vim (author: Jamis Buck) |
10 | 10 | " Created: 2002-05-24 |
11 | 11 | " Homepage: http://vim.sourceforge.net/script.php?script_id=356 |
@@ -37,7 +37,7 @@ if v:version < 700 |
37 | 37 | echomsg "dbext: Version 4.00 or higher requires Vim7. Version 3.50 can stil be used with Vim6." |
38 | 38 | finish |
39 | 39 | endif |
40 | | -let g:loaded_dbext_auto = 1100 |
| 40 | +let g:loaded_dbext_auto = 1101 |
41 | 41 |
|
42 | 42 | " call confirm("Loaded dbext autoload", "&Ok") |
43 | 43 | " Script variable defaults, these are used internal and are never displayed |
@@ -6049,10 +6049,6 @@ function! s:DB_runCmd(cmd, sql, result) |
6049 | 6049 | endif |
6050 | 6050 |
|
6051 | 6051 | call s:DB_addToResultBuffer(result, "add") |
6052 | | - " Determine rows affected |
6053 | | - if l:db_type !~ '\<DBI\>\|\<ODBC\>' |
6054 | | - call s:DB_{l:db_type}_stripHeaderFooter(result) |
6055 | | - endif |
6056 | 6052 |
|
6057 | 6053 | let dbi_result = 0 |
6058 | 6054 | if exists("g:dbext_dbi_result") |
@@ -6089,6 +6085,10 @@ function! s:DB_runCmd(cmd, sql, result) |
6089 | 6085 | endif |
6090 | 6086 | endif |
6091 | 6087 | if s:DB_get('autoclose') == '1' && s:dbext_result_count <= s:DB_get('autoclose_min_lines') |
| 6088 | + " Determine rows affected |
| 6089 | + if l:db_type !~ '\<DBI\>\|\<ODBC\>' |
| 6090 | + call s:DB_{l:db_type}_stripHeaderFooter(result) |
| 6091 | + endif |
6092 | 6092 | if s:dbext_result_count >= 2 |
6093 | 6093 | if getline(2) !~ '^SQLCode:' |
6094 | 6094 | call dbext#DB_windowClose(s:DB_resBufName()) |
@@ -6503,8 +6503,16 @@ function! s:DB_addToResultBuffer(output, do_clear) |
6503 | 6503 | let cmd = "perl db_print_results('".dbi_orient."')" |
6504 | 6504 | exec cmd |
6505 | 6505 | else |
| 6506 | + let g:dbext_rows_affected = 0 |
| 6507 | + let l:start_of_output = line('$') |
6506 | 6508 | silent! exec "put = a:output" |
| 6509 | + let l:end_of_output = line('$') |
| 6510 | + " Temporarily set this value as a rough estimate |
| 6511 | + " (with low cost) to be refined in DB_runCmd |
| 6512 | + " if the autoclose kicks in. |
| 6513 | + let g:dbext_rows_affected = l:end_of_output - l:start_of_output |
6507 | 6514 | endif |
| 6515 | + |
6508 | 6516 | endif |
6509 | 6517 |
|
6510 | 6518 | " Since this is a small window, remove any blanks lines |
@@ -6639,7 +6647,7 @@ function! s:DB_searchReplace(str, exp_find_str, exp_get_value, count_matches) |
6639 | 6647 | endif |
6640 | 6648 | endif |
6641 | 6649 |
|
6642 | | - if use_save_vars == 1 |
| 6650 | + if use_save_vars == 1 && has_key(b:dbext_sqlvar_mv, var) |
6643 | 6651 | let var_val = b:dbext_sqlvar_mv[var] |
6644 | 6652 | else |
6645 | 6653 | " Prompt the user using the name of the variable |
|
0 commit comments