phplib phplib-7.2b is severely inconsistent
| From: | Jeff | Date: | Wed, 07 Feb 2001 06:17:08 +0000 |
| Subject: | phplib phplib-7.2b is severely inconsistent | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-38498@lists.php.net to get a copy of this message | ||
Can anyone explain this? I thought phplib was supposed to
provide a consistent interface to databases. If you depend
on the mysql and pgsql layers to work the same you are
screwed. Their connect method inconsistency is pathetic.
One function returns a value and the other does not. This
code is straight from "phplib-7.2b" If you don't believe me
download it yourself.
There are also other differences. Member var
"Halt_On_Error" exists in db_mysql but not db_pgsql. There
is no good reason for this inconsistency.
This is their "production" release. From their own website:
"This is the most current production release of PHPLIB. It
is basically a 7.2 release with some minor bugfixes, such as
..."
//------------------------------------------------------------------------------
## THIS IS IN "db_mysql.inc"
/* public: connection management */
function connect($Database = "", $Host = "", $User = "",
$Password = "") {
/* Handle defaults */
if ("" == $Database)
$Database = $this->Database;
if ("" == $Host)
$Host = $this->Host;
if ("" == $User)
$User = $this->User;
if ("" == $Password)
$Password = $this->Password;
/* establish connection, select database */
if ( 0 == $this->Link_ID ) {
$this->Link_ID=mysql_pconnect($Host, $User,
$Password);
if (!$this->Link_ID) {
$this->halt("pconnect($Host, $User, \$Password)
failed.");
return 0;
}
if (!@mysql_select_db($Database,$this->Link_ID)) {
$this->halt("cannot use database ".$this->Database);
return 0;
}
}
return $this->Link_ID;
}
//------------------------------------------------------------------------------
## THIS IS IN "db_pgsql.inc"
function connect() {
if ( 0 == $this->Link_ID ) {
$cstr = "dbname=".$this->Database.
$this->ifadd($this->Host, "host=").
$this->ifadd($this->Port, "port=").
$this->ifadd($this->User, "user=").
$this->ifadd($this->Password, "password=");
$this->Link_ID=pg_pconnect($cstr);
if (!$this->Link_ID) {
$this->halt("Link-ID == false, pconnect failed");
}
}
} // !!!!!!!!! WHERE IS THE DAMN RETURN
VALUE???????????!!!!!!!!!
//------------------------------------------------------------------------------
--
Jeff Greer
- B.S. computer science - Univ. MO - Rolla
- web developer/software engineer,
dedicated to the struggle against the fascist
Microsoft hegemony