sponsor Vim development Vim logo Vim Book Ad

mysqlquery : Simple and Easy to use utility for executing MySQL queries

 script karma  Rating 2/2, Downloaded by 977  Comments, bugs, improvements  Vim wiki

created by
Mantas Zimnickas
 
script type
utility
 
description
Simple and Easy to use utility for executing MySQL queries.

With this script comes only one function ExecMySQL(), so you need to bind a key to this function, for executing queries. For example:

:vmap <F9> :call ExecMySQL()<CR>
:nmap <F9> V:call ExecMySQL()<CR>

After that you need to write a SQL query, then select it (or if query consist only of one line, point cursor to it) ant press <F9>.

Query will be executed and in new buffer you will see result of that query. Results are shown in beautifully aligned table.

Best way to work with this plug-in is separate file for queries. At the beginning of that file, in one of 10 first lines you need to add connection string:

-- mysql://username:password@hostname/dbname

You can add many connection strings, but only first found string will be used. So if you want to change database, just move connection string at the very top of file.


Also I suggesting you to use this mapping for better usage:

map <F5> :b#<CR>

With this mapping, after executing a query, you can easily switch back to query editing, just by pressing <F5>.
 
install details
Simply copy this script to your vim plugins directory:

wget http://www.vim.org/scripts/download_script.php?src_id=8122 -O ~/.vim/plugin/mysqlquery.vim

Note, that this script requires elinks, so before using, apt-get it.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vimpydb.vim 0.2 2008-01-04 7.0 Mantas Zimnickas - Improved error handling.
- Added possibility to add connection string to beginning of the file, where all query's are executing.
mysqlquery.vim 0.1 2007-11-29 7.0 Mantas Zimnickas Initial upload
ip used for rating: 18.191.240.243

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github