Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ITKEY_
Vim Sql Workbench
提交
93da57e0
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,体验更适合开发者的 AI 搜索 >>
提交
93da57e0
编写于
2月 22, 2016
作者:
C
Cosmin Popescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
version 5.1
上级
156131f6
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
1042 addition
and
487 deletion
+1042
-487
README.md
README.md
+96
-0
autoload/sw.vim
autoload/sw.vim
+54
-4
autoload/sw/server.vim
autoload/sw/server.vim
+12
-5
autoload/sw/sqlwindow.vim
autoload/sw/sqlwindow.vim
+407
-120
doc/vim-sql-workbench.txt
doc/vim-sql-workbench.txt
+464
-357
plugin/sw.vim
plugin/sw.vim
+9
-1
未找到文件。
README.md
浏览文件 @
93da57e0
...
...
@@ -568,6 +568,34 @@ shortcut.
Alternatively, you can execute the
`WbDisplay`
command. See
[
here
](
http://www.sql-workbench.net/manual/console-mode.html
)
for more detail.
## Filtering the resultset
While in the result window, you can filter the displayed rows. With the cursor
on a resultset, you can just call the
`SWSqlFilterColumn`
command with the
name of the column as a parameter (you can also click
`tab`
after the command,
a list of available columns will be displayed). After this you will be asked
to insert a filter value.
The filter value can be a regular expression pattern or an arithmetic value
(this begins with
`>`
,
`<`
or
`==`
)
*Note*
: The filtering is done row by row. This means that if you have a
multirow column, the filtering will be done based on each row of that column
and not by the full value.
*Note2*
: If you want to filter for a mathematical value for equality, you have
to insert two equal signs (
`==`
). For example:
`== 471`
.
## Hiding columns
While in a result window, you can hide columns from a result set.
With the cursor on a resultset, you can call the
`SWSqlHideColumn`
command.
The command takes as an argument the name of the column to hide (there is also
an autocomplete with the available columns).
Example:
`SWSqlHideColumn last_name`
SQL commands
========================================
...
...
@@ -949,6 +977,74 @@ Reconnects the database explorer. This is useful if a timeout has occured
while having a database connection opened. Then you call the
`SWDbExplorerReconnect`
in order to be able to execute commands again.
## SWSqlShowAllColumns
This will unhide all hidden columns from the current result set
## SWSqlShowOnlyColumn
*Parameters*
:
*
column name: the name of the column to show
This will hide all the columns from the current resultset with the exception
of the mentioned column.
*Note*
: there is an autocomplete for the column name
## SWSqlShowOnlyColumns
*
column names: a list of white space separated list of columns to be shown
This will hide all the columns from the current resultset with the exception
of the mentioned columns
*Note*
: there is an autocomplete for the column names
## SWSqlShowColumn
*Parameters*
:
*
column name: the name of the column to show
This will show the indicated column name (assuming that it is hidden)
*Note*
: there is an autocomplete for the column name
## SWSqlHideColumn
*Parameters*
:
*
column name: the name of the column to hide
This will hide the indeicated column.
*Note*
: there is an autocomplete for the column name
## SWSqlFilterColumn
*Parameters*
:
*
column name: the name of the column to filter
This will apply a filter on the specified column.
*Note*
: there is an autocomplete for the column name
## SWSqlUnfilterColumn
*Parameters*
:
*
column name: the name of the column to unfilter
This will remove any filters applied on the specified column.
*Note*
: there is an autocomplete for the column name
## SWSqlRemoveAllFilters
This will remove all filters applied for the current resultset.
Settings
========================================
...
...
autoload/sw.vim
浏览文件 @
93da57e0
...
...
@@ -35,7 +35,46 @@
" asynchronous (you can execute any command asynchronous)
" fully customizable
"
"
function
!
sw
#complete_ports
(
findstart
,
base
,
P
)
let
result
=
[]
for
port
in
s:ports
if
port
=~
'^'
.
a:base
call
add
(
result
,
port
)
endif
endfor
return
result
endfunction
function
!
sw
#get_server_port
()
if
exists
(
'b:port'
)
return
b:port
endif
let
b_nr
=
bufnr
(
'%'
)
let
s:ports
=
[]
bufdo
if
exists
(
'b:port'
)
|
if
(
index
(
s:ports
,
b:port
)
<
0
)
|
call
add
(
s:ports
,
b:port
)
|
endif
|
endif
execute
"normal \<c-o>"
if
len
(
s:ports
)
==
0
return
-1
endif
if
len
(
s:ports
)
==
1
return
s:ports
[
0
]
endif
let
s:ports
=
s:ports
let
prompt
=
''
for
port
in
s:ports
let
prompt
=
prompt
.
(
prompt
==
''
?
''
:
', '
)
.
port
endfor
return
input
(
'Please choose a port ('
.
prompt
.
'): '
,
''
,
'customlist,sw#complete_ports'
)
endfunction
let
s:error
=
0
if
!
exists
(
'g:Sw_unique_id'
)
let
g:Sw_unique_id
=
1
...
...
@@ -119,10 +158,13 @@ function! sw#async_end()
endfunction
function
!
sw
#got_async_result
(
unique_id
)
let
s:error
=
0
if
s:get_buff_unique_id
()
==
a:unique_id
call
sw
#
interrupt
(
'sw#async_end()'
)
endif
redraw
!
if
!
s:error
redraw
!
endif
return
''
endfunction
...
...
@@ -152,10 +194,17 @@ endfunction
" Executes an sql command{{{1
function
!
sw
#execute_sql
(
command
,
wait_result
)
if
(!
exists
(
'b:port'
))
let
port
=
sw
#get_server_port
()
if
port
==
''
return
endif
if
(
port
==
-1
)
call
sw
#display_error
(
"This buffer is not an sql workbench buffer."
)
return
endif
let
g:sw_last_sql_query
=
a:command
if
(
exists
(
'w:auto_added1'
)
&&
exists
(
'w:auto_added2'
))
let
s1
=
substitute
(
w
:
auto_added1
,
"\n"
,
''
,
'g'
)
...
...
@@ -177,7 +226,7 @@ function! sw#execute_sql(command, wait_result)
endfor
endif
endif
return
sw
#server#execute_sql
(
a:command
,
a:wait_result
,
b:
port
)
return
sw
#server#execute_sql
(
a:command
,
a:wait_result
,
port
)
endfunction
" Exports as ods{{{1
...
...
@@ -446,6 +495,7 @@ function! sw#autocomplete_profile_for_buffer(ArgLead, CmdLine, CursorPos)
endfunction
function
!
sw
#display_error
(
msg
)
let
s:error
=
1
echohl WarningMsg
echomsg
a:msg
echohl None
...
...
autoload/sw/server.vim
浏览文件 @
93da57e0
...
...
@@ -93,13 +93,20 @@ function! s:pipe_execute(type, cmd, wait_result, ...)
let
uid
=
b:unique_id
endif
let
s
tatements
=
0
let
s
ql
=
a:cmd
if
a:type
==
'COM'
||
a:type
==
'DBE'
let
delimiter
=
';'
if
exists
(
'b:delimiter'
)
let
delimiter
=
b:delimiter
endif
let
statements
=
len
(
sw
#sql_split
(
a:cmd
,
delimiter
))
let
statements
=
sw
#sql_split
(
a:cmd
,
delimiter
)
let
sql
=
''
for
statement
in
statements
let
sql
.=
(
sql
==
''
?
''
:
delimiter
.
"\n==========\n"
)
.
statement
endfor
if
!(
a:cmd
=~
'\v^[^\n]+\n$'
)
let
sql
.=
delimiter
endif
endif
try
...
...
@@ -108,7 +115,7 @@ import vim
import
socket
import
re
identifier
=
vim
.
eval
(
'v:servername'
)
+
"#"
+
vim
.
eval
(
'uid'
)
cmd
=
vim
.
eval
(
'
a:cmd
'
)
cmd
=
vim
.
eval
(
'
sql
'
)
port
=
int
(
vim
.
eval
(
'port'
))
type
=
vim
.
eval
(
'a:type'
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
...
...
@@ -116,10 +123,10 @@ s.connect(('127.0.0.1', port))
packet
=
''
packet
+=
type
if
vim
.
eval
(
'a:wait_result'
)
==
'0'
and
vim
.
eval
(
'a:type'
)
!=
'VAL'
:
packet
+=
"!#identifier = "
+
identifier
+
"\n"
packet
+=
'?'
+
identifier
+
'?'
#end
if
packet
+=
cmd
packet
=
str
(
len
(
packet
))
+
"
?"
+
vim
.
eval
(
'statements'
)
+
"
#"
+
packet
packet
=
str
(
len
(
packet
))
+
"#"
+
packet
s
.
sendall
(
packet
)
result
=
''
if
vim
.
eval
(
'a:wait_result'
)
==
'1'
:
...
...
autoload/sw/sqlwindow.vim
浏览文件 @
93da57e0
此差异已折叠。
点击以展开。
doc/vim-sql-workbench.txt
浏览文件 @
93da57e0
此差异已折叠。
点击以展开。
plugin/sw.vim
浏览文件 @
93da57e0
...
...
@@ -186,6 +186,14 @@ command! -bang -nargs=* SWSqlAutocomplete call sw#autocomplete#cache(<bang>0, <f
command
!
-
nargs
=
1
-
complete
=
customlist
,
sw
#autocomplete#complete_cache_name SWSqlAutocompleteLoad
call
sw
#autocomplete#load
(<
f
-
args
>)
command
!
-
nargs
=
1
-
complete
=
customlist
,
sw
#autocomplete#complete_cache_name SWSqlAutocompletePersist
call
sw
#autocomplete#persist
(<
f
-
args
>)
command
!
SWSqlBufferRestore
call
sw
#session#restore_sqlbuffer
()
command
!
-
nargs
=
0
SWSqlShowAllColumns
call
sw
#sqlwindow#show_all_columns
()
command
!
-
nargs
=
1
-
complete
=
customlist
,
sw
#sqlwindow#complete_columns SWSqlShowOnlyColumn
call
sw
#sqlwindow#show_only_column
(<
f
-
args
>)
command
!
-
nargs
=+
-
complete
=
customlist
,
sw
#sqlwindow#complete_columns SWSqlShowOnlyColumns
call
sw
#sqlwindow#show_only_columns
([<
f
-
args
>])
command
!
-
nargs
=
1
-
complete
=
customlist
,
sw
#sqlwindow#complete_columns SWSqlShowColumn
call
sw
#sqlwindow#show_column
(<
f
-
args
>,
1
)
command
!
-
nargs
=
1
-
complete
=
customlist
,
sw
#sqlwindow#complete_columns SWSqlHideColumn
call
sw
#sqlwindow#hide_column
(<
f
-
args
>,
1
)
command
!
-
nargs
=
1
-
complete
=
customlist
,
sw
#sqlwindow#complete_columns SWSqlFilterColumn
call
sw
#sqlwindow#filter_column
(<
f
-
args
>)
command
!
-
nargs
=
1
-
complete
=
customlist
,
sw
#sqlwindow#complete_columns SWSqlUnfilterColumn
call
sw
#sqlwindow#un_filter_column
(<
f
-
args
>)
command
!
-
nargs
=
0
SWSqlRemoveAllFilters
call
sw
#sqlwindow#remove_all_filters
()
command
!
-
nargs
=+
-
complete
=
customlist
,
sw
#autocomplete_profile SWServerStart
call
sw
#server#run
(<
f
-
args
>)
command
!
-
nargs
=
1
SWServerStop
call
sw
#server#
stop
(<
f
-
args
>)
...
...
@@ -193,7 +201,7 @@ command! -nargs=1 SWServerStop call sw#server#stop(<f-args>)
augroup
sw
autocmd
sw
BufDelete
,
BufWipeout
*
call
sw
#session#
sync
()
autocmd
sw
SessionLoadPost
*
call
sw
#session#restore
()
autocmd
sw
BufEnter
*
call
sw
#sqlwindow#close_all_result_sets
()
""
autocmd sw BufEnter * call sw#sqlwindow#close_all_result_sets()
""autocmd sw BufEnter * call sw#session#check()
""autocmd sw TabEnter * call sw#dbexplorer#restore_from_session()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录