我在缓冲区的 .sql 文件中有这个:
CREATE TABLE WH.dbo.customer(
id INTEGER NOT NULL,
cust_name VARCHAR(30) NOT NULL,
phone_nbr VARCHAR(30) NULL,
PRIMARY KEY(id)
);
如果我处于正常模式并且光标处于打开状态,TABLE
那么我应该能够点击<Leader>se
或命令 gVim:DBExecSQLUnderCursor
并且该语句应该按照 dbext 应该找到的方式执行CREATE
,;
然后在其间执行脚本。但我收到以下消息:
Last SQL:
CREATE TABLE WHAnalysis.dbo.customer(
如果我突出显示所有脚本并从插件菜单中选择执行 SQL(可视选择),那么它运行良好。
到底是怎么回事?这可能是我的设置_vimrc
吗?:
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
" Use CTRL-S for saving, also in Insert mode
:nnoremap <C-S> :<C-U>update<CR>
:vnoremap <C-S> :<C-U>update<CR>gv
:cnoremap <C-S> <C-C>:update<CR>
:inoremap <C-S> <C-O>:update<CR>
" Microsoft SQL Server
let g:dbext_default_profile_WH = 'type=SQLSRV:user=dbuser:passwd=dbuserpassword:dsnname=SQLOLEDB.1:srvname=dwdb'
set nocp
call pathogen#infect()
syntax on
filetype plugin indent on
"Mouse and backspace
set mouse=a
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
nnoremap <Leader>p :pyf P:\Computer Applications\Python\
"quick quit command
noremap <Leader>e :quit<CR> "quits the current window
" Rebind <Leader> key
let mapleader = ","
map <Leader>n <esc>:tabprevious<CR>
map <Leader>m <esc>:tabnext<CR