[PATCH] foldmarkers in pear/DB/DB.php
| From: | Roman Neuhauser | Date: | Wed, 12 Mar 2003 13:22:44 +0000 |
| Subject: | [PATCH] foldmarkers in pear/DB/DB.php | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-14219@lists.php.net to get a copy of this message | ||
* foldmarkers around constant definition blocks, methods, class
properties, and whole classes
* foldmethod=marker in vim modeline
--
If you cc me or remove the list(s) completely I'll most likely ignore
your message. see http://www.eyrie.org./~eagle/faqs/questions.html
Index: DB/DB.php =================================================================== RCS file: /repository/pear/DB/DB.php,v retrieving revision 1.17 diff -u -r1.17 DB.php --- DB/DB.php 18 Feb 2003 13:26:09 -0000 1.17 +++ DB/DB.php 12 Mar 2003 13:13:32 -0000 @@ -1,5 +1,5 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4: */ +/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */ // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ @@ -24,6 +24,8 @@ require_once "PEAR.php"; +// {{{ constants +// {{{ error codes /* * The method mapErrorCode in each DB_dbtype implementation maps * native error codes to one of these. @@ -61,6 +63,8 @@ define("DB_ERROR_ACCESS_VIOLATION", -26); define("DB_ERROR_NOSUCHDB", -27); +// }}} +// {{{ warning codes /* * Warnings are not detected as errors by DB::isError(), and are not * fatal. You can detect whether an error is in fact a warning with @@ -72,6 +76,8 @@ define('DB_WARNING', -1000); define('DB_WARNING_READ_ONLY', -1001); +// }}} +// {{{ prepared statement-related /* * These constants are used when storing information about prepared * statements (using the "prepare" method in DB_dbtype). @@ -93,6 +99,8 @@ define('DB_PARAM_OPAQUE', 2); define('DB_PARAM_MISC', 3); +// }}} +// {{{ binary data-related /* * These constants define different ways of returning binary data * from queries. Again, this model has been borrowed from the ODBC @@ -109,6 +117,8 @@ define('DB_BINMODE_RETURN', 2); define('DB_BINMODE_CONVERT', 3); +// }}} +// {{{ fetch modes /** * This is a special constant that tells DB the user hasn't specified * any particular get mode, so the default should be used. @@ -149,6 +159,8 @@ define('DB_GETMODE_ASSOC', DB_FETCHMODE_ASSOC); define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED); +// }}} +// {{{ tableInfo() && autoPrepare()-related /** * these are constants for the tableInfo-function * they are bitwised or'ed. so if there are more constants to be defined @@ -165,7 +177,10 @@ define('DB_AUTOQUERY_INSERT', 1); define('DB_AUTOQUERY_UPDATE', 2); +// }}} +// }}} +// {{{ class DB /** * The main "DB" class is simply a container class with some static * methods for creating DB objects as well as some utility functions @@ -194,6 +209,7 @@ class DB { + // {{{ &factory() /** * Create a new DB connection object for the specified database * type @@ -222,6 +238,8 @@ return $obj; } + // }}} + // {{{ &connect() /** * Create a new DB connection object and connect to the specified * database @@ -288,6 +306,8 @@ return $obj; } + // }}} + // {{{ apiVersion() /** * Return the DB API version * @@ -300,6 +320,8 @@ return 2; } + // }}} + // {{{ isError() /** * Tell whether a result code from a DB method is an error * @@ -316,6 +338,8 @@ is_subclass_of($value, 'db_error'))); } + // }}} + // {{{ isConnection() /** * Tell whether a value is a DB connection * @@ -332,6 +356,8 @@ method_exists($value, 'simpleQuery')); } + // }}} + // {{{ isManip() /** * Tell whether a query is a data manipulation query (insert, * update or delete) or a data definition query (create, drop, @@ -353,6 +379,8 @@ return false; } + // }}} + // {{{ errorMessage() /** * Return a textual error message for a DB error code * @@ -406,6 +434,8 @@ return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[DB_ERROR]; } + // }}} + // {{{ parseDSN() /** * Parse a data source name * @@ -554,6 +584,8 @@ return $parsed; } + // }}} + // {{{ assertExtension() /** * Load a PHP database extension if it is not loaded already. * @@ -574,8 +606,11 @@ } return true; } + // }}} } +// }}} +// {{{ class DB_Error /** * DB_Error implements a class for reporting portable database error * messages. @@ -585,6 +620,7 @@ */ class DB_Error extends PEAR_Error { + // {{{ constructor /** * DB_Error constructor. * @@ -607,8 +643,11 @@ $this->PEAR_Error("DB Error: $code", DB_ERROR, $mode, $level, $debuginfo); } } + // }}} } +// }}} +// {{{ class DB_Result /** * This class implements a wrapper for a DB result set. * A new instance of this class will be returned by the DB implementation @@ -620,6 +659,8 @@ class DB_result { + // {{{ properties + var $dbh; var $result; var $row_counter = null; @@ -635,6 +676,8 @@ */ var $limit_count = null; + // }}} + // {{{ constructor /** * DB_result constructor. * @param resource &$dbh DB object reference @@ -653,6 +696,8 @@ $this->fetchmode_object_class = $dbh->fetchmode_object_class; } + // }}} + // {{{ fetchRow() /** * Fetch and return a row of data (it uses driver->fetchInto for that) * @param int $fetchmode format of fetched row @@ -712,6 +757,8 @@ return $arr; } + // }}} + // {{{ fetchInto() /** * Fetch a row of data into an existing variable. * @@ -769,6 +816,8 @@ return $res; } + // }}} + // {{{ numCols() /** * Get the the number of columns in a result set. * @@ -781,6 +830,8 @@ return $this->dbh->numCols($this->result); } + // }}} + // {{{ numRows() /** * Get the number of rows in a result set. * @@ -793,6 +844,8 @@ return $this->dbh->numRows($this->result); } + // }}} + // {{{ nextResult() /** * Get the next result if a batch of queries was executed. * @@ -805,6 +858,8 @@ return $this->dbh->nextResult($this->result); } + // }}} + // {{{ free() /** * Frees the resources allocated for this result set. * @return int error code @@ -821,6 +876,8 @@ return true; } + // }}} + // {{{ tableInfo() /** * @deprecated */ @@ -829,6 +886,8 @@ return $this->dbh->tableInfo($this->result, $mode); } + // }}} + // {{{ getRowCounter() /** * returns the actual row number * @return integer @@ -837,14 +896,18 @@ { return $this->row_counter; } + // }}} } +// }}} +// {{{ class DB_Row /** * Pear DB Row Object * @see DB_common::setFetchMode() */ class DB_row { + // {{{ constructor /** * constructor * @@ -856,6 +919,9 @@ $this->$key = &$arr[$key]; } } + + // }}} } +// }}} ?>
Index: DB/DB.php =================================================================== RCS file: /repository/pear/DB/DB.php,v retrieving revision 1.17 diff -u -r1.17 DB.php --- DB/DB.php 18 Feb 2003 13:26:09 -0000 1.17 +++ DB/DB.php 12 Mar 2003 13:13:32 -0000 @@ -1,5 +1,5 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4: */ +/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */ // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ @@ -24,6 +24,8 @@ require_once "PEAR.php"; +// {{{ constants +// {{{ error codes /* * The method mapErrorCode in each DB_dbtype implementation maps * native error codes to one of these. @@ -61,6 +63,8 @@ define("DB_ERROR_ACCESS_VIOLATION", -26); define("DB_ERROR_NOSUCHDB", -27); +// }}} +// {{{ warning codes /* * Warnings are not detected as errors by DB::isError(), and are not * fatal. You can detect whether an error is in fact a warning with @@ -72,6 +76,8 @@ define('DB_WARNING', -1000); define('DB_WARNING_READ_ONLY', -1001); +// }}} +// {{{ prepared statement-related /* * These constants are used when storing information about prepared * statements (using the "prepare" method in DB_dbtype). @@ -93,6 +99,8 @@ define('DB_PARAM_OPAQUE', 2); define('DB_PARAM_MISC', 3); +// }}} +// {{{ binary data-related /* * These constants define different ways of returning binary data * from queries. Again, this model has been borrowed from the ODBC @@ -109,6 +117,8 @@ define('DB_BINMODE_RETURN', 2); define('DB_BINMODE_CONVERT', 3); +// }}} +// {{{ fetch modes /** * This is a special constant that tells DB the user hasn't specified * any particular get mode, so the default should be used. @@ -149,6 +159,8 @@ define('DB_GETMODE_ASSOC', DB_FETCHMODE_ASSOC); define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED); +// }}} +// {{{ tableInfo() && autoPrepare()-related /** * these are constants for the tableInfo-function * they are bitwised or'ed. so if there are more constants to be defined @@ -165,7 +177,10 @@ define('DB_AUTOQUERY_INSERT', 1); define('DB_AUTOQUERY_UPDATE', 2); +// }}} +// }}} +// {{{ class DB /** * The main "DB" class is simply a container class with some static * methods for creating DB objects as well as some utility functions @@ -194,6 +209,7 @@ class DB { + // {{{ &factory() /** * Create a new DB connection object for the specified database * type @@ -222,6 +238,8 @@ return $obj; } + // }}} + // {{{ &connect() /** * Create a new DB connection object and connect to the specified * database @@ -288,6 +306,8 @@ return $obj; } + // }}} + // {{{ apiVersion() /** * Return the DB API version * @@ -300,6 +320,8 @@ return 2; } + // }}} + // {{{ isError() /** * Tell whether a result code from a DB method is an error * @@ -316,6 +338,8 @@ is_subclass_of($value, 'db_error'))); } + // }}} + // {{{ isConnection() /** * Tell whether a value is a DB connection * @@ -332,6 +356,8 @@ method_exists($value, 'simpleQuery')); } + // }}} + // {{{ isManip() /** * Tell whether a query is a data manipulation query (insert, * update or delete) or a data definition query (create, drop, @@ -353,6 +379,8 @@ return false; } + // }}} + // {{{ errorMessage() /** * Return a textual error message for a DB error code * @@ -406,6 +434,8 @@ return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[DB_ERROR]; } + // }}} + // {{{ parseDSN() /** * Parse a data source name * @@ -554,6 +584,8 @@ return $parsed; } + // }}} + // {{{ assertExtension() /** * Load a PHP database extension if it is not loaded already. * @@ -574,8 +606,11 @@ } return true; } + // }}} } +// }}} +// {{{ class DB_Error /** * DB_Error implements a class for reporting portable database error * messages. @@ -585,6 +620,7 @@ */ class DB_Error extends PEAR_Error { + // {{{ constructor /** * DB_Error constructor. * @@ -607,8 +643,11 @@ $this->PEAR_Error("DB Error: $code", DB_ERROR, $mode, $level, $debuginfo); } } + // }}} } +// }}} +// {{{ class DB_Result /** * This class implements a wrapper for a DB result set. * A new instance of this class will be returned by the DB implementation @@ -620,6 +659,8 @@ class DB_result { + // {{{ properties + var $dbh; var $result; var $row_counter = null; @@ -635,6 +676,8 @@ */ var $limit_count = null; + // }}} + // {{{ constructor /** * DB_result constructor. * @param resource &$dbh DB object reference @@ -653,6 +696,8 @@ $this->fetchmode_object_class = $dbh->fetchmode_object_class; } + // }}} + // {{{ fetchRow() /** * Fetch and return a row of data (it uses driver->fetchInto for that) * @param int $fetchmode format of fetched row @@ -712,6 +757,8 @@ return $arr; } + // }}} + // {{{ fetchInto() /** * Fetch a row of data into an existing variable. * @@ -769,6 +816,8 @@ return $res; } + // }}} + // {{{ numCols() /** * Get the the number of columns in a result set. * @@ -781,6 +830,8 @@ return $this->dbh->numCols($this->result); } + // }}} + // {{{ numRows() /** * Get the number of rows in a result set. * @@ -793,6 +844,8 @@ return $this->dbh->numRows($this->result); } + // }}} + // {{{ nextResult() /** * Get the next result if a batch of queries was executed. * @@ -805,6 +858,8 @@ return $this->dbh->nextResult($this->result); } + // }}} + // {{{ free() /** * Frees the resources allocated for this result set. * @return int error code @@ -821,6 +876,8 @@ return true; } + // }}} + // {{{ tableInfo() /** * @deprecated */ @@ -829,6 +886,8 @@ return $this->dbh->tableInfo($this->result, $mode); } + // }}} + // {{{ getRowCounter() /** * returns the actual row number * @return integer @@ -837,14 +896,18 @@ { return $this->row_counter; } + // }}} } +// }}} +// {{{ class DB_Row /** * Pear DB Row Object * @see DB_common::setFetchMode() */ class DB_row { + // {{{ constructor /** * constructor * @@ -856,6 +919,9 @@ $this->$key = &$arr[$key]; } } + + // }}} } +// }}} ?>