Re: [Phplib-users] RE: sys_procedures
Brought to you by:
nhruby,
richardarcher
|
From: nathan r. h. <na...@ds...> - 2001-11-15 21:56:02
|
On Thu, 15 Nov 2001, Frank Bax wrote:
> Where should Bob's sys_procedure code go within phplib?
>
> I just had a look at this. It didn't take me long to find that phplib has
> a fundamental problem. I only supports a single database per installation!
> Excuse me if this has been observed before, but I just realised it; I
> never went much beyond local.inc before today.
>
Woah! It does, you just need multiple local.inc's and / or prepend.php3's
So, it does, just not within the same instance.
> Here's my suggestion:
>
> 1) DB_Sql in each of the db_*.inc files should be named specific to the
> database being supported (like DB_Sql_pgsql or DB_Sql_mysql).
>
> 2) _prepend.php should be allowed to 'require' multiple database inc's if a
> site wishes; and then add:
> class DB_SQL extends DB_Sql_xxx {
> /* include Bob's sys_procedure code here */
> }
> Many of the one-liner functions could be moved here too, when they are
> identical in all databases supported.
>
> Or maybe I've got it backwards. Should the common stuff be in the base
> class and DB_Sql_PG and DB_Sql_mysql extend that one? Then DB_Sql (as
> above) will empty just for compatibility with existing versions. This OO
> stuff hurts my head.
>
Yes, it's backwards :)
class db_skel {
foo
bar
}
class db_mysql extends db_skel {
mysqlSpecficFoo
}
class My_Example_db extends db_mysql {
connect
username
password
my_exmaple_mysql_specfic_foo
}
Etc.. the db interface needs serious help, as since everything a lot of
stuff is repeated in the various classes. the ideal would be to define
the base API in a skel class with the helper functions already defined and
have the db specfic classes ("drivers" if you will, for lack of a better
term) extend the API to provide what's needed. This will also allow for
better support for the various db specfic things.
[snipping rest, must read it later.. looks cool]
-n
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
nathan hruby / digital statement
na...@ds...
http://www.dstatement.com/
Public GPG key can be found at:
http://www.dstatement.com/nathan-gpg-key.txt
ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|