I'm writing a block of several entries to the database ( could be 1000 at a time )
And I see two different ways.. my current method doesn't display the error from mysql on duplicate entry inside a system message. instead it throws a mysql error on white page like you would see in phpmyadmin.
I notice on the one with the catch ( the left ) he's creating the dbo but on mine i'm not.. which is right? Why is mine working? I'm only interested in if $line is a duplicate.. with 90k+ records its not practical do to a query to check.
Bear
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.
I got to thinking what I really need is instead of INSERT, i need INSERT IGNORE for the "Entry" field
Bear
On 5/21/2016 05:58, sovainfo wrote:
Yours is right. It makes no sense to get the DBO and create the $query and not using it. The insertObject () is passing the information. $query is not used to create the statement and then passed to $db.--
Your solution doesn't have error handling, so it should be covered by a try/catch. The try/catch on the left is incorrect: it treats any error as an insert duplicate error, which is wrong. On top of that it will create the same blank page when it is not an duplicate error. You can't update something when there is a problem with the connection!
So, the catch should contain code that logs the errors. Don't consider it appropriate to put it in the message queue. You don't know how many to expect.
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.