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?