in reply to Re: get response from mysql do after executing the querry like load , update etc
in thread get response from mysql do after executing the querry like load , update etc

i can execute the mysql querry using DBI. i want to know the status of the table after executing the querry, like if i load the table with data, then i want to catch the mysql db response like, Query OK, 0 rows affected, 7 warnings (0.00 sec) Records: 7 Deleted: 0 Skipped: 7 Warnings: 7
  • Comment on Re^2: get response from mysql do after executing the querry like load , update etc

Replies are listed 'Best First'.
Re^3: get response from mysql do after executing the querry like load , update etc
by Corion (Patriarch) on Feb 16, 2009 at 12:26 UTC

    Look in DBI for the number of rows affected. For the rest of the information, I don't know. Likely looking in DBI or DBD::mysql or the MySQL documentation will help you.

Re^3: get response from mysql do after executing the querry like load , update etc
by Illuminatus (Curate) on Feb 16, 2009 at 13:47 UTC
    I believe a combination of DBI and DBD::mysql can give you what you are looking for. The $sth->do method returns the number of items affected. The DBD::mysql has a 'mysql_warning_count' parameter that is non-portable, if you want to get the warnings.

    I suspect, however, that you are looking for the exact string you see from the CLI '0 rows affected, 7 arnings...). This is a common desire, but it is not coming from the engine -- this comes from the CLI (ie, running the 'mysql' command from the *nix prompt). I believe you can generate all this info yourself, just not with a single call