Skip to content
Browse files

refactor

  • Loading branch information...
1 parent 3fdf3b1 commit 08066e33ee671612a1c5595c5df9f082d4809f5f @fperrad committed May 4, 2012
Showing with 2 additions and 8 deletions.
  1. +1 −2 src/Coat/Persistent.lua
  2. +1 −6 src/Coat/Persistent/lsqlite3.lua
View
3 src/Coat/Persistent.lua
@@ -8,7 +8,6 @@ local rawget = rawget
local rawset = rawset
local require = require
local setmetatable = setmetatable
-local tostring = tostring
local type = type
local _G = _G
local Coat = require 'Coat'
@@ -117,7 +116,7 @@ local function save (class, obj)
for _, field in ipairs(attributes(class)) do
local val = obj[field]
if val ~= nil then
- values[field] = tostring(val)
+ values[field] = val
end
end
View
7 src/Coat/Persistent/lsqlite3.lua
@@ -8,8 +8,6 @@ local pairs = pairs
local rawget = rawget
local rawset = rawset
local setmetatable = setmetatable
-local tonumber = tonumber
-local tostring = tostring
local type = type
local _G = _G
local Coat = require 'Coat'
@@ -99,7 +97,7 @@ local function save (class, obj)
for _, field in ipairs(attributes(class)) do
local val = obj[field]
if val ~= nil then
- values[field] = tostring(val)
+ values[field] = val
end
end
@@ -160,9 +158,6 @@ local function find_by_sql (class, sql)
return function (_, var)
local row = f(s, var)
if row then
- for k, v in pairs(row) do
- row[k] = tonumber(v) or v
- end
local obj = class.new(row)
rawset(obj, '_db_exist', true)
return obj

0 comments on commit 08066e3

Please sign in to comment.
Something went wrong with that request. Please try again.