Mysql Error handling
- All API calls return a value.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
In MySQL, not all the API calls return a value. The client routine named ‘mysql_close()’ is one that does not. The API calls that return a value are ‘mysql_sqlstate()’, ‘mysql_error()’ etc.
- How many of the following use NULL to indicate failure?
mysql_init(), mysql_real_connect()
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Both of the client library routines named ‘mysql_init()’ and ‘mysql_real_connect()’ return a pointer to the connection handler in order to indicate success and NULL to indicate failure.
- How many of the following does not return a value?
mysql_close(), mysql_init, mysql_real_connect
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
It is not necessary that every Application Programming Interface call would return a value. For example, the client routine named ‘mysql_close()’ returns void, that is, it does not return a value.
- Which of these returns a string containing an error message?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The API call named ‘mysql_error()’ returns a string containing an error message. ‘mysql_close()’ does not return any value at all. ‘mysql_errno()’ returns a MySQL-specific numeric code.
- Which of the following returns a MySQL-specific numeric code?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The API call named ‘mysql_errorno()’ returns a MySQL-specific numeric error code. ‘mysql_error()’ returns a string containing an error message. ‘mysql_close()’ does not return any value at all.