[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.db.inc.php, 1.6, 1.6.4.1 clas
From: |
Dave Hall <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.db.inc.php, 1.6, 1.6.4.1 class.db_msql.inc.php, 1.5, 1.5.4.1 class.db_mssql.inc.php, 1.20.2.1, 1.20.2.1.2.1 class.db_mysql.inc.php, 1.30.2.3, 1.30.2.3.2.1 class.db_odbc.inc.php, 1.5, 1.5.4.1 class.db_oracle.inc.php, 1.6.2.1, 1.6.2.1.2.1 class.db_pgsql.inc.php, 1.30.2.1.2.1, 1.30.2.1.2.2 class.db_sybase.inc.php, 1.6, 1.6.4.1 |
Date: |
Wed, 16 Jul 2003 02:39:28 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv9951
Modified Files:
Tag: Version-0_9_16-branch
class.db.inc.php class.db_msql.inc.php class.db_mssql.inc.php
class.db_mysql.inc.php class.db_odbc.inc.php
class.db_oracle.inc.php class.db_pgsql.inc.php
class.db_sybase.inc.php
Log Message:
made the classes real OOP and documented as well :)
Index: class.db.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db.inc.php,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -C2 -r1.6 -r1.6.4.1
*** class.db.inc.php 2 Sep 2001 00:27:19 -0000 1.6
--- class.db.inc.php 16 Jul 2003 06:39:26 -0000 1.6.4.1
***************
*** 1,7 ****
<?php
if (empty($GLOBALS['phpgw_info']['server']['db_type']))
{
$GLOBALS['phpgw_info']['server']['db_type'] = 'mysql';
}
!
include(PHPGW_API_INC.'/class.db_'.$GLOBALS['phpgw_info']['server']['db_type'].'.inc.php');
?>
--- 1,454 ----
<?php
+ /**************************************************************************\
+ * phpGroupWare API - MySQL database support *
+ * Copyright (c) 1998-2000 NetUSE AG Boris Erdmann, Kristian Koehntopp *
+ * ------------------------------------------------------------------------ *
+ * This is not part of phpGroupWare, but is used by phpGroupWare.
*
+ * http://www.phpgroupware.org/
*
+ * ------------------------------------------------------------------------ *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as published *
+ * by the Free Software Foundation; either version 2.1 of the License, or *
+ * any later version. *
+ \**************************************************************************/
+
+ /* $Id$ */
+
if (empty($GLOBALS['phpgw_info']['server']['db_type']))
{
$GLOBALS['phpgw_info']['server']['db_type'] = 'mysql';
}
!
include(PHPGW_API_INC.'/class.db_'.$GLOBALS['phpgw_info']['server']['db_type'].'.inc.php');
!
! /**
! * Database abstraction library
! *
! * This allows phpGroupWare to use multiple database backends
! *
! * @package phpgwapi
! * @subpackage db
! * @abstract
! * @author NetUSE AG Boris Erdmann, Kristian Koehntopp <br> hacked on
by phpGW
! * @copyright © 1998-2000 NetUSE AG Boris Erdmann, Kristian
Koehntopp <br> 2003 FreeSoftware Foundation
! * @license LGPL
! * @link http://www.sanisoft.com/phplib/manual/DB_sql.php
! */
!
! class db_
! {
! /**
! * @var string $Host database host to connect to
! */
! var $Host = '';
!
! /**
! * @var string $Database name of database to use
! */
! var $Database = '';
!
! /**
! * @var string $User name of database user
! */
! var $User = '';
!
! /**
! * @var string $Password password for database user
! */
! var $Password = '';
!
! /**
! * @var bool $auto_stripslashes automatically remove slashes when
returning field values - default False
! */
! var $auto_stripslashes = False;
!
! /**
! * @var int $Auto_Free automatically free results - 0 no, 1 yes
! */
! var $Auto_Free = 0;
!
! /**
! * @var int $Debug enable debuging - 0 no, 1 yes
! */
! var $Debug = 0;
!
! /**
! * @var string $Halt_On_Error "yes" (halt with message), "no" (ignore
errors quietly), "report" (ignore errror, but spit a warning)
! */
! var $Halt_On_Error = 'yes';
!
! /**
! * @var string $Seq_Table table for storing sequences ????
! */
! var $Seq_Table = 'db_sequence';
!
! /**
! * @var array $Record current record
! */
! var $Record = array();
!
! /**
! * @var int row number for current record
! */
! var $Row;
!
! /**
! * @var int $Errno internal rdms error number for last error
! */
! var $Errno = 0;
!
! /**
! * @var string descriptive text from last error
! */
! var $Error = '';
!
! //i am not documenting private vars - skwashd :)
! var $xmlrpc = False;
! var $soap = False;
!
! /**
! * @param string $query query to be executed (optional)
! */
!
! function db_($query = '')
! {
! $this->query($query);
! }
!
! /**
! * @return int current connection id
! */
! function link_id()
! {
! return $this->Link_ID;
! }
!
! /**
! * @return int id of current query
! */
! function query_id()
! {
! return $this->Query_ID;
! }
!
! /**
! * Open a connection to a database
! *
! * @param string $Database name of database to use (optional)
! * @param string $Host database host to connect to (optional)
! * @param string $User name of database user (optional)
! * @var string $Password password for database user (optional)
! */
! function connect($Database = '', $Host = '', $User = '',
$Password = '')
! {}
!
! /**
! * Close a connection to a database - only needed for persistent
connections
! */
! function disconnect()
! {}
!
! /**
! * Escape strings before sending them to the database
! *
! * @param string $str the string to be escaped
! * @return string escaped sting
! */
! function db_addslashes($str)
! {
! if (!isset($str) || $str == '')
! {
! return '';
! }
!
! return addslashes($str);
! }
!
! /**
! * Convert a unix timestamp to a rdms specific timestamp
! *
! * @param int unix timestamp
! * @return string rdms specific timestamp
! */
! function to_timestamp($epoch)
! {}
!
! /**
! * Convert a rdms specific timestamp to a unix timestamp
! *
! * @param string rdms specific timestamp
! * @return int unix timestamp
! */
! function from_timestamp($timestamp)
! {}
!
! /**
! * @deprecated
! * @see limit_query()
! */
! function limit($start)
! {}
!
! /**
! * Discard the current query result
! */
! function free()
! {
! @mysql_free_result($this->Query_ID);
! $this->Query_ID = 0;
! }
!
! /**
! * Execute a query
! *
! * @param string $Query_String the query to be executed
! * @param mixed $line the line method was called from - use __LINE__
! * @param string $file the file method was called from - use __FILE__
! * @return int current query id if sucesful and null if fails
! */
! function query($Query_String, $line = '', $file = '')
! {}
!
! /**
! * Execute a query with limited result set
! *
! * @param string $Query_String the query to be executed
! * @param int $offset row to start from
! * @param mixed $line the line method was called from - use __LINE__
! * @param string $file the file method was called from - use __FILE__
! * @param int $num_rows number of rows to return (optional), if unset
will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
! * @return int current query id if sucesful and null if fails
! */
! function limit_query($Query_String, $offset, $line = '', $file
= '', $num_rows = '')
! {}
!
!
! /**
! * Move to the next row in the results set
! *
! * @return bool was another row found?
! */
! function next_record()
! {}
!
! /**
! * Move to position in result set
! *
! * @param int $pos required row (optional), default first row
! * @return int 1 if sucessful or 0 if not found
! */
! function seek($pos = 0)
! {}
!
! /**
! * Begin Transaction
! *
! * @return int current transaction id
! */
! function transaction_begin()
! {
! return True;
! }
!
! /**
! * Complete the transaction
! *
! * @return bool True if sucessful, False if fails
! */
! function transaction_commit()
! {
! return True;
! }
!
! /**
! * Rollback the current transaction
! *
! * @return bool True if sucessful, False if fails
! */
! function transaction_abort()
! {
! return True;
! }
!
! /**
! * Find the primary key of the last insertion on the current db
connection
! *
! * @param string $table name of table the insert was performed on
! * @param string $field the autoincrement primary key of the table
! * @return int the id, -1 if fails
! */
! function get_last_insert_id($table, $field)
! {}
!
! /**
! * Lock a table
! *
! * @param string $table name of table to lock
! * @param string $mode type of lock required (optional), default write
! * @return bool True if sucessful, False if fails
! */
! function lock($table, $mode='write')
! {}
!
! /**
! * Unlock a table
! *
! * @return bool True if sucessful, False if fails
! */
! function unlock()
! {}
!
!
! /**
! * Get the number of rows affected by last update
! *
! * @return int number of rows
! */
! function affected_rows()
! {}
!
! /**
! * Number of rows in current result set
! *
! * @return int number of rows
! */
! function num_rows()
! {}
!
! /**
! * Number of fields in current row
! *
! * @return int number of fields
! */
! function num_fields()
! {}
!
! /**
! * short hand for @see num_rows()
! */
! function nf()
! {
! return $this->num_rows();
! }
!
! /**
! * short hand for print @see num_rows
! */
! function np()
! {
! print $this->num_rows();
! }
!
! /**
! * Return the value of a filed
! *
! * @param string $String name of field
! * @param bool $strip_slashes string escape chars from
field(optional), default false
! * @return string the field value
! */
! function f($Name, $strip_slashes = False)
! {
! if ($strip_slashes || ($this->auto_stripslashes && !
$strip_slashes))
! {
! return stripslashes($this->Record[$Name]);
! }
! else
! {
! return $this->Record[$Name];
! }
! }
!
! /**
! * Print the value of a field
! *
! * @param string $Name name of field to print
! * @param bool $strip_slashes string escape chars from
field(optional), default false
! */
! function p($Name, $strip_slashes = True)
! {
! print $this->f($Name, $strip_slashes);
! }
!
! /**
! * Get the id for the next sequence - not implemented!
! *
! * @param string $seq_name name of the sequence
! * @return int sequence id
! */
! function nextid($seq_name)
! {}
!
! /**
! * Get description of a table
! *
! * @param string $table name of table to describe
! * @param bool $full optional, default False summary information, True
full information
! * @return array table meta data
! */
! function metadata($table='',$full=false)
! {
! /*
! * Due to compatibility problems with Table we changed
the behavior
! * of metadata();
! * depending on $full, metadata returns the following
values:
! *
! * - full is false (default):
! * $result[]:
! * [0]["table"] table name
! * [0]["name"] field name
! * [0]["type"] field type
! * [0]["len"] field length
! * [0]["flags"] field flags
! *
! * - full is true
! * $result[]:
! * ["num_fields"] number of metadata records
! * [0]["table"] table name
! * [0]["name"] field name
! * [0]["type"] field type
! * [0]["len"] field length
! * [0]["flags"] field flags
! * ["meta"][field name] index of field named "field
name"
! * The last one is used, if you have a field name,
but no index.
! * Test: if (isset($result['meta']['myfield'])) { ...
! */
! }
!
! /**
! * Error handler
! *
! * @param string $msg error message
! * @param int $line line of calling method/function (optional)
! * @param string $file file of calling method/function (optional)
! */
! function halt($msg, $line = '', $file = '')
! {}
!
! /**
! * Get a list of table names in the current database
! *
! * @return array list of the tables
! */
! function table_names()
! {
! }
!
! /**
! * Return a list of indexes in current database
! *
! * @return array list of indexes
! */
! function index_names()
! {
! return array();
! }
!
! /**
! * Create a new database
! *
! * @param string $adminname name of database administrator user
(optional)
! * @param string $adminpasswd password for the database administrator
user (optional)
! */
! function create_database($adminname = '', $adminpasswd = '')
! {}
! }
?>
Index: class.db_msql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_msql.inc.php,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -C2 -r1.5 -r1.5.4.1
*** class.db_msql.inc.php 29 Sep 2001 00:33:05 -0000 1.5
--- class.db_msql.inc.php 16 Jul 2003 06:39:26 -0000 1.5.4.1
***************
*** 18,46 ****
class db
{
! var $Host = '';
! var $Database = '';
!
! var $Link_ID = 0;
! var $Query_ID = 0;
! var $Record = array();
! var $Row;
!
! var $Error = '';
!
! var $Auto_Free = 0; ## Set this to 1 for automatic
msql_free_result()
!
! function connect()
{
// Not connected? Then connect?
! if ( 0 == $this->Link_ID )
{
// Check for local connect
! $this->Link_ID = empty($this->Host)?
! $this->Link_ID=msql_pconnect():
! $this->Link_ID=msql_pconnect($this->Host);
}
// Still not connected? Raise error.
! if ( 0 == $this->Link_ID )
{
$this->halt('Link-ID == false, pconnect
failed');
--- 18,52 ----
class db
{
! function connect($Database = '', $Host = '', $User = '',
$Password = '')
{
+ /* Handle defaults */
+ if ($Database == '')
+ {
+ $Database = $this->Database;
+ }
+ if ($Host == '')
+ {
+ $Host = $this->Host;
+ }
+ if ($User == '')
+ {
+ $User = $this->User;
+ }
+ if ($Password == '')
+ {
+ $Password = $this->Password;
+ }
+
// Not connected? Then connect?
! if (! $this->Link_ID)
{
// Check for local connect
! $this->Link_ID = empty($Host)?
! $this->Link_ID=msql_pconnect():
! $this->Link_ID=msql_pconnect($Host);
}
// Still not connected? Raise error.
! if (! $this->Link_ID )
{
$this->halt('Link-ID == false, pconnect
failed');
***************
*** 48,54 ****
// Select current database
! if (!msql_select_db($this->Database, $this->Link_ID))
{
! $this->halt('cannot use database
'.$this->Database);
}
}
--- 54,60 ----
// Select current database
! if (!msql_select_db($Database, $this->Link_ID))
{
! $this->halt('cannot use database '.$Database);
}
}
***************
*** 138,161 ****
{
return msql_num_fields($this->Query_ID);
- }
-
- function nf()
- {
- return $this->num_rows();
- }
-
- function np()
- {
- print $this->num_rows();
- }
-
- function f($Name)
- {
- return $this->Record[$Name];
- }
-
- function p($Name)
- {
- print $this->Record[$Name];
}
--- 144,147 ----
Index: class.db_mssql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_mssql.inc.php,v
retrieving revision 1.20.2.1
retrieving revision 1.20.2.1.2.1
diff -C2 -r1.20.2.1 -r1.20.2.1.2.1
*** class.db_mssql.inc.php 15 Feb 2002 01:25:03 -0000 1.20.2.1
--- class.db_mssql.inc.php 16 Jul 2003 06:39:26 -0000 1.20.2.1.2.1
***************
*** 22,53 ****
class db
{
- var $Host = '';
- var $Database = '';
- var $User = '';
- var $Password = '';
-
- var $Link_ID = 0;
- var $Query_ID = 0;
- var $Record = array();
- var $Row = 0;
var $VEOF = -1;
-
- var $Errno = 0;
- var $Error = '';
- var $Auto_Free = 0; ## set this to 1 to automatically
free results
- var $Debug = false;
var $Transaction = false;
! function connect()
{
! if ( 0 == $this->Link_ID )
{
if
($GLOBALS['phpgw_info']['server']['db_persistent'])
{
!
$this->Link_ID=mssql_pconnect($this->Host, $this->User, $this->Password);
}
else
{
!
$this->Link_ID=mssql_connect($this->Host, $this->User, $this->Password);
}
if (!$this->Link_ID)
--- 22,57 ----
class db
{
var $VEOF = -1;
var $Transaction = false;
! function connect($Database = '', $Host = '', $User = '',
$Password = '')
{
! /* Handle defaults */
! if ($Database == '')
! {
! $Database = $this->Database;
! }
! if ($Host == '')
! {
! $Host = $this->Host;
! }
! if ($User == '')
! {
! $User = $this->User;
! }
! if ($Password == '')
! {
! $Password = $this->Password;
! }
!
! if (! $this->Link_ID )
{
if
($GLOBALS['phpgw_info']['server']['db_persistent'])
{
! $this->Link_ID=mssql_pconnect($Host,
$User, $Password);
}
else
{
! $this->Link_ID=mssql_connect($Host,
$User, $Password);
}
if (!$this->Link_ID)
***************
*** 57,69 ****
else
{
! mssql_select_db($this->Database,
$this->Link_ID);
}
}
}
- function disconnect()
- {
- }
-
function db_addslashes($str)
{
--- 61,69 ----
else
{
! mssql_select_db($Database,
$this->Link_ID);
}
}
}
function db_addslashes($str)
{
***************
*** 72,83 ****
return '';
}
! return ereg_replace("'", "''", $str);
}
function free_result()
{
- /*
- mssql_free_result($this->Query_ID);
- */
if ($this->Query_ID)
{
--- 72,80 ----
return '';
}
! return str_replace("'", "''", $str);
}
function free_result()
{
if ($this->Query_ID)
{
***************
*** 254,260 ****
function num_rows()
{
- /*
- return mssql_num_rows($this->Query_ID);
- */
if($this->Query_ID)
{
--- 251,254 ----
***************
*** 272,303 ****
}
- function nf()
- {
- return $this->num_rows();
- }
-
- function np()
- {
- print $this->num_rows();
- }
-
function f($Field_Name)
{
! return $this->Record[strtolower($Field_Name)];
! }
!
! function p($Field_Name)
! {
! print $this->f($Field_Name);
}
- /* public: table locking */
function get_last_insert_id($table, $field)
{
- /* This will get the last insert ID created on the
current connection. Should only be called
- * after an insert query is run on a table that has an
auto incrementing field. Of note, table
- * and field are required for pgsql compatiblity.
MSSQL uses a query to retrieve the last
- * identity on the connection, so table and field are
ignored here as well.
- */
if (!isset($table) || $table == '' || !isset($field) ||
$field == '')
{
--- 266,283 ----
}
function f($Field_Name)
{
! if ($strip_slashes || ($this->auto_stripslashes && !
$strip_slashes))
! {
! return str_replace("''", "'",
$this->Record[$Name]);
! }
! else
! {
! return $this->Record[$Name];
! }
}
function get_last_insert_id($table, $field)
{
if (!isset($table) || $table == '' || !isset($field) ||
$field == '')
{
***************
*** 324,328 ****
}
- /* private: error handling */
function halt($msg, $line = '', $file = '')
{
--- 304,307 ----
***************
*** 380,390 ****
$i++;
}
- return $return;
- }
-
- /* Surely we can do this, eh */
- function index_names()
- {
- $return = array();
return $return;
}
--- 359,362 ----
Index: class.db_mysql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_mysql.inc.php,v
retrieving revision 1.30.2.3
retrieving revision 1.30.2.3.2.1
diff -C2 -r1.30.2.3 -r1.30.2.3.2.1
*** class.db_mysql.inc.php 13 Mar 2003 17:53:17 -0000 1.30.2.3
--- class.db_mysql.inc.php 16 Jul 2003 06:39:26 -0000 1.30.2.3.2.1
***************
*** 15,64 ****
/* $Id$ */
! class db
{
- /* public: connection parameters */
- var $Host = '';
- var $Database = '';
- var $User = '';
- var $Password = '';
-
- /* public: configuration parameters */
- var $auto_stripslashes = False;
- var $Auto_Free = 0; ## Set to 1 for automatic
mysql_free_result()
- var $Debug = 0; ## Set to 1 for debugging messages.
- var $Halt_On_Error = 'yes'; ## "yes" (halt with message), "no"
(ignore errors quietly), "report" (ignore errror, but spit a warning)
- var $Seq_Table = 'db_sequence';
-
- /* public: result array and current row number */
- var $Record = array();
- var $Row;
-
- /* public: current error number and error text */
- var $Errno = 0;
- var $Error = '';
-
/* public: this is an api revision, not a CVS revision. */
var $type = 'mysql';
var $revision = '1.2';
- /* private: link and query handles */
- var $Link_ID = 0;
- var $Query_ID = 0;
-
- /* public: constructor */
function db($query = '')
{
! $this->query($query);
! }
!
! /* public: some trivial reporting */
! function link_id()
! {
! return $this->Link_ID;
! }
!
! function query_id()
! {
! return $this->Query_ID;
}
--- 15,27 ----
/* $Id$ */
! class db extends db_
{
/* public: this is an api revision, not a CVS revision. */
var $type = 'mysql';
var $revision = '1.2';
function db($query = '')
{
! $this->db_($query);
}
***************
*** 67,88 ****
{
/* Handle defaults */
! if ('' == $Database)
{
$Database = $this->Database;
}
! if ('' == $Host)
{
$Host = $this->Host;
}
! if ('' == $User)
{
$User = $this->User;
}
! if ('' == $Password)
{
$Password = $this->Password;
}
/* establish connection, select database */
! if ( 0 == $this->Link_ID )
{
if
($GLOBALS['phpgw_info']['server']['db_persistent'])
--- 30,51 ----
{
/* Handle defaults */
! if ($Database == '')
{
$Database = $this->Database;
}
! if ($Host == '')
{
$Host = $this->Host;
}
! if ($User == '')
{
$User = $this->User;
}
! if ($Password == '')
{
$Password = $this->Password;
}
/* establish connection, select database */
! if (! $this->Link_ID)
{
if
($GLOBALS['phpgw_info']['server']['db_persistent'])
***************
*** 125,138 ****
}
- function db_addslashes($str)
- {
- if (!isset($str) || $str == '')
- {
- return '';
- }
-
- return addslashes($str);
- }
-
function to_timestamp($epoch)
{
--- 88,91 ----
***************
*** 147,165 ****
}
- function limit($start)
- {
- echo '<b>Warning: limit() is no longer used, use
limit_query()</b>';
-
- if ($start == 0)
- {
- $s = 'limit ' .
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $s = "limit $start," .
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- return $s;
- }
-
/* public: discard the query result */
function free()
--- 100,103 ----
***************
*** 280,298 ****
}
- function transaction_begin()
- {
- return True;
- }
-
- function transaction_commit()
- {
- return True;
- }
-
- function transaction_abort()
- {
- return True;
- }
-
function get_last_insert_id($table, $field)
{
--- 218,221 ----
***************
*** 375,406 ****
}
- /* public: shorthand notation */
- function nf()
- {
- return $this->num_rows();
- }
-
- function np()
- {
- print $this->num_rows();
- }
-
- function f($Name, $strip_slashes = "")
- {
- if ($strip_slashes || ($this->auto_stripslashes && !
$strip_slashes))
- {
- return stripslashes($this->Record[$Name]);
- }
- else
- {
- return $this->Record[$Name];
- }
- }
-
- function p($Name)
- {
- print $this->Record[$Name];
- }
-
/* public: sequence numbers */
function nextid($seq_name)
--- 298,301 ----
***************
*** 454,483 ****
$res = array();
- /*
- * Due to compatibility problems with Table we changed
the behavior
- * of metadata();
- * depending on $full, metadata returns the following
values:
- *
- * - full is false (default):
- * $result[]:
- * [0]["table"] table name
- * [0]["name"] field name
- * [0]["type"] field type
- * [0]["len"] field length
- * [0]["flags"] field flags
- *
- * - full is true
- * $result[]:
- * ["num_fields"] number of metadata records
- * [0]["table"] table name
- * [0]["name"] field name
- * [0]["type"] field type
- * [0]["len"] field length
- * [0]["flags"] field flags
- * ["meta"][field name] index of field named "field
name"
- * The last one is used, if you have a field name,
but no index.
- * Test: if (isset($result['meta']['myfield'])) { ...
- */
-
/* if no $table specified, assume that we are working
with a query */
/* result */
--- 349,352 ----
***************
*** 591,600 ****
$i++;
}
- return $return;
- }
-
- function index_names()
- {
- $return = array();
return $return;
}
--- 460,463 ----
Index: class.db_odbc.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_odbc.inc.php,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -C2 -r1.5 -r1.5.4.1
*** class.db_odbc.inc.php 29 Sep 2001 00:30:07 -0000 1.5
--- class.db_odbc.inc.php 16 Jul 2003 06:39:26 -0000 1.5.4.1
***************
*** 17,41 ****
class db
{
- var $Host = '';
- var $Database = '';
- var $User = '';
- var $Password = '';
var $UseODBCCursor = 0;
! var $Link_ID = 0;
! var $Query_ID = 0;
! var $Record = array();
! var $Row = 0;
!
! var $Errno = 0;
! var $Error = '';
!
! var $Auto_Free = 0; ## set this to 1 to automatically free
results
!
! function connect()
{
! if ( 0 == $this->Link_ID )
{
! $this->Link_ID=odbc_pconnect($this->Database,
$this->User, $this->Password, $this->UseODBCCursor);
if (!$this->Link_ID)
{
--- 17,45 ----
class db
{
var $UseODBCCursor = 0;
! function connect($Database = '', $Host = '', $User = '',
$Password = '')
{
! /* Handle defaults */
! if ($Database == '')
{
! $Database = $this->Database;
! }
! if ($Host == '')
! {
! $Host = $this->Host;
! }
! if ($User == '')
! {
! $User = $this->User;
! }
! if ($Password == '')
! {
! $Password = $this->Password;
! }
!
! if (! $this->Link_ID)
! {
! $this->Link_ID=odbc_pconnect($Database, $User,
$Password, $this->UseODBCCursor);
if (!$this->Link_ID)
{
***************
*** 183,204 ****
}
- function nf()
- {
- return $this->num_rows();
- }
-
- function np()
- {
- print $this->num_rows();
- }
-
function f($Field_Name)
{
return $this->Record[strtolower($Field_Name)];
- }
-
- function p($Field_Name)
- {
- print $this->f($Field_Name);
}
--- 187,193 ----
Index: class.db_oracle.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_oracle.inc.php,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.1.2.1
diff -C2 -r1.6.2.1 -r1.6.2.1.2.1
*** class.db_oracle.inc.php 18 Apr 2002 19:14:18 -0000 1.6.2.1
--- class.db_oracle.inc.php 16 Jul 2003 06:39:26 -0000 1.6.2.1.2.1
***************
*** 18,42 ****
class db
{
- var $Debug = False;
- var $Home = '/u01/app/oracle/product/8.0.4';
var $Remote = 1;
- /* Due to a strange error with Oracle 8.0.5, Apache and PHP3.0.6
- you don't need to set the ENV - on my system Apache
- will change to a zombie, if I don't set this to FALSE!
- If unsure try it out, if it works. */
- /* Milosch - omg, you aren't using 3.0.6 are you? */
- var $OraPutEnv = true;
-
- var $Database = '';
- var $User = '';
- var $Password = '';
-
- var $Link_ID = 0;
- var $Query_ID = 0;
- var $Record = array();
- var $Row;
- var $Errno = 0;
- var $Error = '';
var $ora_no_next_fetch = False;
--- 18,23 ----
***************
*** 46,81 ****
var $revision = '1.2';
- var $Halt_On_Error = 'yes'; ## 'yes' (halt with message), 'no'
(ignore errors quietly), 'report' (ignore errror, but spit a warning)
-
/* public: constructor */
function db($query = '')
{
! $this->query($query);
! }
!
! /* public: some trivial reporting */
! function link_id()
! {
! return $this->Link_ID;
! }
!
! function query_id()
! {
! return $this->Query_ID;
}
! function connect()
{
! ## see above why we do this
! if ($this->OraPutEnv)
{
! PutEnv("ORACLE_SID=$this->Database");
! PutEnv("ORACLE_HOME=$this->Home");
}
! if ( 0 == $this->Link_ID )
{
if($this->Debug)
{
! printf('<br>Connecting to ' .
$this->Database . "...<br>\n");
}
if($this->Remote)
--- 27,61 ----
var $revision = '1.2';
/* public: constructor */
function db($query = '')
{
! $this->db_($query);
}
! function connect($Database = '', $Host = '', $User = '',
$Password = '')
{
! /* Handle defaults */
! if ($Database == '')
! {
! $Database = $this->Database;
! }
! if ($Host == '')
{
! $Host = $this->Host;
}
! if ($User == '')
! {
! $User = $this->User;
! }
! if ($Password == '')
! {
! $Password = $this->Password;
! }
!
! if (! $this->Link_ID)
{
if($this->Debug)
{
! printf('<br>Connecting to ' . $Database
. "...<br>\n");
}
if($this->Remote)
***************
*** 83,102 ****
if($this->Debug)
{
! printf("<br>connect()
$this->User/address@hidden>Database.world<br>\n");
}
if($GLOBALS['phpgw_info']['server']['db_persistent'])
{
! $this->Link_ID =
ora_plogon("$this->User/$this->address@hidden>Database","");
/************** (comment by
SSilk)
this dosn't work on my system:
! $this->Link_ID =
ora_plogon("$this->address@hidden>Database.world","$this->Password");
***************/
}
else
{
! $this->Link_ID =
ora_logon("$this->User/$this->address@hidden>Database","");
/************** (comment by
SSilk)
this dosn't work on my system:
!
$this->Link_ID=ora_logon("$this->address@hidden>Database.world","$this->Password");
***************/
}
--- 63,82 ----
if($this->Debug)
{
! printf("<br>connect()
$User/address@hidden<br>\n");
}
if($GLOBALS['phpgw_info']['server']['db_persistent'])
{
! $this->Link_ID =
ora_plogon("$User/address@hidden","");
/************** (comment by
SSilk)
this dosn't work on my system:
! $this->Link_ID =
ora_plogon("address@hidden","$Password");
***************/
}
else
{
! $this->Link_ID =
ora_logon("$User/address@hidden","");
/************** (comment by
SSilk)
this dosn't work on my system:
!
$this->Link_ID=ora_logon("address@hidden","$Password");
***************/
}
***************
*** 106,119 ****
if($this->Debug)
{
! printf("<br>connect()
$this->User, $this->Password <br>\n");
}
if($GLOBALS['phpgw_info']['server']['db_persistent'])
{
!
$this->Link_ID=ora_plogon("$this->User","$this->Password");
/* (comment by SSilk: don't
know how this could work, but I leave this untouched!) */
}
else
{
!
$this->Link_ID=ora_logon("$this->User","$this->Password");
}
}
--- 86,99 ----
if($this->Debug)
{
! printf("<br>connect() $User,
$Password <br>\n");
}
if($GLOBALS['phpgw_info']['server']['db_persistent'])
{
!
$this->Link_ID=ora_plogon("$User","$Password");
/* (comment by SSilk: don't
know how this could work, but I leave this untouched!) */
}
else
{
!
$this->Link_ID=ora_logon("$User","$Password");
}
}
***************
*** 432,455 ****
}
return ora_numcols($this->Query_ID);
- }
-
- function nf()
- {
- return $this->num_rows();
- }
-
- function np()
- {
- print $this->num_rows();
- }
-
- function f($Name)
- {
- return $this->Record[$Name];
- }
-
- function p($Name)
- {
- print $this->Record[$Name];
}
--- 412,415 ----
Index: class.db_pgsql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_pgsql.inc.php,v
retrieving revision 1.30.2.1.2.1
retrieving revision 1.30.2.1.2.2
diff -C2 -r1.30.2.1.2.1 -r1.30.2.1.2.2
*** class.db_pgsql.inc.php 5 May 2003 19:35:33 -0000 1.30.2.1.2.1
--- class.db_pgsql.inc.php 16 Jul 2003 06:39:26 -0000 1.30.2.1.2.2
***************
*** 16,54 ****
/* $Id$ */
! class db
{
- var $Host = '';
- var $Database = '';
- var $User = '';
- var $Password = '';
-
- var $auto_stripslashes = False;
-
- /* "yes" (halt with message), "no" (ignore errors quietly),
"report" (ignore errror, but spit a warning) */
- var $Halt_On_Error = 'yes';
-
- var $Link_ID = 0;
- var $Query_ID = 0;
- var $Record = array();
- var $Row = 0;
-
var $Seq_Table = 'db_sequence';
- var $Errno = 0;
- var $Error = '';
-
- /* Set this to 1 for automatic pg_freeresult on last record. */
- var $Auto_Free = 0;
-
// PostgreSQL changed somethings from 6.x -> 7.x
var $db_version;
- // For our error handling
- var $xmlrpc = False;
- var $soap = False;
-
function ifadd($add, $me)
{
! if('' != $add)
{
return ' ' . $me . $add;
--- 16,29 ----
/* $Id$ */
! class db extends db_
{
var $Seq_Table = 'db_sequence';
// PostgreSQL changed somethings from 6.x -> 7.x
var $db_version;
function ifadd($add, $me)
{
! if($add != '')
{
return ' ' . $me . $add;
***************
*** 59,84 ****
function db($query = '')
{
! $this->query($query);
! if (ereg('xmlrpc.php',$_SERVER['PHP_SELF']))
{
! $this->xmlrpc = True;
}
!
! if (ereg('soap.php',$_SERVER['PHP_SELF']))
{
! $this->soap = True;
}
- }
! function connect()
! {
! if (0 == $this->Link_ID)
{
! $cstr = 'dbname=' . $this->Database
! . $this->ifadd($this->Host, 'host=')
! . $this->ifadd($this->Port, 'port=')
! . $this->ifadd($this->User, 'user=')
! . $this->ifadd("'".$this->Password."'",
'password=');
if
($GLOBALS['phpgw_info']['server']['db_persistent'])
{
--- 34,67 ----
function db($query = '')
{
! $this->db_($query);
! }
! function connect($Database = '', $Host = '', $User = '',
$Password = '')
! {
! /* Handle defaults */
! if ($Database == '')
{
! $Database = $this->Database;
}
! if ($Host == '')
{
! $Host = $this->Host;
! }
! if ($User == '')
! {
! $User = $this->User;
! }
! if ($Password == '')
! {
! $Password = $this->Password;
}
! if (! $this->Link_ID)
{
! $cstr = 'dbname=' . $Database
! . $this->ifadd($Host, 'host=')
! . $this->ifadd($Port, 'port=')
! . $this->ifadd($User, 'user=')
! . $this->ifadd("'".$Password."'",
'password=');
if
($GLOBALS['phpgw_info']['server']['db_persistent'])
{
***************
*** 158,178 ****
}
-
-
- function limit($start)
- {
- echo '<b>Warning: limit() is no longer used, use
limit_query()</b>';
-
- if ($start == 0)
- {
- $s = 'limit ' .
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $s = 'limit ' .
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] . ',' .
$start;
- }
- return $s;
- }
-
/* This only affects systems not using persistant connections */
function disconnect()
--- 141,144 ----
***************
*** 181,202 ****
}
- function db_addslashes($str)
- {
- if (!IsSet($str) || $str == '')
- {
- return '';
- }
-
- return addslashes($str);
- }
-
- /* I added the line and file section so we can have better
error reporting. (jengo) */
function query($Query_String, $line = '', $file = '')
{
- /* No empty queries, please, since PHP4 chokes on them.
*/
- /* The empty query string is passed on from the
constructor,
- * when calling the class without a query, e.g. in
situations
- * like these: '$db = new db_Subclass;'
- */
if ($Query_String == '')
{
--- 147,152 ----
***************
*** 221,225 ****
}
- /* public: perform a query with limited result set */
function limit_query($Query_String, $offset, $line = '', $file
= '', $num_rows = '')
{
--- 171,174 ----
***************
*** 246,250 ****
}
- // public: discard the query result
function free()
{
--- 195,198 ----
***************
*** 298,307 ****
function get_last_insert_id($table, $field)
{
- /* This will get the last insert ID created on the
current connection. Should only be called
- * after an insert query is run on a table that has an
auto incrementing field. Of note, table
- * and field are required because pgsql returns the
last inserted OID, which is unique across
- * an entire installation. These params allow us to
retrieve the sequenced field without adding
- * conditional code to the apps.
- */
if (!isset($table) || $table == '' || !isset($field) ||
$field == '')
{
--- 246,249 ----
***************
*** 363,367 ****
- /* public: sequence numbers */
function nextid($seq_name)
{
--- 305,308 ----
***************
*** 449,479 ****
{
return pg_numfields($this->Query_ID);
- }
-
- function nf()
- {
- return $this->num_rows();
- }
-
- function np()
- {
- print $this->num_rows();
- }
-
- function f($Name,$strip_slashes = '')
- {
- if ($strip_slashes || ($this->auto_stripslashes && !
$strip_slashes))
- {
- return stripslashes($this->Record[$Name]);
- }
- else
- {
- return $this->Record[$Name];
- }
- }
-
- function p($Name)
- {
- print $this->Record[$Name];
}
--- 390,393 ----
Index: class.db_sybase.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_sybase.inc.php,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -C2 -r1.6 -r1.6.4.1
*** class.db_sybase.inc.php 29 Sep 2001 00:25:58 -0000 1.6
--- class.db_sybase.inc.php 16 Jul 2003 06:39:26 -0000 1.6.4.1
***************
*** 20,46 ****
class db
{
- var $Host = '';
- var $Database = '';
- var $User = '';
- var $Password = '';
! var $Link_ID = 0;
! var $Query_ID = 0;
! var $Record = array();
! var $Row;
!
! var $Auto_Free = 0; ## Set this to 1 for automatic
sybase_free_result()
!
! function connect()
{
! if ( 0 == $this->Link_ID )
{
if
($GLOBALS['phpgw_info']['server']['db_persistent'])
{
!
$this->Link_ID=sybase_pconnect($this->Host,$this->User,$this->Password);
}
else
{
!
$this->Link_ID=sybase_connect($this->Host,$this->User,$this->Password);
}
}
--- 20,53 ----
class db
{
! function connect($Database = '', $Host = '', $User = '',
$Password = '')
{
! /* Handle defaults */
! if ($Database == '')
! {
! $Database = $this->Database;
! }
! if ($Host == '')
! {
! $Host = $this->Host;
! }
! if ($User == '')
! {
! $User = $this->User;
! }
! if ($Password == '')
! {
! $Password = $this->Password;
! }
!
! if (! $this->Link_ID)
{
if
($GLOBALS['phpgw_info']['server']['db_persistent'])
{
!
$this->Link_ID=sybase_pconnect($Host,$User,$Password);
}
else
{
!
$this->Link_ID=sybase_connect($Host,$User,$Password);
}
}
***************
*** 49,58 ****
$this->halt('Link-ID == false,
'.($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'')..'connect failed');
}
! if(!sybase_select_db($this->Database, $this->Link_ID))
{
! $this->halt('cannot use database
'.$this->Database);
}
}
function query($Query_String)
{
--- 56,74 ----
$this->halt('Link-ID == false,
'.($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'')..'connect failed');
}
! if(!sybase_select_db($Database, $this->Link_ID))
{
! $this->halt('cannot use database '.$Database);
}
}
+ function db_addslashes($str)
+ {
+ if (!IsSet($str) || $str == '')
+ {
+ return '';
+ }
+ return str_replace("'", "''", $str);
+ }
+
function query($Query_String)
{
***************
*** 138,159 ****
}
! function nf()
! {
! return $this->num_rows();
! }
!
! function np()
! {
! print $this->num_rows();
! }
!
! function f($Name)
{
! return $this->Record[$Name];
! }
!
! function p($Name)
! {
! print $this->Record[$Name];
}
--- 154,167 ----
}
! function f($Name, $strip_slashes = False)
{
! if ($strip_slashes || ($this->auto_stripslashes && !
$strip_slashes))
! {
! return str_replace("''", "'",
$this->Record[$Name]);
! }
! else
! {
! return $this->Record[$Name];
! }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.db.inc.php, 1.6, 1.6.4.1 class.db_msql.inc.php, 1.5, 1.5.4.1 class.db_mssql.inc.php, 1.20.2.1, 1.20.2.1.2.1 class.db_mysql.inc.php, 1.30.2.3, 1.30.2.3.2.1 class.db_odbc.inc.php, 1.5, 1.5.4.1 class.db_oracle.inc.php, 1.6.2.1, 1.6.2.1.2.1 class.db_pgsql.inc.php, 1.30.2.1.2.1, 1.30.2.1.2.2 class.db_sybase.inc.php, 1.6, 1.6.4.1,
Dave Hall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: setup applications.php,1.21,1.21.2.1
- Next by Date:
[Phpgroupware-cvs] CVS: property/inc class.bop_of_town.inc.php, NONE, 1.1 class.sop_of_town.inc.php, NONE, 1.1 class.uip_of_town.inc.php, NONE, 1.1 class.socategory.inc.php, 1.8, 1.9 class.socommon.inc.php, 1.32, 1.33 hook_admin.inc.php, 1.39, 1.40
- Previous by thread:
[Phpgroupware-cvs] CVS: setup applications.php,1.21,1.21.2.1
- Next by thread:
[Phpgroupware-cvs] CVS: property/inc class.bop_of_town.inc.php, NONE, 1.1 class.sop_of_town.inc.php, NONE, 1.1 class.uip_of_town.inc.php, NONE, 1.1 class.socategory.inc.php, 1.8, 1.9 class.socommon.inc.php, 1.32, 1.33 hook_admin.inc.php, 1.39, 1.40
- Index(es):