Datum: Tue, 03 Aug 2010 10:22:16 -0400
Von: David Fishburn<[email protected]>
An: [email protected]
Betreff: Re: Problem with DBExecSQLUnderCursor command from dbext plugin
On 8/3/2010 8:05 AM, Dennis Benzinger wrote:
Hi!
I have a problem with the DBExecSQLUnderCursor command from the dbext
plugin. From the current cursor position it searches backwards for some
SQL
keywords it knows about (e.g. select, create, etc.) and searches forward
for
the statement terminator (e.g. ;). Everything between these two
positions is
then sent to the database. This breaks if the statement contains none of
the
known keywords (e.g. show tables in MySQL) or if the statement contains
more than one of the keywords (e.g. create table xyz_bak as select * from
xyz).
Can I configure dbext so that it searches backwards for a statement
terminator to find the beginning of a statement? Would this break for
some
other statements?
What dbext searches for is configurable from your .vimrc:
By default is looks for these keywords:
'select,update,delete,insert,create,grant,alter,call,exec,merge,with'
let dbext_default_query_statements =
'select,update,delete,insert,create,grant,alter,call,exec,merge,with'
allows you to override these values.
This of course will not help you with the statement you outlined above
since it has both a SELECT and a CREATE keyword.
I almost never use DBExecSQLUnderCursor for these types of issues. What
I typically do is use LINEWISE visual mode, select the statement I want
executed and hit use<Leader>se (sql execute).
What I would suggest you do, is when you run into these style of
statements, just visually select and execute and for the other
statements which are not ambiguous, use what you are used to.