Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #104 - Capture SQL query output

Created: September 3, 2001 Complexity: advanced Author: meonkeys 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.

Comments

Advertisement