Re: logging of sql queries - success/failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, June 7, 2007 2:12 pm, Bosky, Dave wrote:
> I've got a script that imports several CSV files via the Load Data
> File
> command.
>
> I need to know if each import query was successful or failed.
>
>
>
> Is there a way to log the success/failure of each query including how
> many rows were inserted?

I don't think so, but MAYBE mysql_affected_rows would return that data...

If any of the rows fail, I'd expect the mysql_error() would have some
kind of error message in it, and your result would be === false, I
think.

Another option would be to do a select count(*) before and after, and
subtract the difference.  You could also compare that to the number of
lines in the file, and "know" if it all went okay.

Wrap it all in a transaction, if there's any chance another process
could be adding/deleting rows at the same time.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux