dannote / mod-ndb

Automatically exported from code.google.com/p/mod-ndb
0 stars 0 forks source link

SQL Expressions #68

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The SQL language in mod_ndb should support expressions that use basic 
arithmetic operations,  
such as  "SELECT * FROM table1 where PRIMARY KEY = $j - 1"  and "SELECT ( (2 * 
item_number) + 6) 
AS item_key , item_description FROM items WHERE ...".  

Original issue reported on code.google.com by john.david.duncan on 4 May 2008 at 4:22

GoogleCodeExporter commented 9 years ago
Here are some ideas for a "term, expression, and function" engine.  

The syntax for terms and expressions, in Coco/r, could look somewhat like 
Coco's sample Taste and Arith 
compilers.  These generate a byte code program for a simple stack machine.  You 
have to decide on a type 
system before implementing expressions.

Regular expression matching should be supported, perhaps calling regcomp() at 
config time, and regexec() at 
runtime. 

Once types are decided on, you just have to come up with a calling convention, 
and then you can support 
functions.

Original comment by john.david.duncan on 7 May 2008 at 6:15

GoogleCodeExporter commented 9 years ago
Step 1, support arithmetic expressions in a WHERE clause.

Step 2, support CHECK (issue#70) 

Step 3, add function-calling support to expressions.

Step 4, allow expressions in the SELECT clause.

Original comment by john.david.duncan on 7 May 2008 at 6:40

GoogleCodeExporter commented 9 years ago
There's a good VM on pages 231-236 of TPOP.

Original comment by john.david.duncan on 7 May 2008 at 10:52