[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Adapter pattern for Lua
- From: Bertrand Mansion <lua@...>
- Date: Thu, 22 Jan 2009 15:40:14 +0100
On Thu, Jan 22, 2009 at 12:49 PM, Tomas Guisasola Gorham
> Hi Bertrand
>> I like SQL, I wouldn't want to write some kind of query builder, I
>> prefer to use SQL directly. I think LuaSQL is ok even if I would
>> really like to see a Lua extension for apr_dbd  which is more
> Have you checked Dado (http://dado.luaforge.net)? I also
> wrote a gem about it (chapter 5, Abstractions for LuaSQL).
Of course, I know Dado, I even reported a bug back in May 2008 :)
My module is different because it is really made for lazy people like
me. For example, you don't have to declare your table columns in your
objects, they are automatically discovered by using the database
metadata. In the end, I write less code. But Dado is very interesting
and I studied its code as you can notice if you look at my code.
>> The current code is here:
> I think your escaping and quoting functions aren't safe.
That's what people think at first, but it's wrong because the default
functions for escaping are automatically replaced by the ones from the
adapters. They actually call LuaSQL escape functions which in turn
call mysql_real_escape_string() for MySQL for example.
I even contributed them to LuaSQL (although they were adapted to fit better) :)
>> but I am now thinking about changing a few things (I am not too happy
>> with the API) and I have to finish implementing other features and
>> write documentation...
> What changes in the API do you plan?
This is still work in progress :)