Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ITKEY_
Vim Sql Workbench
提交
f238516a
V
Vim Sql Workbench
项目概览
ITKEY_
/
Vim Sql Workbench
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vim Sql Workbench
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f238516a
编写于
12月 23, 2016
作者:
C
Cosmin Popescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
version 6.3
上级
4515f6d4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
104 addition
and
15 deletion
+104
-15
README.md
README.md
+12
-0
autoload/sw.vim
autoload/sw.vim
+4
-0
autoload/sw/server.vim
autoload/sw/server.vim
+4
-0
autoload/sw/sqlwindow.vim
autoload/sw/sqlwindow.vim
+68
-8
doc/vim-sql-workbench.txt
doc/vim-sql-workbench.txt
+14
-7
plugin/sw.vim
plugin/sw.vim
+2
-0
未找到文件。
README.md
浏览文件 @
f238516a
...
@@ -1050,6 +1050,16 @@ is performed is returned. Otherwise you will see the log.
...
@@ -1050,6 +1050,16 @@ is performed is returned. Otherwise you will see the log.
This command will re-open the resultsets window without sending a new command
This command will re-open the resultsets window without sending a new command
to the DBMS.
to the DBMS.
## SWSqlDeleteResultSet
This command will delete the currently selected resultset from the resultsets
window.
## SWSqlRefreshResultSet
This command will refresh the currently selected resultset from the resultsets
window.
Settings
Settings
========================================
========================================
...
@@ -1129,6 +1139,8 @@ and
...
@@ -1129,6 +1139,8 @@ and
*
`g:sw_save_resultsets`
: if true, then all the resultsets will be saved,
*
`g:sw_save_resultsets`
: if true, then all the resultsets will be saved,
event if you close the resultsets window; to clear the resultsets window,
event if you close the resultsets window; to clear the resultsets window,
use
`SWSqlWipeoutResultsSets`
command.
use
`SWSqlWipeoutResultsSets`
command.
*
`g:sw_config_dir`
: the config dir of the
`SQL Workbench/J`
(works only with
build 121.4 and more)
Screen shots
Screen shots
========================================
========================================
...
...
autoload/sw.vim
浏览文件 @
f238516a
...
@@ -82,6 +82,10 @@ if !exists('g:Sw_unique_id')
...
@@ -82,6 +82,10 @@ if !exists('g:Sw_unique_id')
let
g:Sw_unique_id
=
1
let
g:Sw_unique_id
=
1
endif
endif
if
exists
(
'g:sw_config_dir'
)
&&
!(
g:sw_config_dir
=~
'\v\/$'
)
let
g:sw_config_dir
.=
'/'
endif
function
!
sw
#find_buffer_by_unique_id
(
uid
)
function
!
sw
#find_buffer_by_unique_id
(
uid
)
for
k
in
keys
(
g:sw_session
)
for
k
in
keys
(
g:sw_session
)
if
has_key
(
g:sw_session
[
k
],
'unique_id'
)
if
has_key
(
g:sw_session
[
k
],
'unique_id'
)
...
...
autoload/sw/server.vim
浏览文件 @
f238516a
...
@@ -150,6 +150,10 @@ function! s:start_sqlwb(type)
...
@@ -150,6 +150,10 @@ function! s:start_sqlwb(type)
let
vid
=
substitute
(
v
:
servername
,
'\v\/'
,
'-'
,
'g'
)
.
sw
#generate_unique_id
()
let
vid
=
substitute
(
v
:
servername
,
'\v\/'
,
'-'
,
'g'
)
.
sw
#generate_unique_id
()
let
cmd
=
[
g:sw_exe
,
'-feedback=true'
,
'-showProgress=false'
,
'-showTiming=true'
,
'-nosettings'
,
'-variable=vid='
.
vid
]
let
cmd
=
[
g:sw_exe
,
'-feedback=true'
,
'-showProgress=false'
,
'-showTiming=true'
,
'-nosettings'
,
'-variable=vid='
.
vid
]
if
exists
(
'g:sw_config_dir'
)
call
add
(
cmd
,
'-configDir='
.
g:sw_config_dir
)
endif
let
valid_exe
=
1
let
valid_exe
=
1
if
!
filereadable
(
g:sw_exe
)
if
!
filereadable
(
g:sw_exe
)
echom
g:sw_exe
.
" is not readable. Make sure the setting g:sw_exe is set and the file exists."
echom
g:sw_exe
.
" is not readable. Make sure the setting g:sw_exe is set and the file exists."
...
...
autoload/sw/sqlwindow.vim
浏览文件 @
f238516a
...
@@ -546,6 +546,7 @@ function! s:open_resultset_window()
...
@@ -546,6 +546,7 @@ function! s:open_resultset_window()
call
sw
#session#init_section
()
call
sw
#session#init_section
()
call
sw
#set_special_buffer
()
call
sw
#set_special_buffer
()
call
sw
#sqlwindow#set_results_shortcuts
()
call
sw
#sqlwindow#set_results_shortcuts
()
execute
"autocmd! BufLeave "
.
bufname
(
'%'
)
.
" let b:position = getcurpos()"
if
!
s_below
if
!
s_below
set
nosplitbelow
set
nosplitbelow
endif
endif
...
@@ -739,13 +740,16 @@ function! s:display_resultsets(continous)
...
@@ -739,13 +740,16 @@ function! s:display_resultsets(continous)
setlocal
foldmethod
=
expr
setlocal
foldmethod
=
expr
setlocal
foldexpr
=
sw
#sqlwindow#folding
(
v
:
lnum
)
setlocal
foldexpr
=
sw
#sqlwindow#folding
(
v
:
lnum
)
""normal zMggjza
""normal zMggjza
normal zR
""
normal zR
else
else
call
s:display_resultsets_separate
()
call
s:display_resultsets_separate
()
endif
endif
if
(
exists
(
'b:position'
)
&&
b:state
==
'resultsets'
)
if
(
exists
(
'b:position'
)
&&
b:state
==
'resultsets'
&&
!
s:new_resultset
)
call
setpos
(
'.'
,
b:position
)
call
setpos
(
'.'
,
b:position
)
normal zv
elseif
b:state
==
'messages'
||
s:new_resultset
normal zMzv
endif
endif
endfunction
endfunction
...
@@ -755,7 +759,27 @@ function! s:add_new_resultset(channel, id)
...
@@ -755,7 +759,27 @@ function! s:add_new_resultset(channel, id)
else
else
let
query
=
''
let
query
=
''
endif
endif
call
add
(
b:resultsets
,
{
'messages'
:
[],
'lines'
:
[],
'hidden_columns'
:
[],
'resultset_start'
:
0
,
'header'
:
[],
'filters'
:
{},
'title'
:
''
,
'rows'
:
0
,
'channel'
:
a:channel
,
'sql'
:
query
,
'id'
:
a:id
})
let
n
=
s:get_next_resultset
()
let
result
=
{
'messages'
:
[],
'lines'
:
[],
'hidden_columns'
:
[],
'resultset_start'
:
0
,
'header'
:
[],
'filters'
:
{},
'title'
:
''
,
'rows'
:
0
,
'channel'
:
a:channel
,
'sql'
:
query
,
'id'
:
a:id
,
'wait_refresh'
:
0
}
if
n
==
len
(
b:resultsets
)
call
add
(
b:resultsets
,
result
)
let
s:new_resultset
=
1
else
let
s:new_resultset
=
0
let
b:resultsets
[
n
]
=
result
endif
return
n
endfunction
function
!
s:get_next_resultset
()
for
i
in
range
(
len
(
b:resultsets
))
if
b:resultsets
[
i
][
'wait_refresh'
]
&&
b:resultsets
[
i
][
'sql'
]
==
g:sw_last_sql_query
return
i
endif
endfor
return
len
(
b:resultsets
)
endfunction
endfunction
function
!
s:process_result
(
channel
,
result
)
function
!
s:process_result
(
channel
,
result
)
...
@@ -776,14 +800,12 @@ function! s:process_result(channel, result)
...
@@ -776,14 +800,12 @@ function! s:process_result(channel, result)
let
i
=
0
let
i
=
0
let
mode
=
'message'
let
mode
=
'message'
let
resultset_id
=
sw
#generate_unique_id
()
let
resultset_id
=
sw
#generate_unique_id
()
call
s:add_new_resultset
(
a:channel
,
resultset_id
)
let
n
=
s:add_new_resultset
(
a:channel
,
resultset_id
)
let
n
=
len
(
b:resultsets
)
-
1
while
i
<
len
(
lines
)
while
i
<
len
(
lines
)
if
i
+
1
<
len
(
lines
)
&&
lines
[
i
+
1
]
=~
sw
#get_pattern
(
'pattern_resultset_start'
)
if
i
+
1
<
len
(
lines
)
&&
lines
[
i
+
1
]
=~
sw
#get_pattern
(
'pattern_resultset_start'
)
"" If we have more than one resultset in a go.
"" If we have more than one resultset in a go.
if
len
(
b:resultsets
[
n
].
lines
)
>
0
if
len
(
b:resultsets
[
n
].
lines
)
>
0
let
n
+=
1
let
n
=
s:add_new_resultset
(
a:channel
,
resultset_id
)
call
s:add_new_resultset
(
a:channel
,
resultset_id
)
endif
endif
let
mode
=
'resultset'
let
mode
=
'resultset'
let
b:resultsets
[
n
].
resultset_start
=
len
(
b:resultsets
[
n
].
lines
)
let
b:resultsets
[
n
].
resultset_start
=
len
(
b:resultsets
[
n
].
lines
)
...
@@ -960,7 +982,7 @@ function! s:filter_resultsets(idx, val)
...
@@ -960,7 +982,7 @@ function! s:filter_resultsets(idx, val)
return
exists
(
'b:sw_channel'
)
?
a:val
[
'channel'
]
!=
b:sw_channel
:
a:val
[
'channel'
]
!=
b:current_channel
return
exists
(
'b:sw_channel'
)
?
a:val
[
'channel'
]
!=
b:sw_channel
:
a:val
[
'channel'
]
!=
b:current_channel
endfunction
endfunction
function
sw
#sqlwindow#wipeout_resultsets
(
all
)
function
!
sw
#sqlwindow#wipeout_resultsets
(
all
)
if
a:all
if
a:all
let
g:sw_last_resultset
=
[]
let
g:sw_last_resultset
=
[]
elseif
exists
(
'b:sw_channel'
)
||
exists
(
'b:current_channel'
)
elseif
exists
(
'b:sw_channel'
)
||
exists
(
'b:current_channel'
)
...
@@ -981,3 +1003,41 @@ function! sw#sqlwindow#get_count(statement)
...
@@ -981,3 +1003,41 @@ function! sw#sqlwindow#get_count(statement)
endif
endif
call
sw
#sqlwindow#execute_sql
(
sql
)
call
sw
#sqlwindow#execute_sql
(
sql
)
endfunction
endfunction
function
!
sw
#sqlwindow#refresh_resultset
()
let
n
=
s:get_n_resultset
()
let
sql
=
b:resultsets
[
n
][
'sql'
]
let
channel
=
b:resultsets
[
n
][
'channel'
]
let
file
=
''
for
info
in
getbufinfo
()
if
getbufvar
(
info
[
'bufnr'
],
'sw_channel'
)
==
channel
let
file
=
info
[
'name'
]
break
endif
endfor
if
file
!=
''
let
id
=
b:resultsets
[
n
][
'id'
]
for
resultset
in
b:resultsets
if
resultset
[
'id'
]
==
id
let
resultset
[
'wait_refresh'
]
=
1
endif
endfor
call
sw
#goto_window
(
file
)
if
bufname
(
'%'
)
==
sw
#sqlwindow#get_resultset_name
()
call
sw
#display_error
(
"Could not identify the buffer for this resultset"
)
return
endif
call
sw
#execute_sql
(
sql
)
endif
endfunction
function
!
s:delete_filter
(
idx
,
val
)
return
a:val
[
'id'
]
!=
s:_id
endfunction
function
!
sw
#sqlwindow#delete_resultset
()
let
n
=
s:get_n_resultset
()
let
s:_id
=
b:resultsets
[
n
][
'id'
]
call
filter
(
b:resultsets
,
function
(
's:delete_filter'
))
call
s:display_resultsets
(
1
)
endfunction
doc/vim-sql-workbench.txt
浏览文件 @
f238516a
...
@@ -1093,6 +1093,18 @@ SWSQLSHOWLASTRESULTSET *vim-sql-workbench-swsqlshowlastresultse
...
@@ -1093,6 +1093,18 @@ SWSQLSHOWLASTRESULTSET *vim-sql-workbench-swsqlshowlastresultse
This command will re-open the resultsets window without sending a new command
This command will re-open the resultsets window without sending a new command
to the DBMS.
to the DBMS.
--------------------------------------------------------------------------------
SWSQLDELETERESULTSET *vim-sql-workbench-swsqldeleteresultset*
This command will delete the currently selected resultset from the resultsets
window.
--------------------------------------------------------------------------------
SWSQLREFRESHRESULTSET *vim-sql-workbench-swsqlrefreshresultset*
This command will refresh the currently selected resultset from the resultsets
window.
================================================================================
================================================================================
SETTINGS *vim-sql-workbench-settings*
SETTINGS *vim-sql-workbench-settings*
...
@@ -1177,11 +1189,6 @@ GENERAL SETTINGS: *vim-sql-workbench-general_settings
...
@@ -1177,11 +1189,6 @@ GENERAL SETTINGS: *vim-sql-workbench-general_settings
* `g:sw_save_resultsets`: if true, then all the resultsets will be saved,
* `g:sw_save_resultsets`: if true, then all the resultsets will be saved,
event if you close the resultsets window; to clear the resultsets window,
event if you close the resultsets window; to clear the resultsets window,
use `SWSqlWipeoutResultsSets` command.
use `SWSqlWipeoutResultsSets` command.
* `g:sw_config_dir`: the config dir of the (works only with
build 121.4 and more)
plugin/sw.vim
浏览文件 @
f238516a
...
@@ -198,6 +198,8 @@ command! -nargs=* -complete=file SWSqlBufferDisconnect call sw#server#disconnect
...
@@ -198,6 +198,8 @@ command! -nargs=* -complete=file SWSqlBufferDisconnect call sw#server#disconnect
command
!
SWSqlExecuteCurrent
call
sw
#sqlwindow#execute_sql
(
sw
#sqlwindow#extract_current_sql
())
command
!
SWSqlExecuteCurrent
call
sw
#sqlwindow#execute_sql
(
sw
#sqlwindow#extract_current_sql
())
command
!
SWSqlExecuteSelected
call
sw
#sqlwindow#execute_sql
(
sw
#sqlwindow#extract_selected_sql
())
command
!
SWSqlExecuteSelected
call
sw
#sqlwindow#execute_sql
(
sw
#sqlwindow#extract_selected_sql
())
command
!
SWSqlExecuteAll
call
sw
#sqlwindow#execute_sql
(
sw
#sqlwindow#extract_all_sql
())
command
!
SWSqlExecuteAll
call
sw
#sqlwindow#execute_sql
(
sw
#sqlwindow#extract_all_sql
())
command
!
SWSqlRefreshResultSet
call
sw
#sqlwindow#refresh_resultset
()
command
!
SWSqlDeleteResultSet
call
sw
#sqlwindow#delete_resultset
()
command
!
-
nargs
=
0
SWSqlGetSqlCount
call
sw
#sqlwindow#get_count
(
sw
#sqlwindow#extract_current_sql
())
command
!
-
nargs
=
0
SWSqlGetSqlCount
call
sw
#sqlwindow#get_count
(
sw
#sqlwindow#extract_current_sql
())
command
!
-
nargs
=
0
SWSqlGetObjRows
call
sw
#sqlwindow#get_count
(
expand
(
'<cword>'
))
command
!
-
nargs
=
0
SWSqlGetObjRows
call
sw
#sqlwindow#get_count
(
expand
(
'<cword>'
))
command
!
-
nargs
=
0
SWSqlShowActiveConnections echo
sw
#server#get_active_connections
()
command
!
-
nargs
=
0
SWSqlShowActiveConnections echo
sw
#server#get_active_connections
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录