xugusql_result.go 840 B

12345678910111213141516171819202122232425262728
  1. package xugusql
  2. type xugusqlResult struct {
  3. // Returns the number of rows affected
  4. // by update, delete and other related operations
  5. affectedRows int64
  6. // Returns the GUID number of
  7. // the insert operation (not supported)
  8. insertId int64
  9. }
  10. // LastInsertId returns the integer generated by the database
  11. // in response to a command. Typically this will be from an
  12. // "auto increment" column when inserting a new row. Not all
  13. // databases support this feature, and the syntax of such
  14. // statements varies.
  15. func (self *xugusqlResult) LastInsertId() (int64, error) {
  16. return self.insertId, nil
  17. }
  18. // RowsAffected returns the number of rows affected by an
  19. // update, insert, or delete. Not every database or database
  20. // driver may support this.
  21. func (self *xugusqlResult) RowsAffected() (int64, error) {
  22. return self.affectedRows, nil
  23. }