jon             Tue Mar 20 20:15:41 2001 EDT

  Modified files:              
    /php4/pear  DB.php 
  Log:
  Style and whitespace, based mostly on a submission from
  "Tomas V.V.Cox" <[EMAIL PROTECTED]>.
  
  
Index: php4/pear/DB.php
diff -u php4/pear/DB.php:1.50 php4/pear/DB.php:1.51
--- php4/pear/DB.php:1.50       Sun Mar 11 15:26:18 2001
+++ php4/pear/DB.php    Tue Mar 20 20:15:40 2001
@@ -17,7 +17,7 @@
 // |          Tomas V.V.Cox <[EMAIL PROTECTED]>                             |
 // +----------------------------------------------------------------------+
 //
-// $Id: DB.php,v 1.50 2001/03/11 23:26:18 jon Exp $
+// $Id: DB.php,v 1.51 2001/03/21 04:15:40 jon Exp $
 //
 // Database independent query interface.
 //
@@ -63,8 +63,8 @@
  * DB::isWarning().
  */
 
-define("DB_WARNING",           -1000);
-define("DB_WARNING_READ_ONLY", -1001);
+define('DB_WARNING',           -1000);
+define('DB_WARNING_READ_ONLY', -1001);
 
 /*
  * These constants are used when storing information about prepared
@@ -78,8 +78,8 @@
  * into your database).
  */
 
-define("DB_PARAM_SCALAR", 1);
-define("DB_PARAM_OPAQUE", 2);
+define('DB_PARAM_SCALAR', 1);
+define('DB_PARAM_OPAQUE', 2);
 
 /*
  * These constants define different ways of returning binary data
@@ -93,28 +93,28 @@
  * hex format, for example the string "123" would become "313233".
  */
 
-define("DB_BINMODE_PASSTHRU", 1);
-define("DB_BINMODE_RETURN",   2);
-define("DB_BINMODE_CONVERT",  3);
+define('DB_BINMODE_PASSTHRU', 1);
+define('DB_BINMODE_RETURN',   2);
+define('DB_BINMODE_CONVERT',  3);
 
 /**
  * This is a special constant that tells DB the user hasn't specified
  * any particular get mode, so the default should be used.
  */
 
-define("DB_FETCHMODE_DEFAULT", 0);
+define('DB_FETCHMODE_DEFAULT', 0);
 
 /**
  * Column data indexed by numbers, ordered from 0 and up
  */
 
-define("DB_FETCHMODE_ORDERED", 1);
+define('DB_FETCHMODE_ORDERED', 1);
 
 /**
  * Column data indexed by column names
  */
 
-define("DB_FETCHMODE_ASSOC", 2);
+define('DB_FETCHMODE_ASSOC', 2);
 
 /**
  * For multi-dimensional results: normally the first level of arrays
@@ -123,13 +123,13 @@
  * is the column name, and the second level the row number.
  */
 
-define("DB_FETCHMODE_FLIPPED", 4);
+define('DB_FETCHMODE_FLIPPED', 4);
 
 /* for compatibility */
 
