Mysql Error handling


  1. All API calls return a value.











  1. 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.


  1. How many of the following use NULL to indicate failure?
    mysql_init(), mysql_real_connect()











  1. 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.



  1. How many of the following does not return a value?
    mysql_close(), mysql_init, mysql_real_connect











  1. 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.


  1. Which of these returns a string containing an error message?











  1. 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.



  1. Which of the following returns a MySQL-specific numeric code?











  1. 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.