Re: Are there Sql backends that return an array from big_query()?
"Stephen R. van den Berg" <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
Stephen R. van den Berg wrote:
>Martin Nilsson (Opera Mini - AFK!) @ Pike (-) importm?te f?r mailinglistan wrote:
>>I think the architecture is outdated, so instead it would be more
>>valuable to look at how to make it properly. Instead of having a proxy
>>object that calls a database object, there should be inheritance that
>>allows direct calling when possible.
>That's exactly what I was looking at, which is why I wanted to eliminate
>big_query()s that return anything else than an object.
I'm toying with something like this:
Instantiate the .pike programs in the Sql.pmod directory using:
protected program find_dbm(string program_name) {
program p;
// we look in Sql.type and Sql.Provider.type.type for a valid sql class.
p = Sql[program_name];
if(!p && Sql["Provider"] && Sql["Provider"][program_name])
p = Sql["Provider"][program_name][program_name];
return p;
}
As before, this to make sure that we have a driver.
Then, instead of using the compiled program find_dbm returns, we do
something along the lines of:
program realclass =
compile_string("inherit Sql.SQL;inherit Sql."+program_name+";");
which then needs to be cached somewhere for repeated requests of the
same dbtype, which can then be instantiated.
Or is there some more direct way to create a new class out of two
existing programs?
--
Stephen.