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.8.3.
It was developed for both Lua 5.1 and Lua 5.2.
It should run in Lua 5.3 also, although only the modules dado.sql
and table.extra
were tested (the other ones require LuaSQL which was not available for Lua 5.3 at the time of this release).
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
- [5/apr/2017] Version 1.8.3 released
- Function
daod.sql.quote
now treats numbers as booleans: both became strings formed by double balanced parentheses - Tested with Lua without automatic coercion (thanks to François Perrad)
- Function
- [4/apr/2017] Version 1.8.2 released
- Reverting the implementation of function
table.extra.fullconcat
: it assumes the table has appropriate keys and values (thanks to François Perrad) - Adapting the implementation of function
table.extra.twostr
to produce appropriate tables to provide totable.concat
(thanks to François Perrad)
- Reverting the implementation of function
- [16/mar/2017] Version 1.8.1 released
Improving functiontable.extra.fullconcat
: it forces the conversion of the elements of the table to strings by default (thanks to François Perrad) - [22/feb/2017] Version 1.8.0 released
Adding functionsql.quotedconcat
- [4/dec/2015] Version 1.7.1 released
Corrections in the _VERSION variables of each module. - [29/aug/2015] Version 1.7 released
select
now accepts a table as the value ofmode
parameter, indicating the mode should be a and the result set should be stored inside this table- Bug correction in
sql.quote
: boolean values are quoted as database constants, i.e. converted to strings between double parentheses - Bug correction in
sql.isinteger
: fractional values were incorrectly accepted - Bug correction in
table.extra.twostr
: boolean values were not correctly serialized
- [31/mar/2015] Version 1.6 released
sql.quote
now accepts Lua booleans as values to the database; values of this type are not quoted, they are treated as numbers - [15/oct/2013] Version 1.5.2 released
Bug correction insql.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) - [4/oct/2013] Version 1.5.1 released
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
)
- [23/jan/2013] Version 1.4.3 released
Bug correction in functionsql.escape
: removes characters with codes < 32 to avoid problems in SQL code generation - [13/nov/2012] Version 1.4.2 released
- Reimplementation to make it work with Lua 5.2
- Improvement in function
sql.escape
: third parameter must be a substitution pattern
- [06/jun/2011] Version 1.4 released
Clean up of unused functions:arraytorecord
,invert
,copyto
andcycle
from moduletable.extra
and wholestring.extra
module - [14/dec/2010] Version 1.3.1 released
Bug correction in functionsql.quote
: it was not quoting strings that begin and end with parenthesis which don't match - [06/aug/2010] Version 1.3.0 released
- Adding convenience function
sql.isinteger
- Adding debugging function
table.extra.pfullconcat
- Hosting change
- Adding convenience function
- [10/jun/2010] Version 1.2.0 released
- Adding convenience function
sql.AND
- Adding portuguese documentation
- Adding convenience function
- [05/oct/2009] Version 1.1.0 released
- Adding function
wrap_connection
- Removing
check
library - Deployment via LuaRocks
- Adding function
- [29/sep/2009] Version 1.0.1 released
Bug correction in functionsql.quote
- [20/apr/2008] Version 1.0 released
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!