php-spark/plugins/com.noccy.pdo.shell
Christopher Vagnetoft 7e04b6c001 Various fixes
* Fixed the init command not being registered
* pdoshell: Improved configuration handling
2022-02-08 01:45:55 +01:00
..
Shell Various fixes 2022-02-08 01:45:55 +01:00
PdoShellCommand.php Multiple fixes 2021-12-16 16:01:17 +01:00
README.md Updated PDO shell plugin 2021-12-17 01:48:57 +01:00
sparkplug.php Added PDO shell plugin 2021-12-16 02:39:52 +01:00

PDO Shell Plugin

This is a plugin to interactively work with PDO.

Usage

The simplest use is invoking the shell directly:

$ spark pdo:shell
PDO[db]>

You are presented with a prompt containing the string "PDO", follwed by the currently selected resource in brackets. Commands start with a period (.) and you can get a list of the valid commands with .help.

To run a query, you can either run it directly:

PDO[db]> SELECT id FROM users WHERE username='bob'

Or let the shell do the escaping for you:

PDO[db]> .query "SELECT id FROM users WHERE username=?" bob

You can also read the commands from a file and have them executed as if they were entered into the shell:

$ spark pdo:shell -r sparkrc

Selecting the resource

This can be done from the command line:

$ spark pdo:shell --db otherdb

Or from within the shell:

PDO[db]> .select otherdb
PDO[otherdb]>