Documentation ¶
Overview ¶
Command ql is a utility to explore a database, prototype a schema or test drive a query, etc.
Installation:
$ go get github.com/cznic/ql/ql
Usage:
ql [-db name] [-schema regexp] [-tables regexp] [-fld] statement_list
Options:
-db name Name of the database to use. Defaults to "ql.db". If the DB file does not exists it is created automatically. -schema re If re != "" show the CREATE statements of matching tables and exit. -tables re If re != "" show the matching table names and exit. -fld First row of a query result set will show field names. statement_list QL statements to execute. If no non flag arguments are present, ql reads from stdin. The list is wrapped into an automatic transaction. -t Report and measure time to execute, including creating/opening and closing the DB.
Example:
$ ql 'create table t (i int, s string)' $ ql << EOF > insert into t values > (1, "a"), > (2, "b"), > (3, "c"), > EOF $ ql 'select * from t' 3, "c" 2, "b" 1, "a" $ ql -fld 'select * from t where i != 2 order by s' "i", "s" 1, "a" 3, "c" $
Click to show internal directories.
Click to hide internal directories.