~nilium/sql

03aa408f8b617f23be4dbd861f956456d0a6bab6 — Noel Cower 1 year, 5 months ago 98a99f5 v0.1.0
Fix typos, grammar in man page, README

Fix a handful of typos in the man page, and a few spots of odd grammar
in both the man page and README.
2 files changed, 36 insertions(+), 36 deletions(-)

M README.md
M sql.1.scd
M README.md => README.md +3 -3
@@ 47,14 47,14 @@ build and install it yourself:
When running `bmake install`, you can optionally set the `PREFIX` variable to
change the install location. This defaults to */usr/local*. you can also set
either `MAN_PREFIX` (default: *$PREFIX/share/man*) or `BIN_PREFIX` (default:
*$PREFIX/bin*) to set the path that manpages and binaries are installed to,
*$PREFIX/bin*) to set the path that man pages and binaries are installed to,
respectively.

## Usage

Currently, only the included scdoc man page under [sql.1.scd](./sql.1.scd)
provides usage information, or can be compiled to a man page to view it in
man(1).
provides usage information. If you have scdoc, this can be compiled to a man
page to view it in man(1). See the *Building* section above.

## License


M sql.1.scd => sql.1.scd +33 -33
@@ 11,7 11,7 @@ sql - query relational databases
# Description

The sql(1) command allows you to make arbitrary queries against a database and
retreive the results of those queries as JSON. It also has support for
retrieve the results of those queries as JSON. It also has support for
transactions for multi-query execution where one query may fail.

The gist of sql(1) is that it's intended to be a semi-universal tool for


@@ 21,46 21,46 @@ heavily on sqlx and Go's database and JSON packages to provide much of this.

## Options

*-f*, *--config*=_{file}_  
*-f*, *--config*=_{file}_
	Load INI configuration for subsequent flags from a config file. Defaults to
	searching the current directory tree, followed by
	_$XDG_CONFIG_HOME/sql/sqlrc_ and _$HOME/.sqlrc_. If *--config* is passed,
	default search paths are ignored.

*-F*, *--no-config*  
*-F*, *--no-config*
	Disable config file loading, including for any config files passed via
	*-f*, *--config*.

*-s*, *--sep*=_{sep}_ (default: *,*)  
*-s*, *--sep*=_{sep}_ (default: *,*)
	Delimit queries with the given separator.
	Must not be an empty string or the same as *-d*, *--arg-sep*.

*-d*, *--arg-sep*=_{sep}_ (default: *,,*)  
*-d*, *--arg-sep*=_{sep}_ (default: *,,*)
	Delimit groups of arguments to a query with the given separator.
	Must not be an empty string or the same as *-s*, *--sep*.

*-c*, *--compact*  
*-c*, *--compact*
	Print compacted JSON output, with each object or array separated only by
	a newline.

*-p*, *--pretty-print* (default)  
*-p*, *--pretty-print* (default)
	Print formatted and indented JSON output.

*-a*, *--array*  
*-a*, *--array*
	Write output rows as JSON arrays, with one array per query execution.

*-A*, *--no-array* (default)  
*-A*, *--no-array* (default)
	Write output rows as a stream of JSON objects.

*-j*, *--json*  
*-j*, *--json*
	Attempt to parse all fields as JSON. By default, only column types
	recognized as JSON are parsed as JSON.

*-J*, *--no-json*  
*-J*, *--no-json*
	Parse no fields as JSON. If set, columns with known JSON types will not be
	parsed as JSON.

*-t*, *--time-format*=_{format}_  
*-t*, *--time-format*=_{format}_
	Set the time format to one of the following time formats:
	- *ts*, *rfc3339*, *str* -- RFC 3339 formatted timestamp.
	- *unix*, *s*, *sec* -- A Unix integer timestamp in seconds.


@@ 72,10 72,10 @@ heavily on sqlx and Go's database and JSON packages to provide much of this.
	- *format:{layout}*, *+{layout}* -- Render the timestamp using the given
	  _{layout}_. Must be a valid Go time layout.

*-x*, *--transaction*  
*-x*, *--transaction*
	Run all queries inside of a transaction.

