rettama / luadbi

Automatically exported from code.google.com/p/luadbi
MIT License
0 stars 0 forks source link

Empty values from joined tables #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I occured a problem, when I tried to select a dataset from joined tables.
MySQL on CLI brings the right output:

mysql> SELECT
    ->        c.pos_x,
    ->        c.pos_y,
    ->        n.position_x,
    ->        n.position_y,
    ->        n.npcs_id
    ->     FROM npc_instances AS n
    ->     JOIN chunks AS c ON (c.pk_chunk_id = n.chunk_id);
+-------+-------+------------+------------+---------+
| pos_x | pos_y | position_x | position_y | npcs_id |
+-------+-------+------------+------------+---------+
|     1 |     1 |        120 |        645 |       2 |
|     1 |     1 |        600 |        150 |       3 |
|     1 |     1 |        600 |        270 |       1 |
+-------+-------+------------+------------+---------+
3 rows in set (0.00 sec)

When I select the same Statement via luadbi, the pos_x and pos_y values are 
empty:

File: dbitest.lua
require('DBI')
local dbh = assert(DBI.Connect('MySQL', 'obg', 'root', 'NeverGonnaGiveYouUp', 
'127.0.0.1', '3306'));
dbh:autocommit(true)

local select = assert(dbh:prepare([[
    SELECT
       c.pos_x,
       c.pos_y,
       n.position_x,
       n.position_y,
       n.npcs_id
    FROM npc_instances AS n
    JOIN chunks AS c ON (c.pk_chunk_id = n.chunk_id)
    ]])
);

select:execute();
for row in select:rows() do
    print(table.concat(row, " | "));
end

Execution:
$ lua dbitest.lua
 |  | 120 | 645 | 2
 |  | 600 | 150 | 3
 |  | 600 | 270 | 1

I am Using:
Ubuntu 12.04.2 LTS (Precise)
lua-dbi-common Version: 0.5+svn78-2~precise1
lua-dbi-mysql Version: 0.5+svn78-2~precise1
mysql  Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (x86_64) using readline 
6.2

Is there a bug in DBI or in the driver?
Do you need further information?

Original issue reported on code.google.com by mathias....@googlemail.com on 8 May 2013 at 5:05

GoogleCodeExporter commented 8 years ago
I found out, that Data is not returned from MEDIUMINT columns. Maybe the Bug 
may be located here...

Original comment by mathias....@googlemail.com on 11 May 2013 at 2:47

GoogleCodeExporter commented 8 years ago
Hmm, that sounds like an easier bug to work with. I'll try and reproduce it, 
thanks... :)

Original comment by MWild1 on 11 May 2013 at 2:59

GoogleCodeExporter commented 8 years ago
This issue was closed by revision a6c8dee9e03c.

Original comment by MWild1 on 29 Jul 2014 at 1:27