Mysql Error handling


  1. Which of the following returns an SQLSTATE code?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The MySQL API call named ‘mysql_sqlstate()’ returns an SQLSTATE code. This SQLSTATE value is more ‘vendor neutral’ because it is based on the ‘ANSI SQL’ and ‘ODBC’ standards.


  1. The argument to the function mysql_error() is _______________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    The argument to the API functions ‘mysql_error()’, ‘mysql_errno()’ and ‘mysql_sqlstate()’ is a pointer to the connection handler. These should be called after an error occurs.



  1. What does mysql_real_connect() return if it fails?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    The function ‘mysql_real_connect()’ must complete successfully before any other API functions that require a valid MYSQL connection handler structure can be executed. It return NULL on failure.


  1. The function load_defaults() reads the option files.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    The function named ‘load_defaults()’ reads the option files. It takes four arguments. It does not pick up values from the environment settings. All connection paremeters can be brought to argument vector.



  1. The –protocol value ‘TCP’ runs on which operating systems?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    The connection protocol used by the option ‘–protocol = TCP’ indicates TCP/IP connection to the local or the remote server. Each –protocol value has the set of permissible OS.