History Report a problem
Article Edit this page Discussion

Capture SQL query output

From Vim Tips Wiki

Jump to: navigation, search
 

Tip 104Previous TipNext Tip

Created: September 3, 2001 Complexity: advanced Author: meonkeys Minimum version: 5.7 Karma: 13/4 Imported from: Tip#104


DBI::Shell is a Perl module that is used as a shell interface to Perl's popular DBI (database interface) package. Forget your favorite SQL navigation gui and give this method a shot. This has only been tested in Unix.

1. Run dbish (runs DBI::Shell; installed with DBI::Shell) and connect to any database.

2. In dbish, set /format box.

3. Enter your query.

4. To execute query, type "/ | vim -"

This runs the query and pipes the output to the standard input of Vim.

Here are some follow-up tips:

  • Use gvim instead of Vim so a new window will pop up.
  • Set nowrap once in Vim.

[edit] Comments

Note that if your are using MySQL cli, you can type : "pager vim -" (without the quotes indeed).

Then every select, desc, show, etc. will be opened in vim.

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Terminator Wiki
Legend of Zelda Wiki
Flash Gordon
Everquest II Wiki
Yo-Yo Wiki
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Capture SQL query output"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation