GithubHelp home page GithubHelp logo

josephbuchma / qdb-mysql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from flourishsoftware/qdb-mysql

0.0 0.0 0.0 44 KB

Command line database query utility for MySQL.

License: GNU General Public License v3.0

Go 100.00%

qdb-mysql's Introduction

qdb-mysql

Command line database query utility for MySQL.

Dependencies

  • Golang
  • mysqlsh command line utility.

Docs

Docs may be generated with the docs command.

  • Outputs to the docs directory.

Environment variables:

  • MYSQL_SERVER
  • MYSQL_USER
  • MYSQL_PASS
  • MYSQL_PORT

Commands (Generate docs for more info):

  1. query
  • Queries MYSQL_SERVER using the query file (and line number) specified in the arguments.
  • If the option to generate an output file is enabled, the output file will be by the same filename as the input file.
  1. session
  • Opens a database session with MYSQL_SERVER.
  • All queries ran during the session are piped to a session file which is generated in the .qdb-mysql under your user's home directory.
  • Session filenames are generated with a unique timestammp.
  • While the session is open, you may run a query or queries from any file and/or line number.

VSCode

This utility uses VSCode for some "glossy" functions.

  • If you choose not to use VSCode, it is possible your editor can use the following features.

Features using VSCode:

  1. Piping commands into the terminal based on keyboard shortcuts and selected line number.
  • See .vscode/keybindings.json.
  • These settings will need to be installed in you user settings.
  • Example installation location (MacOS): /Users/<username>/Library/Application Support/Code/User/keybindings.json.
  1. Opening SQL results into a new editor tab.
  • See func openFile(file string) error in session.go.
  • This is done automatically after each query.
  • If a tab is already opened

Sub-Commands for session Command:

  1. q ${file}:${lineNumber}
  • Execute a query from a specific file ${file}, starting at line number ${lineNumber}.
  1. q+ ${file}:${lineNumber}
  • Same as above, but reopen the session file upon execution.
  1. q ${file}
  • Execute all queries query from a specific file ${file}.
  1. q+ ${file}
  • Same as above, but reopen the session file upon execution.

Noted Quirks

  1. Leading comments are ran as empty queries instead of being extracted prior to execution.
  2. When querying by line number, trailing comments can cause execution to continue.
  • To stop this, just use ; without any comments when delineating queries.

Contributions

You might find that this code needs some tweaks to run with your specific system or to meet your specific needs.

  • PRs are welcome, and encouraged!

qdb-mysql's People

Contributors

atljoseph avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.