Hi Alexander and all,
Following are the steps that I am following for implementing "CREATE OR REPLACE" for DATABASE
"..." signifies, there exists one or more lines of code in that block of the function.
mysql_create_db(...)
...
...
if(db exists) {
if(create_or_replace) {
if(DROP_ACL access not granted) {
// Error 1
DBUG_RETURN(-1)
}
if(mysql_rm_db(...) unsuccessful) {
// Error 2
DBUG_RETURN(-1)
}
Reset m_status from diagnostics cause it is changed by mysql_rm_db.
Proceed with normal create db.
}
else if(if not exists) {
...
}
else
...
}
...
...
}
Is the above algorithm correct? Also, I am not yet sure which errors should be displayed at both the places "Error 1" and "Error 2".
I have written and tested the above code. It is working fine. Testing involves running all the existing test cases and executing "CREATE OR REPLACE DATABASE" command on the console manually. "IF NOT EXISTS" gives error if used with "CREATE OR REPLACE".
Any other test cases I need to consider?
Thanks,
Sriram