|
From: Ian B. <ia...@co...> - 2003-08-01 19:34:04
|
Oops, that should have been
SQLObject.SQLBuilder.SQLConstant("INTERVAL 30 DAY")
-- you could also register something like mx.DeltaDateTime as a type,
and convert it that way.
Good luck, I'm off...
Ian
On Fri, 2003-08-01 at 13:56, Dave Poirier wrote:
> On Fri, 2003-08-01 at 10:40, Ian Bicking wrote:
> > On Fri, 2003-08-01 at 08:18, Dave Poirier wrote:
> > > I'm trying to create a record in a database with a 'expires' field,
> > > which records are deleted whenever expires <= NOW(). I seem to have
> > > difficulty grasping how I can generate a query similar to:
> > >
> > > UPDATE records SET expires = NOW() + INTERVAL 30 DAY;
> > >
> > > I've tried something like:
> > >
> > > Records.expires = func.NOW('INTERVAL 30 DAY')
> > > Records.expires = func.NOW() + 'INTERVAL 30 DAY'
> > > Records.expires = func.NOW() + '+ INTERVAL 30 DAY'
> > > Records.expires = func.DATE_ADD(func.NOW(),'INTERVAL 30 DAY')
> >
> > func.NOW() + const('INTERVAL 30 DAY')
>
> The query being sent to MySQL is:
>
> UPDATE session SET expires = (NOW() + __call__('INTERVAL 30 MINUTE'))
> WHERE id = 2
>
> MySQL complains with:
>
> ProgrammingError: (1064, "You have an error in your SQL syntax near
> '('INTERVAL 30 MINUTE')) WHERE id = 2' at line 1")
>
>
> -Dave
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
|