Wednesday, September 30, 2009

Re: Problem with saving id's

Oracle uses triggers to implement "auto increment" functionality. Cake
deals with that but I think it expects the sequence name to be
"pk_$table_name". Is that what you have?

Hmm ... looking at the source, it appears that you can set the
sequence name in the model: $model->sequence.

On Wed, Sep 30, 2009 at 5:35 AM, Xanax <mammeri69@gmail.com> wrote:
>
> Hi everyone,
>
> I've got a little problem with my cake app'.
>
> My database is Oracle. Every data saving handled by cake engine works
> fine.
> The problem is with a 'manual' saving :
>
> $this->User->Planification->create($data_planification);
>
>                                $data_planification["Planification"]["user_id"] = $_POST
> ['user_id'];
>                                $data_planification["Planification"]["projet_id"] = $_POST
> ['projet_id'];
>
>
>                                $this->User->Planification->save($data_planification);
>
> This code doesn't work with my Oracle database while it used to work
> with MySQL database.
> When i add this line at the begining :
>                                $data_planification["Planification"]["id"] = 5678;
> It works, so i guess i've got a problem with my id. I thought that
> cake generate automatically id's and then save them in the database.
> I've created sequences, maybe i must retrieve the current sequence ?
> Or is there a thing that i've missed ?
>
> Thanks for any help.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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: