On Tue, 22 Nov 2005 17:38:02 -0600 Dan Nelson dnelson@allantgroup.com wrote:
In the last episode (Nov 22), Martin Bhr said:
On Tue, Nov 22, 2005 at 02:41:15PM -0500, Adam Montague wrote:
Postgres doesn't return the table name when you make a query, so right now where mysql would give you a mapping containing both "column" and "table.column", postgres gives you "column" and ".column" for no reason.
does mysql always give table.column? i thought i remembered seeing .column there too...
Only if you run a table-less query, I think:
Sql.Sql("mysql://localhost/test")->query("select ename from emp where ename='scott'");
(5) Result: ({ /* 1 element */ ([ /* 2 elements */ "emp.ename": "SCOTT", "ename": "SCOTT" ]) })
Sql.Sql("mysql://localhost/test")->query("select 12");
(6) Result: ({ /* 1 element */ ([ /* 2 elements */ ".12": "12", "12": "12" ]) })
Here's an additional patch to get rid of that too. It does change the behaviour of fetch_fields() though, so that if "table" doesn't exist, then its false (0) instead of an empty string. I'm not sure if that's ok or if people would prefer changing res_obj_to_array() to check if table is false or an empty string and leaving fetch_fields() alone.
Adam