lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Bennett Todd wrote:
> (1) Allow multiple iterations of steps 1-3 on a single open connection.
> (2) Use a "connection handle" of some sort, allowing multiple simultaneous
>     connections to the same DB.
> (3) Provide a thin ``database-independant'' shim layer on top, that talks to
>     database-specific layers below.

Re 1 & 2:

I will actually create a userdata tag for handling the connection. So
what you do, is supplying this userdata (That holds your SQL pointer for
the connection) as a parameter to all your "sql" call in the library, in
this way you can have as many connections as your SQL API will supply
you.

Re 3:

Just create several different tags, and do a simple switch(tag) to add
support for different database types.

Another thing, is to create a Lua table wrapper around this, so you can
get some sort of OO functionality if you want to address several
databases at the same time!. 

Erik