Skip to content

Commit

Permalink
No need for doSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
eatonphil committed May 10, 2020
1 parent 0d0aa61 commit 323efd4
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,6 @@ type Conn struct {
bkd Backend
}

func (dc *Conn) doSelect(slct *SelectStatement) (driver.Rows, error) {
results, err := dc.bkd.Select(slct)
if err != nil {
return nil, err
}

return &Rows{
rows: results.Rows,
columns: results.Columns,
index: 0,
}, nil
}

func (dc *Conn) Query(query string, args []driver.Value) (driver.Rows, error) {
if len(args) > 0 {
// TODO: support parameterization
Expand Down Expand Up @@ -118,7 +105,16 @@ func (dc *Conn) Query(query string, args []driver.Value) (driver.Rows, error) {
return nil, fmt.Errorf("Error inserting values: %s", err)
}
case SelectKind:
return dc.doSelect(stmt.SelectStatement)
results, err := dc.bkd.Select(stmt.SelectStatement)
if err != nil {
return nil, err
}

return &Rows{
rows: results.Rows,
columns: results.Columns,
index: 0,
}, nil
}

return nil, nil
Expand Down

0 comments on commit 323efd4

Please sign in to comment.