Skip to content

Commit 0846785

Browse files
Better document --skip-column-names for retrieving a specific value
1 parent bda6405 commit 0846785

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,12 @@ Executes an arbitrary SQL query using `DB_HOST`, `DB_NAME`, `DB_USER`
364364
# Execute a query stored in a file
365365
$ wp db query < debug.sql
366366

367+
# Query for a specific value in the database (pipe the result to remove the ASCII table borders)
368+
$ wp db query 'SELECT option_value FROM wp_options WHERE option_name="home"' --skip-column-names
369+
+----------------------+
370+
| https://vanilla.test |
371+
+----------------------+
372+
367373
# Check all tables in the database
368374
$ wp db query "CHECK TABLE $(wp db tables | paste -s -d, -);"
369375
+---------------------------------------+-------+----------+----------+

src/DB_Command.php

+6
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ public function cli( $_, $assoc_args ) {
423423
* # Execute a query stored in a file
424424
* $ wp db query < debug.sql
425425
*
426+
* # Query for a specific value in the database (pipe the result to remove the ASCII table borders)
427+
* $ wp db query 'SELECT option_value FROM wp_options WHERE option_name="home"' --skip-column-names
428+
* +----------------------+
429+
* | https://vanilla.test |
430+
* +----------------------+
431+
*
426432
* # Check all tables in the database
427433
* $ wp db query "CHECK TABLE $(wp db tables | paste -s -d, -);"
428434
* +---------------------------------------+-------+----------+----------+

0 commit comments

Comments
 (0)