Re: saveAll rolling back my transactions

2010-03-29 Thread Lucca Mordente
you can't use transactions with myisam tables.
change it to innoDB (or another), in which this support is present


On Mar 29, 9:34 am, Ernesto  wrote:
> myISAM.
>
> i'll check OrderControllers validation errors
>
> On 26 Mar, 16:18, Lucca Mordente  wrote:
>
>
>
> > Maybe your database table engine does not supporttransactions.
> > What engine are you using?
>
> > Lucca Mordente
>
> > On 26 mar, 09:28, Ernesto  wrote:
>
> > > Hello.
>
> > > i have 2 models (Item and Order) joined together by a HABTM
> > > relationship.
> > > since i need some additional fields (quantity) in the join table i
> > > splitted the HABTM in 2x hasMany.
> > > after that i coded a Order add form wich gives me this data array
>
> > > Array
> > > (
> > >     [Order] => Array
> > >         (
> > >             [code] => SCORR
> > >             [customer_id] => 5
> > >             [estimated_delivery] => 2010-03-30
> > >         )
>
> > >     [ItemsOrders] => Array
> > >         (
> > >             [0] => Array
> > >                 (
> > >                     [item_id] => 10
> > >                     [quantity] => 3.00
> > >                 )
>
> > >             [1] => Array
> > >                 (
> > >                     [item_id] => 5
> > >                     [quantity] => 5.00
> > >                 )
>
> > >         )
>
> > > )
>
> > > here's the related SQL log
>
> > > (default) 11 queries took 6 ms     Nr    Query           Error           
> > > Affected
> > > Num. rows        Took (ms)
> > > 1       DESCRIBE `orders`               3       3       1
> > > 2       DESCRIBE `items_orders`                 4       4       1
> > > 3       DESCRIBE `items`                3       3       1
> > > 4       SELECT `Items`.`id`, `Items`.`code` FROM `items` AS `items` WHERE 
> > > 1
> > > = 1 ORDER BY `code` ASC                 9       9       0
> > > 5       START TRANSACTION               0               0
> > > 6       INSERT INTO `orders` (`code`, `customer_id`, `estimated_delivery`)
> > > VALUES ('XYZ', 5, '2010-03-30')                 1               0
> > > 7       SELECT LAST_INSERT_ID() AS insertID             1       1       0
> > > 8       ROLLBACK
>
> > > the strange thing is that, even if the transaction fails, the order is
> > > added.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: saveAll rolling back my transactions

2010-03-29 Thread Ernesto
myISAM.

i'll check OrderControllers validation errors

On 26 Mar, 16:18, Lucca Mordente  wrote:
> Maybe your database table engine does not support transactions.
> What engine are you using?
>
> Lucca Mordente
>
> On 26 mar, 09:28, Ernesto  wrote:
>
>
>
> > Hello.
>
> > i have 2 models (Item and Order) joined together by a HABTM
> > relationship.
> > since i need some additional fields (quantity) in the join table i
> > splitted the HABTM in 2x hasMany.
> > after that i coded a Order add form wich gives me this data array
>
> > Array
> > (
> >     [Order] => Array
> >         (
> >             [code] => SCORR
> >             [customer_id] => 5
> >             [estimated_delivery] => 2010-03-30
> >         )
>
> >     [ItemsOrders] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [item_id] => 10
> >                     [quantity] => 3.00
> >                 )
>
> >             [1] => Array
> >                 (
> >                     [item_id] => 5
> >                     [quantity] => 5.00
> >                 )
>
> >         )
>
> > )
>
> > here's the related SQL log
>
> > (default) 11 queries took 6 ms     Nr    Query           Error           
> > Affected
> > Num. rows        Took (ms)
> > 1       DESCRIBE `orders`               3       3       1
> > 2       DESCRIBE `items_orders`                 4       4       1
> > 3       DESCRIBE `items`                3       3       1
> > 4       SELECT `Items`.`id`, `Items`.`code` FROM `items` AS `items` WHERE 1
> > = 1 ORDER BY `code` ASC                 9       9       0
> > 5       START TRANSACTION               0               0
> > 6       INSERT INTO `orders` (`code`, `customer_id`, `estimated_delivery`)
> > VALUES ('XYZ', 5, '2010-03-30')                 1               0
> > 7       SELECT LAST_INSERT_ID() AS insertID             1       1       0
> > 8       ROLLBACK
>
> > the strange thing is that, even if the transaction fails, the order is
> > added.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: saveAll rolling back my transactions