*-i*, *--isolation-level*=_{level}_ (default: DB preference)  
*-i*, *--isolation-level*=_{level}_ (default: DB preference)
	Set the transaction isolation level for all queries.
	Accepted isolation levels are:
	- *default* (or: *d*, *def*)


@@ 88,10 88,10 @@ heavily on sqlx and Go's database and JSON packages to provide much of this.
	- *serializable* (or: *s*, *sz*, *max*)
	- *linearizable* (or: *l*, *lin*, *lz*)

*-u*, *--username*=_{username}_, *-p*, *--password*=_{password}_  
*-u*, *--username*=_{username}_, *-p*, *--password*=_{password}_
	Set or override the username or password on the DB=_{url}_.

*-h*, *--help*  
*-h*, *--help*
	Print this usage text.

## File Substitution


@@ 101,8 101,8 @@ a file by passing *@file* for its value, where file is either a path to a file
or *-* (a hyphen) for standard input. This will load each file as it appears on
the command line.

It is not recommended to use stdin more than once, as the order of reads may
not be what you expect, depending on parameter expansion.
It is not recommended to use standard input more than once, as the order of
reads may not be what you expect, depending on parameter expansion.

## Output



@@ 149,7 149,7 @@ $ sql ${dsn} 'select 1' , 'select 2'

In addition, it is possible to pass query arguments. By default, query
arguments are bound to *?* placeholders in query strings, but may differ
epending on the driver in use. If using *?*, sql will attempt to convert
depending on the driver in use. If using *?*, sql will attempt to convert
the placeholders to a format appropriate for the driver using
<https://github.com/jmoiron/sqlx>.



@@ 183,7 183,7 @@ $ sql ${dsn} 'select ?' -{ 1 2 3 }-
{"__result_0":"1","__result_1":"2","__result_2":"3"}
```

Note that an occurence of a *?* placeholder that matches an array
Note that an occurrence of a *?* placeholder that matches an array
parameter will be expanded to multiple comma-separated *?* placeholders.
This is also an effect of using sqlx, and may not be entirely accurate,
so exercise caution when using array parameters.


@@ 216,69 216,69 @@ Type: name[, aliases]
example(s)
```

Strings: *str*, *s* (default)  
Strings: *str*, *s* (default)
```
str::Foobar
```

Bytes: *bytes*, *bs*  
Bytes: *bytes*, *bs*
```
bytes::Foobar
```

Signed int (64-bit): *int*, *i*, *l*  
Signed int (64-bit): *int*, *i*, *l*
```
int::123 int::-456
```

Unsigned int (64-bit): *uint*, *u*, *ul*  
Unsigned int (64-bit): *uint*, *u*, *ul*
```
uint::123456
```

JSON array: *array*, *a*  
JSON array: *array*, *a*
```
array::'[1,2,3,4]'
```

JSON values: *json*, *j*  
JSON values: *json*, *j*
```
json::'1 2 3 4'
```

Fields (quoted, strings): *sh*  
Fields (quoted, strings): *sh*
```
sh::'"foo" "bar"'
```

Fields (quoted, nested typing): *fields*, *fs*  
Fields (quoted, nested typing): *fields*, *fs*
```
fields::'int::1 str::2'
```

File contents as a string: *openfile*, *of*  
File contents as a string: *openfile*, *of*
```
openfile::./data
(similar to @./data)
```

File contents as bytes: *rawfile*, *rf*  
File contents as bytes: *rawfile*, *rf*
```
rawfile::./data
(similar to bytes::@./data)
```

Contents of a file descriptor: *fd*  
Contents of a file descriptor: *fd*
```
fd::4
```

Floats (64-bit): *float*, *double*, *single*, *real*, *d*, *f*  
Floats (64-bit): *float*, *double*, *single*, *real*, *d*, *f*
```
float::1.23456
```

Booleans: *bool*, *boolean*, *b*  
Booleans: *bool*, *boolean*, *b*
```
bool::true, bool::0, bool::FALSE (any form supported by Go's
strconv.ParseBool)