Re: Extending SQL a bit
Kim Schulz <[email protected]> Mon, 28 Feb 2005 13:56:14 +0100
| Newsgroups | gmane.comp.db.mckoi |
|---|---|
| Organization | Aalborg University |
| Message-ID | <[email protected]> |
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? -- 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]