php5 __construct plus old old class-name method calling the new constructor, added non_db_cols to __get() and __set()

This commit is contained in:
Ralf Becker 2008-05-26 08:27:24 +00:00
parent 1ad82e772a
commit 83a250e085
2 changed files with 34 additions and 16 deletions

View File

@ -141,7 +141,7 @@ class so_sql
*
* @return so_sql
*/
function so_sql($app='',$table='',$db=null,$column_prefix='',$no_clone=false)
function __construct($app='',$table='',$db=null,$column_prefix='',$no_clone=false)
{
if ($no_clone)
{
@ -172,6 +172,16 @@ class so_sql
$this->now = time() + $this->tz_offset_s; // time() is server-time and we need a user-time
}
/**
* php4 constructor
*
* @deprecated use __construct
*/
function so_sql($app='',$table='',$db=null,$column_prefix='')
{
self::__construct($app,$table,$db,$column_prefix);
}
/**
* sets up the class for an app and table (by using the table-definition of $app/setup/tables_current.inc.php
*
@ -622,11 +632,11 @@ class so_sql
{
$db_col = $col;
}
if ($wildcard || $criteria[$col]{0} == '!' ||
if ($wildcard || $criteria[$col][0] == '!' ||
is_string($criteria[$col]) && (strpos($criteria[$col],'*')!==false || strpos($criteria[$col],'?')!==false))
{
$cmp_op = ' '.$this->db->capabilities['case_insensitive_like'].' ';
if ($criteria[$col]{0} == '!')
if ($criteria[$col][0] == '!')
{
$cmp_op = ' NOT'.$cmp_op;
$criteria[$col] = substr($criteria[$col],1);

View File

@ -6,11 +6,10 @@
* @package etemplate
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker@outdoor-training.de>
* @copyright 2007/8 by RalfBecker@outdoor-training.de
* @version $Id$
*/
require_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.so_sql.inc.php');
/**
* generalized SQL Storage Object
*
@ -52,9 +51,19 @@ class so_sql2 extends so_sql
*
* @return so_sql2
*/
function __construct($app='',$table='',$db=null,$column_prefix='')
{
parent::__construct($app,$table,$db,$column_prefix);
}
/**
* php4 constructor
*
* @deprecated use __construct
*/
function so_sql2($app='',$table='',$db=null,$column_prefix='')
{
$this->so_sql($app,$table,$db,$column_prefix);
self::__construct($app,$table,$db,$column_prefix);
}
/**
@ -73,7 +82,7 @@ class so_sql2 extends so_sql
$property = $this->autoinc_id;
break;
}
if (in_array($property,$this->db_cols))
if (in_array($property,$this->db_cols) || in_array($property,$this->non_db_cols))
{
return $this->data[$property];
}
@ -86,7 +95,6 @@ class so_sql2 extends so_sql
*
* @param string $property
* @param mixed $value
* @return mixed
*/
function __set($property,$value)
{
@ -96,7 +104,7 @@ class so_sql2 extends so_sql
$property = $this->autoinc_id;
break;
}
if (in_array($property,$this->db_cols))
if (in_array($property,$this->db_cols) || in_array($property,$this->non_db_cols))
{
$this->data[$property] = $value;
}