-define("DB_GETMODE_ORDERED", DB_FETCHMODE_ORDERED);
-define("DB_GETMODE_ASSOC",   DB_FETCHMODE_ASSOC);
-define("DB_GETMODE_FLIPPED", DB_FETCHMODE_FLIPPED);
+define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
+define('DB_GETMODE_ASSOC',   DB_FETCHMODE_ASSOC);
+define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED);
 
 /**
  * The main "DB" class is simply a container class with some static
@@ -141,7 +141,7 @@
  * DB           The main DB class.  This is simply a utility class
  *              with some "static" methods for creating DB objects as
  *              well as common utility functions for other DB classes.
- * 
+ *
  * DB_common    The base for each DB implementation.  Provides default
  * |            implementations (in OO lingo virtual methods) for
  * |            the actual DB implementations as well as a bunch of
@@ -170,16 +170,16 @@
 
     function &factory($type)
     {
-       @include_once("DB/${type}.php");
+        @include_once("DB/${type}.php");
 
-       $classname = "DB_${type}";
-       @$obj =& new $classname;
+        $classname = "DB_${type}";
+        @$obj =& new $classname;
 
-       if (!$obj) {
-           return new DB_Error(DB_ERROR_NOT_FOUND);
-       }
+        if (!$obj) {
+            return new DB_Error(DB_ERROR_NOT_FOUND);
+        }
 
-       return $obj;
+        return $obj;
     }
 
     /**
@@ -208,8 +208,8 @@
             $dsninfo = DB::parseDSN($dsn);
         }
         $type = $dsninfo["phptype"];
-       
-       @include_once "DB/${type}.php";
+
+        @include_once "DB/${type}.php";
         $classname = "DB_${type}";
         @$obj =& new $classname;
 
@@ -243,7 +243,7 @@
      */
     function apiVersion()
     {
-       return 2;
+        return 2;
     }
 
     /**
@@ -255,9 +255,9 @@
      */
     function isError($value)
     {
-       return (is_object($value) &&
-               (get_class($value) == 'db_error' ||
-                is_subclass_of($value, 'db_error')));
+        return (is_object($value) &&
+            (get_class($value) == 'db_error' ||
+             is_subclass_of($value, 'db_error')));
     }
 
     /**
@@ -289,9 +289,9 @@
      */
     function isWarning($value)
     {
-       return is_object($value) &&
-           (get_class( $value ) == "db_warning" ||
-            is_subclass_of($value, "db_warning"));
+        return is_object($value) &&
+            (get_class( $value ) == "db_warning" ||
+             is_subclass_of($value, "db_warning"));
     }
 
     /**
@@ -304,39 +304,39 @@
      */
     function errorMessage($value)
     {
-       if (!isset($errorMessages)) {
-           $errorMessages = array(
-               DB_ERROR                    => "unknown error",
-               DB_ERROR_ALREADY_EXISTS     => "already exists",
-               DB_ERROR_CANNOT_CREATE      => "can not create",
-               DB_ERROR_CANNOT_DELETE      => "can not delete",
-               DB_ERROR_CANNOT_DROP        => "can not drop",
-               DB_ERROR_CONSTRAINT         => "constraint violation",
-               DB_ERROR_DIVZERO            => "division by zero",
-               DB_ERROR_INVALID            => "invalid",
-               DB_ERROR_INVALID_DATE       => "invalid date or time",
-               DB_ERROR_INVALID_NUMBER     => "invalid number",
-               DB_ERROR_MISMATCH           => "mismatch",
-               DB_ERROR_NODBSELECTED       => "no database selected",
-               DB_ERROR_NOSUCHFIELD        => "no such field",
-               DB_ERROR_NOSUCHTABLE        => "no such table",
-               DB_ERROR_NOT_CAPABLE        => "DB backend not capable",
-               DB_ERROR_NOT_FOUND          => "not found",
-               DB_ERROR_NOT_LOCKED         => "not locked",
-               DB_ERROR_SYNTAX             => "syntax error",
-               DB_ERROR_UNSUPPORTED        => "not supported",
-               DB_ERROR_VALUE_COUNT_ON_ROW => "value count on row",
-               DB_OK                       => "no error",
-               DB_WARNING                  => "unknown warning",
-               DB_WARNING_READ_ONLY        => "read only"
-           );
-       }
-
-       if (DB::isError($value)) {
-           $value = $value->code;
-       }
+        if (!isset($errorMessages)) {
+            $errorMessages = array(
+                DB_ERROR                    => 'unknown error',
+                DB_ERROR_ALREADY_EXISTS     => 'already exists',
+                DB_ERROR_CANNOT_CREATE      => 'can not create',
+                DB_ERROR_CANNOT_DELETE      => 'can not delete',
+                DB_ERROR_CANNOT_DROP        => 'can not drop',
+                DB_ERROR_CONSTRAINT         => 'constraint violation',
+                DB_ERROR_DIVZERO            => 'division by zero',
+                DB_ERROR_INVALID            => 'invalid',
+                DB_ERROR_INVALID_DATE       => 'invalid date or time',
+                DB_ERROR_INVALID_NUMBER     => 'invalid number',
+                DB_ERROR_MISMATCH           => 'mismatch',
+                DB_ERROR_NODBSELECTED       => 'no database selected',
+                DB_ERROR_NOSUCHFIELD        => 'no such field',
+                DB_ERROR_NOSUCHTABLE        => 'no such table',
+                DB_ERROR_NOT_CAPABLE        => 'DB backend not capable',
+                DB_ERROR_NOT_FOUND          => 'not found',
+                DB_ERROR_NOT_LOCKED         => 'not locked',
+                DB_ERROR_SYNTAX             => 'syntax error',
+                DB_ERROR_UNSUPPORTED        => 'not supported',
+                DB_ERROR_VALUE_COUNT_ON_ROW => 'value count on row',
+                DB_OK                       => 'no error',
+                DB_WARNING                  => 'unknown warning',
+                DB_WARNING_READ_ONLY        => 'read only'
+            );
+        }
+
+        if (DB::isError($value)) {
+            $value = $value->code;
+        }
 
-       return $errorMessages[$value];
+        return $errorMessages[$value];
     }
 
     /**
@@ -405,7 +405,7 @@
             $parsed['phptype'] = $str;
             $parsed['dbsyntax'] = $str;
         }
-       
+
         if (empty($dsn)) {
             return $parsed;
         }
@@ -465,7 +465,7 @@
     function assertExtension($name)
     {
         if (!extension_loaded($name)) {
-            $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
+            $dlext = (substr(PHP_OS, 0, 3) == 'WIN') ? '.dll' : '.so';
             @dl($name . $dlext);
         }
         if (!extension_loaded($name)) {
@@ -497,13 +497,13 @@
      */
 
     function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
