Tuesday, March 6, 2012

Re: SqlQueries in Fields to save?

Hi Jeremy,

thank you.
I will give it a try.

On 6 Mrz., 16:17, jeremyharris <funeralm...@gmail.com> wrote:
> You could use UUIDs instead which are automatically created by Cake and a
> nice replacement for auto increments.
>
>
>
>
>
>
>
> On Monday, March 5, 2012 3:42:39 AM UTC-8, Kosmo wrote:
>
> > Hi there,
>
> > I know this could be a critical hole in my application,
> > anyhow - is there a way to set an article-id like this?
> > I can not assign auto_increment to this table AND I only want to do
> > one query (because there could be several save querys parallel).
>
> > $this->Article->create();
> > $data['Article']['text'] = 'blah';
> > $data['Article']['id] = '(SELECT `id` FROM `Article` ORDER BY `id`
> > DESC LIMIT 1) + 1';
> > $this->Article->save($data);
>
> > Obviously (and thankfully) cakePHP does not handle this as a query,
> > but how would you solve this issue?
>
> > Any hints are welcome!
>
> > Andreas

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: