Re: Extending SQL a bit
Tobias Downer <[email protected]> Mon, 28 Feb 2005 14:47:48 -0800
| Newsgroups | gmane.comp.db.mckoi |
|---|---|
| Message-ID | <[email protected]> |
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]