https://github.com/go-gorm/playground/pull/101
When I'm using Raw(...) for query raw sql, logger always report there is 0 returned, while it's actually not.
You could see the last failure expectation in PR
This could lead to misbehavior when monitor sql log
When you are querying with Rows,Row, GORM can't get the affected row ;(
But RowsAffected should works when use Raw with Scan
@jinzhu The problem here is tracer provides wrong info (returned rows), this could lead to misbehavior when monitor sql logging (in logger I have no idea how to detect sql query is called from Raw or from Scan/Find method.
Anw, thank you for your suggestion, I will change to use Scan instead of Rows for my monitoring. However, I still think this is a bug
@jinzhu The problem here is tracer provides wrong info (returned rows), this could lead to misbehavior when monitor sql logging (in logger I have no idea how to detect sql query is called from Raw or from Scan/Find method.
What I only can do it change it to -1 for Row, Rows, Exec, but not sure if it is good.... maybe we can visit it later to see if other people have similar questions.
Wow, I spent a good deal of time wondering why my perfectly formed query was returning zero rows. This is a bug, agree with @pvhau
The tracer still doesn't return correct number of rows. :( My statement is of the following structure:
db.Table().Select().Joins().Where().Scan()
@sashankaryal Because issue was closed, I think you should create another issue with playground and ref to this to re-open issue. May be @jinzhu missed out you comments