Skip to content

Commit c7cee16

Browse files
artfulrobotkezhenxu94
authored andcommitted
Fix missing escaping of shell characters (#7)
1 parent 62e59d2 commit c7cee16

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugin/vim-mysql-plugin.vim

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fun! g:RunSelection()
4646
echohl Error | echon 'Nothing Selected' | echohl None
4747
return
4848
endif
49-
call writefile(l:Selection, '/tmp/vim-mysql-plugin.sql', 'w')
49+
call writefile(l:Selection, '/tmp/vim-mysql-plugin.sql')
5050

5151
let l:Command = s:GetCommand() . ' < ' . '/tmp/vim-mysql-plugin.sql'
5252
let l:Command = escape(l:Command, '%#\`')
@@ -56,14 +56,14 @@ endf
5656
func! g:SelectCursorTable()
5757
let l:Table = '`' . expand('<cword>') . '`'
5858
let l:Command = s:GetCommand() . ' -e ' . '"select * from ' . l:Table . '"'
59-
let l:Command = escape(l:Command, '%#\`')
59+
let l:Command = escape(l:Command, '$!%#\`')
6060
call g:RunShellCommand(l:Command)
6161
endfun
6262

6363
func! g:DescriptCursorTable()
6464
let l:Table = '`' . expand('<cword>') . '`'
6565
let l:Command = s:GetCommand() . ' -e ' . '"show full columns from ' . l:Table . '"'
66-
let l:Command = escape(l:Command, '%#\`')
66+
let l:Command = escape(l:Command, '$!%#\`')
6767
call g:RunShellCommand(l:Command)
6868
endfun
6969

@@ -74,7 +74,7 @@ fun! g:RunInstruction()
7474
let l:Lines = map(l:Lines, "substitute(v:val, '--.*$', '', 'g')")
7575
let l:CurrentInstruction = join(l:Lines, ' ')
7676
let l:Command = s:GetCommand() . ' -e "' . l:CurrentInstruction . '"'
77-
let l:Command = escape(l:Command, '%#\`')
77+
let l:Command = escape(l:Command, '$!%#\`')
7878
call g:RunShellCommand(l:Command)
7979
endfun
8080

0 commit comments

Comments
 (0)