We run into the same problem and simple split the problem. Make a find,
then update or create (simple look what update_or_create do internally)

2012/3/19 Will Crawford <[email protected]>

> change the value to \'CURRENT_TIMESTAMP' or \'CURRENT_DATE' :)
>

read again ;) that was not the problem ...



>
> if this isn't a long-running process, 'now' (without the parentheses)
> will probably work.
>
> On 16 March 2012 20:32, Octavian Rasnita <[email protected]> wrote:
> > Hi,
> >
> > I have tried to use:
> >
> > $self->update_or_create({
> >  symbol => $symbol,
> >  market => $market,
> >  last_update => \'now()',
> > });
> >
> > Am I doing something wrong?
> >
> > The problem is the row:
> >  last_update => \'now()',
> >
> > ...because the generated SQL for select looks like:
> > SELECT ... FROM table_name me WHERE ( ( ... AND me.last_update now() AND
> ... )
> >
> > If I add an "=" in that line like:
> >  last_update => \'=now()',
> >
> > ...then I got another error because the generated SQL for insert becomes:
> > INSERT INTO table_name(...) VALUES ( ?, =now(), ?, ... )
> >
> > Isn't possible to use a DB function with update_or_create?
> >
> > In this case I can send a DateTime string instead of \'now()' but in
> other cases it might be impossible...
> >
> > Thanks.
> >
> > Octavian
> >
> >
> > _______________________________________________
> > List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> > IRC: irc.perl.org#dbix-class
> > SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> > Searchable Archive:
> http://www.grokbase.com/group/[email protected]
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/[email protected]
>



-- 
Mit freundlichem Gruß
Felix Ostmann

-----------------------------------------------------------
Websuche Search Technology GmbH & Co. KG
Martinistraße 3, D-49080 Osnabrück, Germany
-----------------------------------------------------------
Tel.: +49 (0) 541 / 40666 0, Fax: +49 (0) 541 / 40666 22
Email: [email protected], Web: www.websuche.com
-----------------------------------------------------------
AG Osnabrück - HRA 200252, Ust-IdNr.: DE814737310
-----------------------------------------------------------
Komplementärin: Websuche Search Technology Verwaltungs GmbH
AG Osnabrück - HRB 200359, Geschäftsführer: Ansas Meyer
-----------------------------------------------------------

Die in dieser Email enthaltenen Informationen sind vertrau-
lich zu behandeln und ausschließlich für den Adressaten be-
stimmt. Jegliche Veröffentlichung, Verteilung oder sonstige
in diesem Zusammenhang stehende Handlung  wird ausdrücklich
untersagt.
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to