-                     $level = E_USER_NOTICE, $debuginfo = null)
+              $level = E_USER_NOTICE, $debuginfo = null)
     {
-       if (is_int($code)) {
-           $this->PEAR_Error("DB Error: " . DB::errorMessage( $code ), $code, $mode, 
$level, $debuginfo);
-       } else {
-           $this->PEAR_Error("DB Error: $code", DB_ERROR, $mode, $level, $debuginfo);
-       }
+        if (is_int($code)) {
+            $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code, $mode, 
+$level, $debuginfo);
+        } else {
+            $this->PEAR_Error("DB Error: $code", DB_ERROR, $mode, $level, $debuginfo);
+        }
     }
 }
 
@@ -529,13 +529,13 @@
      */
 
     function DB_Warning($code = DB_WARNING, $mode = PEAR_ERROR_RETURN,
-                       $level = E_USER_NOTICE, $debuginfo = null)
+            $level = E_USER_NOTICE, $debuginfo = null)
     {
-      if (is_int($code)) {
-         $this->PEAR_Error("DB Warning: " . DB::errorMessage( $code ), $code, $mode, 
$level, $debuginfo);
-      } else {
-         $this->PEAR_Error("DB Warning: $code", 0, $mode, $level, $debuginfo);
-      }
+        if (is_int($code)) {
+            $this->PEAR_Error('DB Warning: ' . DB::errorMessage($code), $code, $mode, 
+$level, $debuginfo);
+        } else {
+            $this->PEAR_Error("DB Warning: $code", 0, $mode, $level, $debuginfo);
+        }
     }
 }
 
@@ -560,8 +560,8 @@
 
     function DB_result(&$dbh, $result)
     {
-       $this->dbh = &$dbh;
-       $this->result = $result;
+        $this->dbh = &$dbh;
+        $this->result = $result;
     }
 
     /**
@@ -570,10 +570,10 @@
      */
     function fetchRow($fetchmode = DB_FETCHMODE_DEFAULT)
     {
-       if ($fetchmode == DB_FETCHMODE_DEFAULT) {
-           $fetchmode = $this->dbh->fetchmode;
-       }
-       return $this->dbh->fetchRow($this->result, $fetchmode);
+        if ($fetchmode == DB_FETCHMODE_DEFAULT) {
+            $fetchmode = $this->dbh->fetchmode;
+        }
+        return $this->dbh->fetchRow($this->result, $fetchmode);
     }
 
     /**
@@ -584,10 +584,10 @@
      */
     function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT)
     {
-       if ($fetchmode == DB_FETCHMODE_DEFAULT) {
-           $fetchmode = $this->dbh->fetchmode;
-       }
-       return $this->dbh->fetchInto($this->result, $arr, $fetchmode);
+        if ($fetchmode == DB_FETCHMODE_DEFAULT) {
+            $fetchmode = $this->dbh->fetchmode;
+        }
+        return $this->dbh->fetchInto($this->result, $arr, $fetchmode);
     }
 
     /**
@@ -597,7 +597,7 @@
      */
     function numCols()
     {
-       return $this->dbh->numCols($this->result);
+        return $this->dbh->numCols($this->result);
     }
 
     /**
@@ -616,12 +616,12 @@
      */
     function free()
     {
-       $err = $this->dbh->freeResult($this->result);
-       if(DB::isError($err)) {
-           return $err;
-       }
-       $this->result = false;
-       return true;
+        $err = $this->dbh->freeResult($this->result);
+        if(DB::isError($err)) {
+            return $err;
+        }
+        $this->result = false;
+        return true;
     }
 }
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to