This is my query:
query="INSERT INTO account(address,owner_id,deleted,block_del,ts_created,block_created) VALUES($1,$2,$3,$4,$5,$6) RETURNING account_id";
After executing the query I want to know both things: affected rows
+ the account_id
serial field that has been incremented during INSERT
.
How can I do it?
If I use db.Exec()
I will only get affected rows:
result,err := db.Exec(query, addr_str, owner_id, deleted, block_del, timestamp, block_num);
affected_rows,err:=result.RowsAffected()
If I use db.QueryRow()
I can get the account_id
but I will not be able to get AffectedRows:
row:=db.QueryRow(query,addr_str,owner_id,deleted,block_del,timestamp,block_num);
account_id,err:=row.Scan(&account_id)
But how to get both of them ??? Is there any function what will return db.Row
and db.Result
at the same time ?