Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7796297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:19:55+00:00 2026-06-01T23:19:55+00:00

Given a file which consists of multiple line MySQL queries, eg SELECT foo, bar,

  • 0

Given a file which consists of multiple line MySQL queries, eg

SELECT foo, bar, etc
FROM blah
WHERE something or other
LIMIT etc

Is there any way I can visually select a query in Vim, pipe it through MySQL, and see the query and result in a new buffer?

Clarification: I don’t want tabular output, but something that can be further processed in vim or imported into a spreadsheet (like the tab-separated output that you get from mysql –batch)
(Ubuntu Linux).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:19:57+00:00Added an answer on June 1, 2026 at 11:19 pm

    The Dbext plugin supports this behavior.

    Visually select the SQL statement, and run :DBExecRangeSQL to execute it.

    The result will be returned into a new split at the bottom of your current viewport.

    There are lots and lots of options for controlling the output window. See :help dbext for the glorious details.

    dbext example output

    Update 1.May.2012

    Version 15.0 of the plugin has been released with this functionality built in.

    The default -t flag can be overridden

    Default setting:

    let g:dbext_default_MYSQL_extra = '-t'
    

    Overridden for batch setting

    let g:dbext_default_MYSQL_extra = '--batch --raw'
    

    Dbext hard-codes the -t option to MySQL, but if that line is removed from dbext.vim, on line 2278 in DB_MYSQL_execSql (of my current version), you can pass the –batch and –raw options:

    :DBSetOption MYSQL_cmd_options='--batch --raw'
    

    To restore tabular output:

    :DBSetOption MYSQL_cmd_options='-t'
    

    I tested this successfully on my installation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given file names like these: /the/path/foo.txt bar.txt I hope to get: foo bar Why
Given a string as a form of input (parsed from an input file) which
I wrote this script which counts occurrences of particular pattern in a given file.
I have a data structure which is as given below: class File { public
Given a DFS path, how can I programatically determine which physical file server it
Given a file path such as: \\server\folder_A\folder_B\etc\more.mov I need a regex that'll give me
I have been given some file name which can be like <filename>YYYYMMDD<fileextension> some valid
Hi i have been given a php file which i believe is compiled The
In our project, we convert any given video file into mp4 file which works
I'm trying to write a *.bat file which runs all sql-scripts in given folder

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.