snippetsqlModerate
Commands like CREATE, GRANT, DROP always return "0 rows affected"
Viewed 0 times
rowscreatecommandsreturnalwaysgrantlikedropaffected
Problem
I was considering why some special commands in mysql like
I know there are not standard queries, but if we do
so it's countable in rather easy way.
otherwise response "Query OK (0.00 sec)" will be much accurate.
or am I missing sth?
I verify above with a few mysql version 5.1-5.5.
create user, grant privileges, drop user when correct passed return "0 rows affected", which is not true! (rows in mysql db are affected indeed)I know there are not standard queries, but if we do
delete from user where ... on mysql database, we will see N rows affected.so it's countable in rather easy way.
otherwise response "Query OK (0.00 sec)" will be much accurate.
or am I missing sth?
I verify above with a few mysql version 5.1-5.5.
Solution
The way mysql works is this ...
Performing INSERTs, UPDATEs, DELETEs explicitly names tables
SQL Commands that do not explicitly name tables have
Such commands that echo
I suppose this has always been the case.
Performing INSERTs, UPDATEs, DELETEs explicitly names tables
SQL Commands that do not explicitly name tables have
0 row(s) affectedSuch commands that echo
0 row(s) affected include- CREATE USER
- GRANT/REVOKE
- CHANGE MASTER TO (to Setup MySQL Replication)
I suppose this has always been the case.
Context
StackExchange Database Administrators Q#44812, answer score: 10
Revisions (0)
No revisions yet.