cvs: pear /DB_DataObject/DataObject Cast.php

From: Date: Wed, 20 Apr 2005 07:35:04 +0000
Subject: cvs: pear /DB_DataObject/DataObject Cast.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-31308@lists.php.net to get a copy of this message
alan_k Wed Apr 20 03:35:04 2005 EDT Modified files: /pear/DB_DataObject/DataObject Cast.php Log: fix bug #4182 better string and blob support on mysql in cast http://cvs.php.net/diff.php/pear/DB_DataObject/DataObject/Cast.php?r1=1.12&r2=1.13&ty=u Index: pear/DB_DataObject/DataObject/Cast.php diff -u pear/DB_DataObject/DataObject/Cast.php:1.12 pear/DB_DataObject/DataObject/Cast.php:1.13 --- pear/DB_DataObject/DataObject/Cast.php:1.12 Tue Mar 22 21:35:35 2005 +++ pear/DB_DataObject/DataObject/Cast.php Wed Apr 20 03:35:04 2005 @@ -17,7 +17,7 @@ * @author Alan Knowles <alan@akbkhome.com> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Cast.php,v 1.12 2005/03/23 02:35:35 alan_k Exp $ + * @version CVS: $Id: Cast.php,v 1.13 2005/04/20 07:35:04 alan_k Exp $ * @link http://pear.php.net/package/DB_DataObject */ @@ -381,8 +381,14 @@ return "'".pg_escape_bytea($this->value)."'::bytea"; case 'mysql': - case 'mysqli': // this probably works - return "'".addSlashes($this->value)."'"; + return "'".mysql_escape_string($this->value)."'"; + + // probably most of the rest could use this! - but it's pretty messy + // as we dont pass the database connection here. + case 'mysqli': + return "'".addslashes($this->value)."'"; + + default: return PEAR::raiseError("DB_DataObject_Cast cant handle blobs for Database:$db Yet"); @@ -418,6 +424,14 @@ case 'pgsql': return "'".pg_escape_string($this->value)."'::bytea"; + case 'mysql': + return "'".mysql_escape_string($this->value)."'"; + + // this will not work as we dont pass the db connection..! - oops bad design! + //case 'mysqli': + // return "'".mysql_escape_string($this->value)."'"; + + default: return PEAR::raiseError("DB_DataObject_Cast cant handle blobs for Database:$db Yet"); }

« previous php.pear.cvs (#31308) next »