cvs: pear /MDB pgsql.php
| From: | Lukas Smith | Date: | Thu, 18 Jul 2002 19:59:05 +0000 |
| Subject: | cvs: pear /MDB pgsql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5183@lists.php.net to get a copy of this message | ||
lsmith Thu Jul 18 15:59:05 2002 EDT
Modified files:
/pear/MDB pgsql.php
Log:
fixed some bugs in decimal handling
Index: pear/MDB/pgsql.php
diff -u pear/MDB/pgsql.php:1.12 pear/MDB/pgsql.php:1.13
--- pear/MDB/pgsql.php:1.12 Thu Jul 18 15:01:02 2002
+++ pear/MDB/pgsql.php Thu Jul 18 15:59:04 2002
@@ -42,7 +42,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
-// $Id: pgsql.php,v 1.12 2002/07/18 19:01:02 lsmith Exp $
+// $Id: pgsql.php,v 1.13 2002/07/18 19:59:04 lsmith Exp $
// MDB postgresql driver.
@@ -91,6 +91,10 @@
$this->supported["Replace"] = 1;
$this->supported["SubSelects"] = 1;
+ $this->decimal_factor = pow(10.0, $this->options['decimal_places']);
+
+ $this->errorcode_map = array();
+
if (function_exists("pg_cmdTuples")) {
$connection = $this->_doConnect("template1", 0);
if (!MDB::isError($connection)) {
@@ -112,10 +116,6 @@
return ($err);
}
}
-
- $this->decimal_factor = pow(10.0, $this->options['decimal_places']);
-
- $this->errorcode_map = array();
}
// }}}
@@ -372,7 +372,7 @@
if (!$ismanip && $limit > 0 &&
substr(strtolower(ltrim($query)), 0, 6) == "select")
- {
+ {
if ($this->auto_commit &&
MDB::isError($this->_doQuery("BEGIN"))) {
return $this->raiseError(DB_ERROR);
}
@@ -1036,7 +1036,7 @@
*/
function getDecimalValue($value)
{
- return (!strcmp($value, "NULL") ? "NULL" : strval(round($value *
$this->decimal_factor)));
+ return (!strcmp($value,"NULL") ? "NULL" :
strval(round($value*$this->decimal_factor)));
}
// }}}
@@ -1110,7 +1110,7 @@
case MDB_TYPE_BOOLEAN:
return (strcmp($value, "Y") ? 0 : 1);
case MDB_TYPE_DECIMAL:
- return
(sprintf("%.".$this->options['decimal_places']."f",doubleval($value)/$this->decimal_factor));
+ return
(sprintf("%.".$this->options['decimal_places']."f",doubleval($value)/$this->decimal_factor));
case MDB_TYPE_FLOAT:
return doubleval($value);
case MDB_TYPE_DATE: