RowsAffected returns the number of rows affected. If the CommandTag was not for a row affecting command (e.g. "CREATE TABLE") then it returns 0.
()
| 860 | // RowsAffected returns the number of rows affected. If the CommandTag was not |
| 861 | // for a row affecting command (e.g. "CREATE TABLE") then it returns 0. |
| 862 | func (ct CommandTag) RowsAffected() int64 { |
| 863 | // Parse the number from the end in a single pass. |
| 864 | var n int64 |
| 865 | var mult int64 = 1 |
| 866 | |
| 867 | for i := len(ct.s) - 1; i >= 0; i-- { |
| 868 | c := ct.s[i] |
| 869 | if c >= '0' && c <= '9' { |
| 870 | n += int64(c-'0') * mult |
| 871 | mult *= 10 |
| 872 | } else { |
| 873 | break |
| 874 | } |
| 875 | } |
| 876 | |
| 877 | return n |
| 878 | } |
| 879 | |
| 880 | func (ct CommandTag) String() string { |
| 881 | return ct.s |
no outgoing calls