Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return a odpsResult instead of nil while running Exec #17

Merged
merged 3 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
nohup.out
*~
*.vim
*~
*.test
/Gopkg.lock
Expand Down
6 changes: 5 additions & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ func (conn *odpsConn) Exec(query string, args []driver.Value) (driver.Result, er
return nil, err
}
_, err = conn.getInstanceResult(ins)
return nil, err
if err != nil {
return nil, err
}
// FIXME(weiguo): precise result
return &odpsResult{-1, -1}, nil
}

// Implements database/sql/driver.Queryer
Expand Down
15 changes: 15 additions & 0 deletions result.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package gomaxcompute

// odpsResult implements https://golang.org/pkg/database/sql/driver/#Result
type odpsResult struct {
affectedRows int64
insertId int64
}

func (res *odpsResult) LastInsertId() (int64, error) {
return res.insertId, nil
}

func (res *odpsResult) RowsAffected() (int64, error) {
return res.affectedRows, nil
}