2010-03-26 Thread Lucca Mordente
Maybe your database table engine does not support transactions.
What engine are you using?

Lucca Mordente

On 26 mar, 09:28, Ernesto  wrote:
> Hello.
>
> i have 2 models (Item and Order) joined together by a HABTM
> relationship.
> since i need some additional fields (quantity) in the join table i
> splitted the HABTM in 2x hasMany.
> after that i coded a Order add form wich gives me this data array
>
> Array
> (
>     [Order] => Array
>         (
>             [code] => SCORR
>             [customer_id] => 5
>             [estimated_delivery] => 2010-03-30
>         )
>
>     [ItemsOrders] => Array
>         (
>             [0] => Array
>                 (
>                     [item_id] => 10
>                     [quantity] => 3.00
>                 )
>
>             [1] => Array
>                 (
>                     [item_id] => 5
>                     [quantity] => 5.00
>                 )
>
>         )
>
> )
>
> here's the related SQL log
>
> (default) 11 queries took 6 ms     Nr    Query           Error           
> Affected
> Num. rows        Took (ms)
> 1       DESCRIBE `orders`               3       3       1
> 2       DESCRIBE `items_orders`                 4       4       1
> 3       DESCRIBE `items`                3       3       1
> 4       SELECT `Items`.`id`, `Items`.`code` FROM `items` AS `items` WHERE 1
> = 1 ORDER BY `code` ASC                 9       9       0
> 5       START TRANSACTION               0               0
> 6       INSERT INTO `orders` (`code`, `customer_id`, `estimated_delivery`)
> VALUES ('XYZ', 5, '2010-03-30')                 1               0
> 7       SELECT LAST_INSERT_ID() AS insertID             1       1       0
> 8       ROLLBACK
>
> the strange thing is that, even if the transaction fails, the order is
> added.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: saveAll rolling back my transactions

2010-03-26 Thread Dr. Loboto
Check validation errors. If "ItemsOrders" items are validated after
"Order" and fail transaction should be rolled back. Data stays added
as you have non-InnoDB table "orders" that do not support
transactions.

On Mar 26, 6:28 pm, Ernesto  wrote:
> Hello.
>
> i have 2 models (Item and Order) joined together by a HABTM
> relationship.
> since i need some additional fields (quantity) in the join table i
> splitted the HABTM in 2x hasMany.
> after that i coded a Order add form wich gives me this data array
>
> Array
> (
>     [Order] => Array
>         (
>             [code] => SCORR
>             [customer_id] => 5
>             [estimated_delivery] => 2010-03-30
>         )
>
>     [ItemsOrders] => Array
>         (
>             [0] => Array
>                 (
>                     [item_id] => 10
>                     [quantity] => 3.00
>                 )
>
>             [1] => Array
>                 (
>                     [item_id] => 5
>                     [quantity] => 5.00
>                 )
>
>         )
>
> )
>
> here's the related SQL log
>
> (default) 11 queries took 6 ms     Nr    Query           Error           
> Affected
> Num. rows        Took (ms)
> 1       DESCRIBE `orders`               3       3       1
> 2       DESCRIBE `items_orders`                 4       4       1
> 3       DESCRIBE `items`                3       3       1
> 4       SELECT `Items`.`id`, `Items`.`code` FROM `items` AS `items` WHERE 1
> = 1 ORDER BY `code` ASC                 9       9       0
> 5       START TRANSACTION               0               0
> 6       INSERT INTO `orders` (`code`, `customer_id`, `estimated_delivery`)
> VALUES ('XYZ', 5, '2010-03-30')                 1               0
> 7       SELECT LAST_INSERT_ID() AS insertID             1       1       0
> 8       ROLLBACK
>
> the strange thing is that, even if the transaction fails, the order is
> added.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.