Re: Extending SQL a bit

Kim Schulz <[email protected]> Tue, 01 Mar 2005 07:35:25 +0100
Newsgroups gmane.comp.db.mckoi
Organization Aalborg University
Message-ID <[email protected]>
it's just me getting too used to unix timestamps. I figured that I
ofcause could write it as 'yyyy-mm-dd hh:mm:ss:msms' insted. Thats
enough for me.



On Mon, 28 Feb 2005 14:47:48 -0800
Tobias Downer <[email protected]> wrote:

> Kim,
> 
> The expression (CURRENT_TIMESTAMP + 10000) will evaluate to NULL.  You
> 
> can not use the addition operator with a timestamp.  As I see it there
> 
> are two options.  Either create a new function that returns a
> timestamp  given the appropriate input (eg. TIME_AFTER_NOW(1000) ), or
> change the  EXPIRES grammar so it looks something like 'EXPIRES = 5
> DAYS' and  evaluate the '5 DAYS' part in Insert.java.
> 
> Toby.
> 
> 
> Kim Schulz wrote:
> > On Thu, 24 Feb 2005 14:36:42 -0800
> > Tobias Downer <[email protected]> wrote:
> > 
> > 
> >>As well as changing the grammar rules, you will also need to add the
> >
> >>appropriate behaviour in com/mckoi/database/interpret/Insert.java to
> >
> >>handle the information.
> >>
> >>Your grammar should probably look something like,
> >>
> >>   Expression time_exp = null;
> >>   ...
> >>      (   [ "(" BasicColumnList(col_list) ")" ]
> >>             (   <VALUES> InsertDataList(data_list)
> >>                     { type = "from_values"; }
> >>               | select = Select()
> >>                     { type = "from_select"; }
> >>             )
> >>         | <SET> AssignmentList(assignments) { type = "from_set"; }
> >>      )
> >>      [ <EXPIRES> <ASSIGNMENT> time_exp = DoExpression()
> >>                     { cmd.putObject("expires", timp_exp); } ]
> >>
> >>This will create an 'expires' entry in the cmd object if the expires
> >
> >>assignment is optionally given.  The expires object will be an
> >>Expression.
> >>
> >>In com/mckoi/database/interpret/Insert.java, you would evaluate the 
> >>expires expression if it's present and insert the data into your
> >>hidden  column.
> > 
> > 
> > This worked almost perfectly, but I have a problem when I want to do
> > somthing else than EXPIRES=CURRENT_TIMESTAMP;
> > 
> > I would like to do somthing like CURRENT_TIMESTAMP+10000; but that
> > just gives me an empty element in my hidden column. 
> > 
> > I thought that DoExpression() evaluated the expression
> > CURRENT_TIMESTAMP+1000 to somthing useful or trew me an error. 
> > 
> > 
> > in mysql I would do somthing like NOW()+1000 but NOW is not in the
> > standard and I cant figure out whether it is possible to actually
> > add 1000 to a TIMESTAMP in mckoi... is it possible? 
> > 
> > 
> > 
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------
> Mckoi SQL Database mailing list  http://www.mckoi.com/database/
> To unsubscribe, send a message to [email protected]


-- 
   Kim Schulz   | Want to know more about The Fundanemt CMS. Join the
 Geek by nature | users and developers at linuxforum 2005.
   schulz.dk    | http://www.linuxforum.dk    


---------------------------------------------------------------
Mckoi SQL Database mailing list  http://www.mckoi.com/database/
To unsubscribe, send a message to [email protected]