mwild1 / luadbi

Multi-backend SQL database library for Lua
MIT License
38 stars 14 forks source link

"SELECT 1" returns invalid type #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Running this code:

local dbi = require('DBI')
local db = assert(dbi.Connect("MySQL", "test", "root", "", "localhost", 3306))

local sth = assert(db:prepare('SELECT 1 as id;'))
sth:execute()
row = sth:fetch(true)

print(row.id)

sth:close()
db:close()

I would expect to see `1` in the console. Instead, I see some float number like 
`4.9406564584125e-324`

This is a problem because when you try to retrieve the id of the latest 
inserted record with the query `SELECT LAST_INSERT_ID() as id`, you won't be 
able to.

Original issue reported on code.google.com by ostine...@gmail.com on 10 Nov 2013 at 4:36

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thanks for the report. This issue is fixed in the latest commits, that I intend 
to roll into a new release shortly.

Original comment by MWild1 on 30 Jul 2014 at 10:14

GoogleCodeExporter commented 8 years ago
Thank you.

Original comment by ostine...@gmail.com on 31 Jul 2014 at 5:31