提交 d1299d0b 编写于 作者: C Cosmin Popescu

solving issue 5

上级 b9dacf31
......@@ -88,12 +88,21 @@ function! sw#async_end()
unlet b:async_on_progress
if exists('b:on_async_result')
let func = b:on_async_result
unlet b:on_async_result
execute "call " . func . "()"
endif
call s:delete_tmp()
endif
endfunction
function! sw#set_on_async_result(value)
if exists('b:on_async_result') && exists('b:async_on_progress')
throw 'There is a command in progress for this buffer. Please wait for it to finish.'
endif
let b:on_async_result = a:value
endfunction
function! sw#reset_current_command()
let idx = index(g:sw_async_ended, s:get_buff_unique_id())
if idx != -1
......
......@@ -154,7 +154,7 @@ function! sw#autocomplete#cache()
let sql = sql . "WbExport -type=xml -file=" . g:sw_tmp . "/sw_procs.xml -stylesheet=" . s:script_path . "resources/wbprocedures2vim.xslt -lineEnding=lf -xsltOutput=" . g:sw_tmp . "/sw_procs.vim;\n"
let sql = sql . "WBListProcs;"
let b:on_async_result = 'sw#autocomplete#got_result'
call sw#set_on_async_result('sw#autocomplete#got_result')
let result = sw#execute_sql(b:profile, sql)
if !sw#is_async()
unlet b:on_async_result
......
......@@ -204,7 +204,7 @@ function! s:process_search_result(result, columns)
endfunction
function! s:set_async_variables(columns)
let b:on_async_result = 'sw#search#on_async_result'
call sw#set_on_async_result('sw#search#on_async_result')
let b:on_async_kill = 'sw#search#on_async_kill'
let b:__columns = a:columns
endfunction
......
......@@ -149,7 +149,7 @@ function! sw#sqlwindow#export_last()
endfunction
function! sw#sqlwindow#extract_current_sql(...)
let lines = getbufline(bufname(bufnr('.')), 1, '$')
let lines = getbufline(bufname(bufnr('%')), 1, '$')
let pos = getpos('.')
let n = pos[2] - 2
let m = n + 1
......@@ -509,7 +509,7 @@ function! sw#sqlwindow#execute_sql(sql)
if (b:max_results != 0)
let _sql = w:auto_added1 . 'set maxrows = ' . b:max_results . "\n" . b:delimiter . "\n" . w:auto_added2 . _sql
endif
let b:on_async_result = 'sw#sqlwindow#on_async_result'
call sw#set_on_async_result('sw#sqlwindow#on_async_result')
let b:on_async_kill = 'sw#sqlwindow#on_async_kill'
let result = sw#execute_sql(b:profile, _sql, 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册