phpOpenTracker/phpOpenTracker/Database Driver.php,1.7,1.8

Sebastian Bergmann <[email protected]> Fri, 27 Feb 2004 06:50:51 +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-serv12097/Database

Modified Files:
	Driver.php 
Log Message:
Flush.

Index: Driver.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Driver.php	24 Jan 2004 20:43:59 -0000	1.7
--- Driver.php	27 Feb 2004 06:50:49 -0000	1.8
***************
*** 24,27 ****
--- 24,28 ----
      protected $connection = null;
      protected $result = null;
+     protected $numQueries = 0;
  
      public function __construct() {
***************
*** 40,44 ****
  
          try {
!             $this->executeQuery($query, $isManip, $limit);
  
              if (!$isManip) {
--- 41,57 ----
  
          try {
!             $this->prepareQuery(
!               $query,
!               array(
!                 'limit' => $limit
!               ),
!               $isManip
!             );
! 
!             if ($this->configuration['debug_level'] > 1) {
!                 $this->debugQuery($query);
!             }
! 
!             $this->executeQuery($query);
  
              if (!$isManip) {
***************
*** 70,76 ****
      }
  
      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;
--- 83,101 ----
      }
  
+     protected function debugQuery($query) {
+         printf(
+           '<table border="1" width="100%%"><tr><td valign="top" width="50">%s</td><td valign="top"><pre>%s</pre></td></tr>',
+ 
+           ++$this->numQueries,
+           $query
+         );
+     }
+ 
      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;
***************
*** 82,88 ****
      abstract protected function connect();
      abstract protected function disconnect();
      abstract protected function fetchRow();
-     abstract protected function executeQuery($query, $isManip, $limit);
-     abstract protected function debugQuery($query);
  }
  
--- 107,113 ----
      abstract protected function connect();
      abstract protected function disconnect();
+     abstract protected function prepareQuery(&$query, $parameters, $isManip);
+     abstract protected function executeQuery($query);
      abstract protected function fetchRow();
  }
  



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click