1
0
Fork 0

Merge pull request #155 from rqlite/fix_cli_null

Fix CLI handling of no rows
master
Philip O'Toole 8 years ago
commit 80f8333183

@ -3,6 +3,7 @@
- [PR #149](https://github.com/rqlite/rqlite/pull/149): Support configurable Raft snapshot thresholds.
- [PR #148](https://github.com/rqlite/rqlite/pull/148): Support pprof information over HTTP.
- [PR #154](https://github.com/rqlite/rqlite/pull/154): CLI now redirects to leader if necessary.
- [PR #155](https://github.com/rqlite/rqlite/pull/155): CLI now handles "no rows" correctly.
## 3.2.1 (May 22nd 2016)
- [PR #143](https://github.com/rqlite/rqlite/pull/143): Use DELETE as HTTP method to remove nodes.

@ -34,6 +34,11 @@ func (r *Rows) Get(i, j int) string {
}
return r.Columns[j]
}
if r.Values == nil {
return "NULL"
}
if i-1 >= len(r.Values) {
return "NULL"
}
@ -47,7 +52,7 @@ func (r *Rows) validate() error {
if r.Error != "" {
return fmt.Errorf(r.Error)
}
if r.Columns == nil || r.Types == nil || r.Values == nil {
if r.Columns == nil || r.Types == nil {
return fmt.Errorf("unexpected result")
}
return nil

@ -270,13 +270,13 @@ func (db *DB) Query(queries []string, tx, xTime bool) ([]*Rows, error) {
dest := make([]driver.Value, len(rows.Columns))
for {
err := rs.Next(dest)
if err != nil {
if err != io.EOF {
rows.Error = err.Error()
}
break
}
values := make([]interface{}, len(rows.Columns))
// Text values come over (from sqlite-go) as []byte instead of strings
// for some reason, so we have explicitly convert (but only when type

Loading…
Cancel
Save