diff --git a/doc.go b/doc.go index 00a1713..610d3c3 100644 --- a/doc.go +++ b/doc.go @@ -7,10 +7,10 @@ //TODO verify there's a graceful failure for a 2G+ blob on a 32 bit machine. -// Package ql is a pure Go embedded (S)QL database. +// Package ql implements a pure Go embedded SQL database engine. // -// QL is a SQL-like language. It is less complex and less powerful than SQL -// (whichever specification SQL is considered to be). +// QL is a member of the SQL family of languages. It is less complex and less +// powerful than SQL (whichever specification SQL is considered to be). // // Change list // diff --git a/ql.y b/ql.y index c83b735..f5233c4 100644 --- a/ql.y +++ b/ql.y @@ -3,7 +3,7 @@ //TODO Put your favorite license here // yacc source generated by ebnf2y[1] -// at 2015-05-29 16:54:37.147627427 +0200 CEST +// at 2015-05-31 12:59:36.467988124 +0200 CEST // // $ ebnf2y -o ql.y -oe ql.ebnf -start StatementList -pkg ql -p _ // diff --git a/ql/main.go b/ql/main.go index 5b0fbee..568fd70 100644 --- a/ql/main.go +++ b/ql/main.go @@ -28,6 +28,8 @@ // 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)' @@ -58,6 +60,7 @@ import ( "regexp" "sort" "strings" + "time" "github.com/cznic/ql" ) @@ -86,8 +89,16 @@ func do() (err error) { oFlds := flag.Bool("fld", false, "Show recordset's field names.") oSchema := flag.String("schema", "", "If non empty, show the CREATE statements of matching tables and exit.") oTables := flag.String("tables", "", "If non empty, list matching table names and exit.") + oTime := flag.Bool("t", false, "Measure and report time to execute the statement(s) including DB create/open/close.") flag.Parse() + t0 := time.Now() + if *oTime { + defer func() { + fmt.Fprintf(os.Stderr, "%s\n", time.Since(t0)) + }() + } + db, err := ql.OpenFile(*oDB, &ql.Options{CanCreate: true}) if err != nil { return err