[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Dado 1.0
- From: Tomas Guisasola Gorham <tomas@...>
- Date: Wed, 14 May 2008 14:36:58 -0300 (BRT)
Hi Bertrand
Where is the CVS, I tried browsing it in luaforge but it looks empty, unless
I missed something.
I'm sorry, the CVS is not hosted in LuaForge :-)
I am attaching the diff to this message if you like it.
Regards,
Tomás
Index: src/dado/init.lua
===================================================================
RCS file: /usr/local/cvsroot/infra/src/dado/init.lua,v
retrieving revision 1.5
retrieving revision 1.6
diff -r1.5 -r1.6
5c5
< -- @release $Id: init.lua,v 1.5 2008/04/20 21:27:42 tomas Exp $
---
> -- @release $Id: init.lua,v 1.6 2008/05/02 20:30:04 tomas Exp $
168a169
> -- @return Cursor object (to allow explicit closing).
180c181
< end
---
> end, cur
Index: src/dado/object.lua
===================================================================
RCS file: /usr/local/cvsroot/infra/src/dado/object.lua,v
retrieving revision 1.4
retrieving revision 1.5
diff -r1.4 -r1.5
10c10
< -- @release $Id: object.lua,v 1.4 2008/04/09 03:16:15 tomas Exp $
---
> -- @release $Id: object.lua,v 1.5 2008/05/14 11:38:19 tomas Exp $
13c13
< local getmetatable, ipairs, pairs, rawget, rawset, setmetatable, type = getmetatable, ipairs, pairs, rawget, rawset, setmetatable, type
---
> local ipairs, pairs, rawget, rawset, setmetatable, type = ipairs, pairs, rawget, rawset, setmetatable, type
143a144,155
> -- Creates a table with the raw data of the object.
> -- @return Table with field=value pairs.
> ---------------------------------------------------------------------------
> function rawdata (self)
> local r = {}
> for field, f in pairs (self.db_fields) do
> r[field] = rawget (self, field)
> end
> return r
> end
>
> ---------------------------------------------------------------------------
148c160
< return self.__dado:insert (self.table_name, self) == 1
---
> return self.__dado:insert (self.table_name, self:rawdata ()) == 1
156c168
< return self.__dado:update (self.table_name, self, db_identification (self)) == 1
---
> return self.__dado:update (self.table_name, self:rawdata (), db_identification (self)) == 1
Index: tests/overall.lua
===================================================================
RCS file: /usr/local/cvsroot/infra/tests/overall.lua,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
3d2
< --local arg = { ... }
4a4,6
> if arg[0]:find"/" == nil then
> path = ""
> end
Index: tests/tdado.lua
===================================================================
RCS file: /usr/local/cvsroot/infra/tests/tdado.lua,v
retrieving revision 1.1
retrieving revision 1.3
diff -r1.1 -r1.3
36c36,37
< data date
---
> data date,
> primary key (chave)
47a49
> assert (false == pcall (db.insert, db, "tabela", registro))
54,55c56,61
< for campo1, campo2 in db:select ("campo1, campo2", "tabela", "chave >= 1") do
< contador = contador + 1
---
> local select_iter, cur = db:select ("campo1, campo2", "tabela", "chave >= 1")
> assert (type(select_iter) == "function")
> assert (cur, "Select didn't returned a cursor")
> assert (tostring(cur):find"ursor", "Select didn't returned a cursor object ("..tostring(cur)..")")
> for campo1, campo2 in select_iter do
> contador = contador + 1
58a65
> assert(cur:close())
Index: tests/tdbobj.lua
===================================================================
RCS file: /usr/local/cvsroot/infra/tests/tdbobj.lua,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
62a63,69
> -- Tentando acrescentar um registro sem chave ao banco
> local p = Pessoa:new (db, { nome = "Outro", email = "outro@qualquer.com", })
> assert (pcall (p.save, p) == false)
> p.id = 3
> assert (p:save () == true)
> io.write"."
>