cvs: pear /MDB metabase_wrapper.php
| From: | Lukas Smith | Date: | Wed, 10 Jul 2002 11:16:09 +0000 |
| Subject: | cvs: pear /MDB metabase_wrapper.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5011@lists.php.net to get a copy of this message | ||
lsmith Wed Jul 10 07:16:09 2002 EDT
Modified files:
/pear/MDB metabase_wrapper.php
Log:
options are now stored similar to PEAR DB in an array and not in seperate class vars
sequence values are now stored in a var that is passed by reference
Index: pear/MDB/metabase_wrapper.php
diff -u pear/MDB/metabase_wrapper.php:1.15 pear/MDB/metabase_wrapper.php:1.16
--- pear/MDB/metabase_wrapper.php:1.15 Thu Jul 4 15:14:01 2002
+++ pear/MDB/metabase_wrapper.php Wed Jul 10 07:16:09 2002
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@dybnet.de> |
// +----------------------------------------------------------------------+
//
-// $Id: metabase_wrapper.php,v 1.15 2002/07/04 19:14:01 lsmith Exp $
+// $Id: metabase_wrapper.php,v 1.16 2002/07/10 11:16:09 lsmith Exp $
//
// Metabase Wrapper for MDB.
//
@@ -58,15 +58,29 @@
$dsninfo["username"] = $arguments["User"];
$dsninfo["password"] = $arguments["Password"];
$dsninfo["hostspec"] = $arguments["Host"];
-
- $options["includedconstant"] = $arguments["IncludedConstant"];
- $options["includepath"] = $arguments["IncludePath"];
- $options["debug"] = $arguments["Debug"];
- $options["decimalplaces"] = $arguments["DecimalPlaces"];
- $options["LOBbufferlength"] = $arguments["LOBBufferLength"];
- $options["loglinebreak"] = $arguments["LogLineBreak"];
- $options["options"] = $arguments["Options"];
+ if(isset($arguments["IncludedConstant"])) {
+ $options["includedconstant"] = $arguments["IncludedConstant"];
+ }
+ if(isset($arguments["IncludePath"])) {
+ $options["includepath"] = $arguments["IncludePath"];
+ }
+ if(isset($arguments["Debug"])) {
+ $options["debug"] = $arguments["Debug"];
+ }
+ if(isset($arguments["DecimalPlaces"])) {
+ $options["decimal_places"] = $arguments["DecimalPlaces"];
+ }
+ if(isset($arguments["LOBBufferLength"])) {
+ $options["LOBbufferlength"] = $arguments["LOBBufferLength"];
+ }
+ if(isset($arguments["LogLineBreak"])) {
+ $options["loglinebreak"] = $arguments["LogLineBreak"];
+ }
+ if(is_array($arguments["Options"])) {
+ $options = array_merge($options, $arguments["Options"]);
+ }
+ $options["seqname_format"] = "_sequence_%s";
$db = MDB::connect($dsninfo, $options);
if (MDB::isError($db) || !is_object($db)) {
@@ -1022,12 +1036,11 @@
function MetabaseGetSequenceNextValue($database, $name, &$value)
{
global $databases;
- $result = $databases[$database]->nextId($name, FALSE);
+ $result = $databases[$database]->nextId($name, $value, FALSE);
if (MDB::isError($result)) {
$databases[$database]->setError('', $result->getMessage());
return(0);
} else {
- $value = $result;
return(1);
}
}
@@ -1035,12 +1048,11 @@
function MetabaseGetSequenceCurrentValue($database, $name, &$value)
{
global $databases;
- $result = $databases[$database]->currId($name);
+ $result = $databases[$database]->currId($name, $value);
if (MDB::isError($result)) {
$databases[$database]->setError('', $result->getMessage());
return(0);
} else {
- $value = $result;
return(1);
}
}
@@ -1210,7 +1222,7 @@
}
}
-function MetabaseCreateLob(&$arguments, &$lob)
+function MetabaseCreateLOB(&$arguments, &$lob)
{
global $databases;
$args = $arguments;
@@ -1226,7 +1238,7 @@
}
}
-function MetabaseDestroyLob($lob)
+function MetabaseDestroyLOB($lob)
{
$result = destroyLob($lob);
if (MDB::isError($result)) {
@@ -1238,7 +1250,7 @@
}
}
-function MetabaseEndOfLob($lob)
+function MetabaseEndOfLOB($lob)
{
$result = endOfLob($lob);
if (MDB::isError($result)) {
@@ -1250,7 +1262,7 @@
}
}
-function MetabaseReadLob($lob, &$data, $length)
+function MetabaseReadLOB($lob, &$data, $length)
{
$result = readLob($lob, &$data, $length);
if (MDB::isError($result)) {
@@ -1262,7 +1274,7 @@
}
}
-function MetabaseLobError($lob)
+function MetabaseLOBError($lob)
{
$result = lobError($lob);
if (MDB::isError($result)) {
@@ -1429,23 +1441,29 @@
$dsninfo["username"] = $arguments["User"];
$dsninfo["password"] = $arguments["Password"];
$dsninfo["hostspec"] = $arguments["Host"];
-
- $options["includedconstant"] = $arguments["IncludedConstant"];
- if (isset($arguments["Persistent"])) {
- $options["persistent"] = TRUE;
+
+ if(isset($arguments["IncludedConstant"])) {
+ $options["includedconstant"] = $arguments["IncludedConstant"];
}
- if (isset($arguments["IncludePath"])) {
- $options["includepath"] = $arguments["IncludePath"];
+ if(isset($arguments["IncludePath"])) {
+ $options["includepath"] = $arguments["IncludePath"];
}
-
- if (isset($arguments["Debug"])) {
- $options["debug"] = $arguments["Debug"];
+ if(isset($arguments["Debug"])) {
+ $options["debug"] = $arguments["Debug"];
}
- $options["decimalplaces"] = $arguments["DecimalPlaces"];
- $options["LOBbufferlength"] = $arguments["LOBBufferLength"];
- $options["loglinebreak"] = $arguments["LogLineBreak"];
- $options["options"] = $arguments["Options"];
-
+ if(isset($arguments["DecimalPlaces"])) {
+ $options["decimalplaces"] = $arguments["DecimalPlaces"];
+ }
+ if(isset($arguments["LOBBufferLength"])) {
+ $options["LOBbufferlength"] = $arguments["LOBBufferLength"];
+ }
+ if(isset($arguments["LogLineBreak"])) {
+ $options["loglinebreak"] = $arguments["LogLineBreak"];
+ }
+ if(is_array($arguments["Options"])) {
+ $options = array_merge($options, $arguments["Options"]);
+ }
+ $options["seqname_format"] = "_sequence_%s";
$db = MDB::connect($dsninfo, $options);
if (MDB::isError($db) || !is_object($db)) {