Yes my tables are InnoDB, but Cake doesn't make a single transaction
when saveAll() is called with 'atomic'=>false. Here is the part from
mysql log when calling saveAll:
104 Query INSERT INTO `employee_mailbox_emails` (`email_id`,
`employee_mailbox_id`, `notes`) VALUES (8, 5, '')
104 Query SELECT LAST_INSERT_ID() AS insertID
104 Query INSERT INTO `employee_mailbox_emails` (`email_id`,
`employee_mailbox_id`, `notes`) VALUES (8, 1, '')
104 Query SELECT LAST_INSERT_ID() AS insertID
104 Query INSERT INTO `employee_mailbox_emails` (`email_id`,
`employee_mailbox_id`, `notes`) VALUES (8, 2, '')
104 Query SELECT LAST_INSERT_ID() AS insertID
104 Query INSERT INTO `employee_mailbox_emails` (`email_id`,
`employee_mailbox_id`, `notes`) VALUES (8, 3, '')
104 Query SELECT LAST_INSERT_ID() AS insertID
And there is no reason to e like this because if I try to save 5
records at once and only one fails other 4 are stored in table. If
this happens in transaction all 5 records would be rolled back.
On Nov 1, 3:46 pm, Jon Bennett <jmbenn...@gmail.com> wrote:
> Hi nikolay,
>
> > My confusion is caused by the return value otsaveAllfunction - it is
> > array containing 5 elements but not 3. Elements with value 1 for
> > succeeded elements and 0 for unsuccessful stored elements suppose.
>
> > Am I wrong or missing something and how can I retrieve what elements
> > are stored successfully and what are failed.
>
> Are your tables InnoDB? If they are, cake will wrap all queries in a
> single transaction when you usesaveAll, so if one fails, they all
> fail.
>
> hth
>
> Jon
>
> --
> jon bennett -www.jben.net- blog.jben.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment