[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: SQL syntax in Lua?
- From: Tomas <tomas@...>
- Date: Wed, 8 Mar 2006 14:05:51 -0300 (BRT)
And( Where( 'id', '>', 0 ), Where( 'id', '<', 10 ) )
Correct me if I'm wrong, but I think the above code will
produce the string:
"where id > 0 and id < 10"
Am I correct?
Some years ago we start an effort in that direction but it
fails on this kind of stuff. Now we changed that approach to a set of
functions to solve the most common cases, like:
sql.select (table_name, fields_list, optional_where, optional_extra)
The word 'where' is added automatically if optional_where is
given; optional_extra if given, is added to the end of the statement.
This solution does not solve all problems, but the most common cases.
We also have other functions to other common SQL statements (delete,
insert and update; these last two functions receive tables representing
pairs of field = value). If someone is interested, we can share our code.
Tomas