I've written a program that allows users to put in MySQL queries and get results from it. Those queries can be selects, inserts, update, delete etc. I would a better sample of the code but currently the code is over 1000+ lines, but I do something like this:
db,err :=sql.Open(mysql, loginCreds) rows, err db.Query("<user given query>") This works, and you can do selects, inserts, deletes, drop -- basically any query you can run with the mysql client will work, but what you're missing is when it doesn't have any rows to display is the rows affected (such as an insert or update). I have nothing to return to the user other than the query worked. So the user has no idea if 1 or 10000 rows were updated or deleted from the query. For this I'd have to be using db.Exec which returns an sql.Result, where I can pull the rows affected. Is there a way to get rows affected from a query? I don't want to have a decision tree to figure out based on the query given to use sql.Exec or sql.Query. I am not that good of a DBA to be able to figure that out. :) Thanks, Rich -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/cdddfce5-0fd8-4776-844b-1f5cd5ef33b0%40googlegroups.com.