True, but the code that handles that case isn't very complex, so why create a potential compat problem? What's the benefit?
Bill
On Oct 30, 2014, at 6:25 AM, Stephen R. van den Berg srb@cuci.nl wrote:
But the official one doesn't do that anymore, I think.
Just trying to chart how many of the builtin backends actually still need the Sql.sql_array_result. And if so, they should need to wrap it themselves by providing a big_query which already returns the wrapped version instead of relying on the Sql glue to fix it afterward.
On Thu, Oct 30, 2014 at 3:40 AM, H. William Welliver III bill@welliver.org wrote: I wrote a backend for SQLite (back before the official one existed) that did this; actually it retrieved the result as an array and then created a Sql.sql_array_result object with it as the argument to create(). I suspect that’s similar to what the code you refer to is doing.
Bill
On Oct 29, 2014, at 10:05 PM, Stephen R. van den Berg srb@cuci.nl wrote:
Looking at ways to streamline the Sql.Sql interface, I find that there is code in the current big_query() to handle the case when the return value of the real sql backend big_query() happens to be an array instead of a genuine object, it puts a wrapper function around it.
Are there currently any SQL backends which actually return an array from big_query()? -- Stephen.
-- Stephen.
H. William Welliver III wrote:
True, but the code that handles that case isn't very complex, so why create a potential compat problem? What's the benefit?
The benefit is that I can mold Sql.Sql() into keeping the seemingly identical interface as before, except that it now inherits directly.
I.e. picture this: class Sql.SQL { string quote(string s) { return replace(s,"'","''");} array query(...) { ... } void reload() { } } class Sql.Mysql { ... as usual ... }
Then running:
object db = Sql.Sql("mysql://....");
will return an object that is of type:
class { inherit Sql.SQL; inherit Sql.Mysql; };
Whereas all the functions present in the actual backend will be immediately available to the program (no arcane indirection through master_sql anymore). But it also implies that if a backend implements a big_query(), then it must return the same type of object (i.e. not an array). If a backend wants to return an array for big_query, then it should not implement big_query at all, and just supply query (or use the array-to-object wrapper).
pike-devel@lists.lysator.liu.se