phpOpenTracker/phpOpenTracker/Database Driver.php,1.13,1.14 Exception.php,1.4,1.5 Factory.php,1.1,1.2

Sebastian Bergmann <[email protected]> Mon, 08 Mar 2004 05:16:09 +0000
Newsgroups gmane.comp.web.phpopentracker.cvs
Message-ID <[email protected]>
Update of /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25160

Modified Files:
	Driver.php Exception.php Factory.php 
Log Message:
DocComments

Index: Exception.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Exception.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Exception.php	27 Feb 2004 08:05:41 -0000	1.4
--- Exception.php	8 Mar 2004 05:16:06 -0000	1.5
***************
*** 22,25 ****
--- 22,32 ----
  require_once POT_INCLUDE_PATH . 'Exception.php';
  
+ /**
+  * Database Exception.
+  *
+  * @package phpopentracker.database
+  * @author  Sebastian Bergmann <[email protected]>
+  * @since   phpOpenTracker 2.0.0
+  */
  class phpOpenTracker_Database_Exception extends phpOpenTracker_Exception {
  }

Index: Driver.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Driver.php	3 Mar 2004 17:15:05 -0000	1.13
--- Driver.php	8 Mar 2004 05:16:06 -0000	1.14
***************
*** 20,29 ****
--- 20,65 ----
  //
  
+ /**
+  * Database Factory.
+  *
+  * @package phpopentracker.database
+  * @author  Sebastian Bergmann <[email protected]>
+  * @since   phpOpenTracker 2.0.0
+  */
  abstract class phpOpenTracker_Database_Driver {
+     /**
+     * @var    array
+     * @access protected
+     * @static
+     */
      protected $configuration = null;
+ 
+     /**
+     * @var    mixed
+     * @access protected
+     * @static
+     */
      protected $connection = null;
+ 
+     /**
+     * @var    mixed
+     * @access protected
+     * @static
+     */
      protected $result = null;
+ 
+     /**
+     * @var    integer
+     * @access protected
+     * @static
+     */
      protected $numQueries = 0;
  
+     /**
+     * Constructor.
+     *
+     * @access public
+     * @final
+     */
      public final function __construct() {
          $this->configuration = phpOpenTracker_Configuration::getConfiguration();
***************
*** 31,34 ****
--- 67,76 ----
      }
  
+     /**
+     * Destructor.
+     *
+     * @access public
+     * @final
+     */
      public final function __destruct() {
          $this->disconnect();
***************
*** 36,39 ****
--- 78,91 ----
      }
  
+     /**
+     * 
+     *
+     * @param  string  $query
+     * @param  mixed   $limit
+     * @param  boolean $warnOnFailure
+     * @throws phpOpenTracker_Database_Exception
+     * @access public
+     * @final
+     */
      public final function query($query, $limit = false, $warnOnFailure = true) {
          $isManip = $this->isManip($query);
***************
*** 71,74 ****
--- 123,133 ----
      }
  
+     /**
+     * Quotes an SQL string.
+     *
+     * @param  string  $query
+     * @return string
+     * @access public
+     */
      public function quote($value) {
          if (is_int($value) || is_double($value)) {
***************
*** 83,86 ****
--- 142,151 ----
      }
  
+     /**
+     * Prints SQL debugging/profiling information.
+     *
+     * @param  string  $query
+     * @access protected
+     */
      protected function debugQuery($query) {
          printf(
***************
*** 92,102 ****
      }
  
      private function isManip($query) {
!         $manips = 'INSERT|UPDATE|DELETE|' .
!                   'REPLACE|CREATE|DROP|'  .
!                   'ALTER|GRANT|REVOKE|'   .
!                   'LOCK|UNLOCK';
! 
!         if (preg_match('/^\s*"?(' . $manips . ')\s+/i', $query)) {
              return true;
          }
--- 157,169 ----
      }
  
+     /**
+     * Returns true for manipulating SQL queries.
+     *
+     * @param  string  $query
+     * @return boolean
+     * @access private
+     */
      private function isManip($query) {
!         if (preg_match('/^\s*"?(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $query)) {
              return true;
          }
***************
*** 105,112 ****
--- 172,218 ----
      }
  
+     /**
+     * Opens a connection to the configured database.
+     *
+     * @access public
+     * @abstract
+     */
      abstract protected function connect();
+ 
+     /**
+     * Closes a connection.
+     *
+     * @access public
+     * @abstract
+     */
      abstract protected function disconnect();
+ 
+     /**
+     * Rewrites an SQL query, for instance to LIMIT it.
+     *
+     * @param  string  $query
+     * @param  array   $parameters
+     * @param  boolean $isManip
+     * @access public
+     * @abstract
+     */
      abstract protected function rewriteQuery(&$query, $parameters, $isManip);
+ 
+     /**
+     * Executes an SQL query.
+     *
+     * @param  string  $query
+     * @access public
+     * @abstract
+     */
      abstract protected function executeQuery($query);
+ 
+     /**
+     * Fetches a row from a result set.
+     *
+     * @return array
+     * @access public
+     * @abstract
+     */
      abstract public function fetchRow();
  }

Index: Factory.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Factory.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Factory.php	1 Mar 2004 08:56:58 -0000	1.1
--- Factory.php	8 Mar 2004 05:16:07 -0000	1.2
***************
*** 23,32 ****
--- 23,56 ----
  require_once POT_INCLUDE_PATH . 'Configuration.php';
  
+ /**
+  * Database Factory.
+  *
+  * @package phpopentracker.database
+  * @author  Sebastian Bergmann <[email protected]>
+  * @since   phpOpenTracker 2.0.0
+  */
  class phpOpenTracker_Database_Factory {
+     /**
+     * @var    phpOpenTracker_Database_Driver
+     * @access private
+     * @static
+     */
      private static $instance = null;
  
+     /**
+     * Prevent object construction.
+     *
+     * @access private
+     */
      private function __construct() {
      }
  
+     /**
+     * Returns a phpOpenTracker_Database_Driver object
+     * for the configured database connection.
+     *
+     * @return phpOpenTracker_Database_Driver
+     * @access public
+     */
      public static function getInstance() {
          if (self::$instance == null) {



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click