dbext and mysql odbc

25 views
Skip to first unread message

Mansour Al Akeel

unread,
Dec 9, 2008, 11:30:12 PM12/9/08
to vim...@googlegroups.com
Hello all,
I am trying to run vim as mysql client as I had enough with the query
browser. things are not going very well and not a lot of resources on
the net. The tutorial that comes with it, is long and tends to show the
features more than showing how to use them. If some one on this list
have had any luck with this plugin, please let me know how to choose a
profile when you start vim. If there's a link to a tutorial that gives
step-by-step guide to this plugin, it will be a great help.

Thank you in advance.


Albie Janse van Rensburg

unread,
Dec 10, 2008, 6:23:11 AM12/10/08
to vim...@googlegroups.com

David Fishburn (the plugin author) does read this mailing list, so he
might be able to give some more pointers. I use dbext every day to
speak to Microsoft SQL Server and MySQL, and it works really well. I
learned to use the plugin by reading the accompanying documentation.
The documentation could maybe do with a bit of restructuring, but I had
little trouble getting set up.

This is my string for defining a profile in my vimrc (I have about 8 of
them):
let g:dbext_default_profile_dev_mysql =
'type=MYSQL:user=root:passwd=012345:dbname=dev:host=localhost:extra=-t'

I got it by copying the MySQL example string from the documentation.
Note that the name that will appear when you execute <leader>sbp is
determined by the part of the global variable name following
"g:dbext_default_profile_"

If you can be more specific about what you're having trouble with, I can
try to assist.

Regards


--

[ Albie Janse van Rensburg ~ http://morph.telspace.co.za ]

Familiarity breeds attempt.

David Fishburn

unread,
Dec 10, 2008, 9:43:34 AM12/10/08
to vim...@googlegroups.com
On 12/9/08, Mansour Al Akeel <mansour...@gmail.com> wrote:
>
> I am trying to run vim as mysql client as I had enough with the query
> browser. things are not going very well and not a lot of resources on
> the net. The tutorial that comes with it, is long and tends to show the
> features more than showing how to use them.

That is true, the idea with the tutorial is to take you through some
of the more common features so that you are aware of them. Then you
simply adopt the ones that will be most useful to you.

The tutorial also does not cover all the features of the plugin.

> If some one on this list
> have had any luck with this plugin, please let me know how to choose a
> profile when you start vim.

You didn't specify which version of the plugin you have installed, but
the tutorial (which has been updated recently) has the following
information.

If for a specific file, you want it to use a predefined profile:
***
let g:dbext_default_profile_usual = 'type=ASA:user=DBA:passwd=SQL'

Then in your SQL files, you can add the following line where "//" is simply
a comment line marker for SQL files. Comment indicators change by
filetype.
// dbext:profile=usual
***

And more specifically to your question about specifying a default
profile to be used unless overridden:
***
If you always want dbext to use a specific profile for every new buffer
(unless overriden in your modelines) you can add the following to your
vimrc (using the profile created above):
let g:dbext_default_profile = 'usual'
***


> So, If there's a link to a tutorial that gives


> step-by-step guide to this plugin, it will be a great help.

That is really what the tutorial is designed to do.

If you are finding it is not providing enough of what you need,
_please_ point out the sections where you think it can be improved.
Indicate what information you were looking for and what was not clear
enough.

I am very happy to update the tutorial to make it better.


From the perspective of what I use daily with it, or perhaps "how" I use it.
1. I have about 60 different profiles defined (different projects and
customers).
2. I am always Visually highlighting text and hitting <Leader>se to execute it.
3. In the result window, I often hit "R" to refresh (ie re-run the last query).
4. I either Visually select a table name or (if a simple word) hit
<Leader>st to select from that table.
5. I often use <Leader>slt to List Tables to remember how to spell something.

So the above 5 I do about 10,000 times a day.

But there are many, many other features I use during development like
generating a column list (for an INSERT or UPDATE statement
<Leader>slc).

I also use it with the OMNI code completion for column and table name
completion which saves a lot of typing and typos.
:h omni-sql-completion


Please feel free to send me questions.

Dave

Mansour Al Akeel

unread,
Dec 14, 2008, 10:42:40 AM12/14/08
to vim...@googlegroups.com
Albie,
Sorry for the late reply. And Thank you, That helped me a lot. This line
is what I needed

dbext_default_profile_dev_mysql =
'type=MYSQL:user=root:passwd=012345:dbname=dev:host=localhost:extra=-t'

The example in the tutorial, used odbc connection, and 'type=ODBC' as
well which was the reason of the confusion.

Thank you.

Reply all
Reply to author
Forward
0 new messages