Overview
Dado is a package that offers some facilities implemented over LuaSQL connection objects. Its main goals are:
- better error messages,
- iterators to access the result set and
- more homogeneity in some commonly used database operations.
Dado is free software and uses the same license as Lua.
Object Abstraction
The package also contains an object module which provides a way to define classes and objects to represent table rows with a minimun effort. It does not imposes a class system, it just suggests a simple one with simple inheritance:
- objects with automatic retrieval of database attributes
- different methods for object creation and for class definition
The default mechanism uses classes to represent database tables and instances to represent database table rows. However it is easy to define attributes that are not related to database columns, or classes that are not related to only one database table.
Status
Current version is 1.5.2. It was developed for both Lua 5.1 and Lua 5.2.
Download
Dado can be downloaded from its own download page.
Installation
Dado is a Lua 5 (compatible with all Lua 5.X versions) set of modules which should be installed in your LUA_PATH, respecting the directory structure in the src
folder of the distribution file.
LuaRocks can be used to install it since Dado is also distributed as a rock.
Manual
There is no reference manual. The API is documented with LDoc.
History
- [15/oct/2013] Version 1.5.2 released
-
Bug correction in
sql.quote
: it does not quote strings which are formed by double balanced parentheses, such as ((NULL)) or ((select col from tab where cond)); it does not quote Lua numbers (but it does quote strings with numbers inside it)
sql.escape
now follows strictly the SQL standard: it does not try to escape everything, only the string delimiter character '; also it does not remove three special characters: TAB (\t
or\9
), LINE FEED (\n
or\10
) and CARRIAGE RETURN (\r
or\13
)sql.quote
does NOT quote Lua numbers (but it does quote strings with numbers inside it, such as '12') NOR strings which are formed by a balanced parentheses into which there could be: only an identifier (without digits); or a string containing 'select' substringsql.insert
also accepts a single string with the entire SQL statement (except the first two words:insert into
)
Bug correction in function
sql.escape
: removes characters with codes < 32 to avoid problems in SQL code generation- Reimplementation to make it work with Lua 5.2
- Improvement in function
sql.escape
: third parameter must be a substitution pattern
Clean up of unused functions:
arraytorecord
, invert
, copyto
and cycle
from module table.extra
and whole string.extra
moduleBug correction in function
sql.quote
: it was not quoting strings that begin and end with parenthesis which don't match- Adding convenience function
sql.isinteger
- Adding debugging function
table.extra.pfullconcat
- Hosting change
- Adding convenience function
sql.AND
- Adding portuguese documentation
- Adding function
wrap_connection
- Removing
check
library - Deployment via LuaRocks
Bug correction in function
sql.quote
Credits
Dado was designed by Tomás Guisasola and Eduardo Quintão with many priceless contributions from Pedro Maia, Roberto Ierusalimschy, André Carregal, Raphael Pithan, Maurício Bonfim and Carla Ourofino. The logo image was made by Carla Ourofino.
Dado was developed for PUC-Rio which holds its copyright. It was implemented by Tomás Guisasola.
Contact us
For more information please contact us. Comments are welcome!