phpOpenTracker/phpOpenTracker/Database/Driver MSSQL.php,1.8,1.9 MySQL.php,1.7,1.8 MySQL_Merge.php,1.3,1.4 Oracle.php,1.8,1.9 PostgreSQL.php,1.8,1.9
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/Driver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12097/Database/Driver
Modified Files:
MSSQL.php MySQL.php MySQL_Merge.php Oracle.php PostgreSQL.php
Log Message:
Flush.
Index: MySQL.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/MySQL.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MySQL.php 24 Jan 2004 20:45:33 -0000 1.7
--- MySQL.php 27 Feb 2004 06:50:49 -0000 1.8
***************
*** 20,42 ****
//
class phpOpenTracker_Database_Driver_MySQL extends phpOpenTracker_Database_Driver {
protected function connect() {
}
protected function disconnect() {
! @mysqli_close($this->connection);
}
! protected function fetchRow() {
! $row = @mysqli_fetch_assoc($this->result);
!
! if (is_array($row)) {
! return $row;
}
-
- return false;
}
! protected function executeQuery($query, $isManip, $limit) {
}
--- 20,57 ----
//
+ require_once POT_INCLUDE_PATH . 'Database/Driver.php';
+
class phpOpenTracker_Database_Driver_MySQL extends phpOpenTracker_Database_Driver {
+ public function quote($value) {
+ if (is_int($value) || is_double($value)) {
+ return $value;
+ } elseif (is_bool($value)) {
+ return $value ? 1 : 0;
+ } else {
+ return "'" . $this->connection->real_escape_sring(substr($value, 0, 254)) . "'";
+ }
+ }
+
protected function connect() {
+ $this->connection = new MySQLi(
+ $this->config['db_host'],
+ $this->config['db_user'],
+ $this->config['db_password'],
+ $this->config['db_database'],
+ ($this->config['db_port'] == 'default') ? '3306' : $this->config['db_port']
+ );
}
protected function disconnect() {
! $this->connection->close();
}
! protected function prepareQuery(&$query, $parameters, $isManip) {
! if (!$isManip && $parameters['limit'] !== false) {
! $query .= ' LIMIT ' . $parameters['limit'];
}
}
! protected function executeQuery($query) {
}
***************
*** 44,55 ****
}
! public function quote($value) {
! if (is_int($value) || is_double($value)) {
! return $value;
! } elseif (is_bool($value)) {
! return $value ? 1 : 0;
! } else {
! return "'" . mysqli_real_escape_string(substr($value, 0, 254), $this->connection) . "'";
}
}
}
--- 59,70 ----
}
! protected function fetchRow() {
! $row = $this->result->fetch_assoc();
!
! if (is_array($row)) {
! return $row;
}
+
+ return false;
}
}
Index: PostgreSQL.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/PostgreSQL.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** PostgreSQL.php 24 Jan 2004 20:45:33 -0000 1.8
--- PostgreSQL.php 27 Feb 2004 06:50:49 -0000 1.9
***************
*** 20,24 ****
--- 20,48 ----
//
+ require_once POT_INCLUDE_PATH . 'Database/Driver.php';
+
class phpOpenTracker_Database_Driver_PostgreSQL extends phpOpenTracker_Database_Driver {
+ public function quote($value) {
+ if (is_int($value) || is_double($value)) {
+ return $value;
+ } elseif (is_bool($value)) {
+ return $value ? 'TRUE' : 'FALSE';
+ } elseif (is_null($value)) {
+ return 'NULL';
+ } else {
+ return "'" . str_replace(
+ array(
+ '\\',
+ "'"
+ ),
+ array(
+ '\\\\',
+ "''"
+ ),
+ substr($value, 0, 254)
+ ) . "'";
+ }
+ }
+
protected function connect() {
$connectionString = sprintf(
***************
*** 42,64 ****
}
! protected function fetchRow() {
! $row = @pg_fetch_array($this->result);
!
! if (is_array($row)) {
! return $row;
}
-
- return false;
}
! protected function executeQuery($query, $isManip, $limit) {
! if ($limit !== false) {
! $query .= ' LIMIT ' . $limit;
! }
!
! if ($this->configuration['debug_level'] > 1) {
! $this->debugQuery($query);
! }
!
@pg_freeresult($this->result);
$this->result = @pg_exec($this->connection, $query);
--- 66,76 ----
}
! protected function prepareQuery(&$query, $parameters, $isManip) {
! if (!$isManip && $parameters['limit'] !== false) {
! $query .= ' LIMIT ' . $parameters['limit'];
}
}
! protected function executeQuery($query) {
@pg_freeresult($this->result);
$this->result = @pg_exec($this->connection, $query);
***************
*** 73,99 ****
}
! protected function debugQuery($query) {
! }
! public function quote($value) {
! if (is_int($value) || is_double($value)) {
! return $value;
! } elseif (is_bool($value)) {
! return $value ? 'TRUE' : 'FALSE';
! } elseif (is_null($value)) {
! return 'NULL';
! } else {
! return "'" . str_replace(
! array(
! '\\',
! "'"
! ),
! array(
! '\\\\',
! "''"
! ),
! substr($value, 0, 254)
! ) . "'";
}
}
}
--- 85,96 ----
}
! protected function fetchRow() {
! $row = @pg_fetch_array($this->result);
! if (is_array($row)) {
! return $row;
}
+
+ return false;
}
}
Index: MSSQL.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/MSSQL.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MSSQL.php 24 Jan 2004 20:45:05 -0000 1.8
--- MSSQL.php 27 Feb 2004 06:50:49 -0000 1.9
***************
*** 20,23 ****
--- 20,25 ----
//
+ require_once POT_INCLUDE_PATH . 'Database/Driver.php';
+
class phpOpenTracker_Database_Driver_MSSQL extends phpOpenTracker_Database_Driver {
protected function connect() {
***************
*** 45,71 ****
}
! protected function fetchRow() {
! $row = @mssql_fetch_assoc($this->result);
!
! if (is_array($row)) {
! return $row;
! }
!
! return false;
! }
!
! protected function executeQuery($query, $isManip, $limit) {
! if ($limit !== false) {
$query = str_replace(
'SELECT',
! 'SELECT TOP ' . $limit,
$query
);
}
! if ($this->configuration['debug_level'] > 1) {
! $this->debugQuery($query);
! }
!
@mssql_free_result($this->result);
$this->result = @mssql_query($query, $this->connection);
--- 47,61 ----
}
! protected function prepareQuery(&$query, $parameters, $isManip) {
! if (!$isManip && $parameters['limit'] !== false) {
$query = str_replace(
'SELECT',
! 'SELECT TOP ' . $parameters['limit'],
$query
);
}
+ }
! protected function executeQuery($query) {
@mssql_free_result($this->result);
$this->result = @mssql_query($query, $this->connection);
***************
*** 80,84 ****
}
! protected function debugQuery($query) {
}
}
--- 70,81 ----
}
! protected function fetchRow() {
! $row = @mssql_fetch_assoc($this->result);
!
! if (is_array($row)) {
! return $row;
! }
!
! return false;
}
}
Index: MySQL_Merge.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/MySQL_Merge.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MySQL_Merge.php 24 Jan 2004 20:45:33 -0000 1.3
--- MySQL_Merge.php 27 Feb 2004 06:50:49 -0000 1.4
***************
*** 20,24 ****
//
! class phpOpenTracker_Database_Driver_MySQL_Merge extends phpOpenTracker_Database_MySQL {
}
--- 20,29 ----
//
! require_once POT_INCLUDE_PATH . 'Database/Driver/MySQL.php';
!
! class phpOpenTracker_Database_Driver_MySQL_Merge extends phpOpenTracker_Database_Driver_MySQL {
! protected function prepareQuery(&$query, $parameters, $isManip) {
! parent::prepareQuery($query, $parameters, $isManip);
! }
}
Index: Oracle.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/Oracle.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Oracle.php 24 Jan 2004 20:45:33 -0000 1.8
--- Oracle.php 27 Feb 2004 06:50:49 -0000 1.9
***************
*** 20,23 ****
--- 20,25 ----
//
+ require_once POT_INCLUDE_PATH . 'Database/Driver.php';
+
class phpOpenTracker_Database_Driver_Oracle extends phpOpenTracker_Database_Driver {
protected function connect() {
***************
*** 41,68 ****
}
! protected function fetchRow() {
! $row = @OCIFetchInto($this->result, $result, OCI_ASSOC));
!
! if (is_array($row)) {
! return array_change_key_case($result, CASE_LOWER);
! }
!
! return false;
! }
!
! protected function executeQuery($query, $isManip, $limit) {
! if ($limit !== false) {
$query = sprintf(
'SELECT * FROM (%s) WHERE ROWNUM <= %d',
! $query,
! $limit
! );
! }
!
! if ($this->configuration['debug_level'] > 1) {
! $this->debugQuery($query);
}
@OCIFreeStatement($this->result);
$this->result = @OCIParse($this->connection, $query);
--- 43,58 ----
}
! protected function prepareQuery(&$query, $parameters, $isManip) {
! if (!$isManip && $parameters['limit'] !== false) {
$query = sprintf(
'SELECT * FROM (%s) WHERE ROWNUM <= %d',
! $query,
! $parameters['limit']
! );
}
+ }
+ protected function executeQuery($query) {
@OCIFreeStatement($this->result);
$this->result = @OCIParse($this->connection, $query);
***************
*** 87,91 ****
}
! protected function debugQuery($query) {
}
}
--- 77,88 ----
}
! protected function fetchRow() {
! $row = @OCIFetchInto($this->result, $result, OCI_ASSOC));
!
! if (is_array($row)) {
! return array_change_key_case($result, CASE_LOWER);
! }
!
! return false;
}
}
-------------------------------------------------------
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