cvs: pear /MDB2/MDB2/Driver/Datatype Common.php fbsql.php mssql.php mysql.php sqlite.php

From: Date: Sat, 04 Sep 2004 22:20:54 +0000
Subject: cvs: pear /MDB2/MDB2/Driver/Datatype Common.php fbsql.php mssql.php mysql.php sqlite.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-23631@lists.php.net to get a copy of this message
lsmith Sat Sep 4 18:20:54 2004 EDT Modified files: /pear/MDB2/MDB2/Driver/Datatype Common.php fbsql.php mssql.php mysql.php sqlite.php Log: - cosmetic fixes - added default implementation for quoteCLOB() and quoteBLOB()

http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/Common.php?r1=1.10&r2=1.11&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/Common.php diff -u pear/MDB2/MDB2/Driver/Datatype/Common.php:1.10 pear/MDB2/MDB2/Driver/Datatype/Common.php:1.11 --- pear/MDB2/MDB2/Driver/Datatype/Common.php:1.10 Fri May 21 07:43:56 2004 +++ pear/MDB2/MDB2/Driver/Datatype/Common.php Sat Sep 4 18:20:54 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.10 2004/05/21 11:43:56 lsmith Exp $ +// $Id: Common.php,v 1.11 2004/09/04 22:20:54 lsmith Exp $ /** * @package MDB2 @@ -623,17 +623,14 @@ * compose query statements. * * @param resource $prepared_query query handle from prepare() - * @param $parameter - * @param $clob + * @param $value * @return string text string that represents the given argument value in * a DBMS specific format. * @access public */ - function quoteCLOB($clob) + function quoteCLOB($value) { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, - 'quoteCLOB: prepared queries with values of type "clob" are not yet supported'); + return $this->quoteText($value); } // }}} @@ -642,13 +639,13 @@ /** * free a character large object * - * @param int $clob lob index + * @param int $value lob index * @access public */ - function freeCLOBValue($clob) + function freeCLOBValue($value) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - unset($db->lobs[$clob]); + unset($db->lobs[$value]); } // }}} @@ -659,17 +656,14 @@ * compose query statements. * * @param resource $prepared_query query handle from prepare() - * @param $parameter - * @param $blob + * @param $value * @return string text string that represents the given argument value in * a DBMS specific format. * @access public */ - function quoteBLOB($blob) + function quoteBLOB($value) { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, - 'quoteBLOB: prepared queries with values of type "blob" are not yet supported'); + return $this->quoteText($value); } // }}} @@ -678,13 +672,13 @@ /** * free a binary large object * - * @param int $blob lob index + * @param int $value lob index * @access public */ - function freeBLOBValue($blob) + function freeBLOBValue($value) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - unset($db->lobs[$blob]); + unset($db->lobs[$value]); } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/fbsql.php?r1=1.6&r2=1.7&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/fbsql.php diff -u pear/MDB2/MDB2/Driver/Datatype/fbsql.php:1.6 pear/MDB2/MDB2/Driver/Datatype/fbsql.php:1.7 --- pear/MDB2/MDB2/Driver/Datatype/fbsql.php:1.6 Fri May 21 07:43:56 2004 +++ pear/MDB2/MDB2/Driver/Datatype/fbsql.php Sat Sep 4 18:20:54 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.6 2004/05/21 11:43:56 lsmith Exp $ +// $Id: fbsql.php,v 1.7 2004/09/04 22:20:54 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -423,65 +423,21 @@ } // }}} - // {{{ quoteCLOB() - - /** - * Convert a text value into a DBMS specific format that is suitable to - * compose query statements. - * - * @param $clob - * @return string text string that represents the given argument value in - * a DBMS specific format. - * @access public - */ - function quoteCLOB($clob) - { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($clob === null) { - return 'NULL'; - } - $value = "'"; - $data = null; - while (!$this->endOfLOB($clob)) { - $result = $this->readLOB($clob, $data, $db->options['lob_buffer_length']); - if (MDB2::isError($result)) { - return $result; - } - $value .= $db->escape($data); - } - $value .= "'"; - return $value; - } - - // }}} // {{{ quoteBLOB() /** * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * - * @param $blob + * @param $value * @return string text string that represents the given argument value in * a DBMS specific format. * @access public */ - function quoteBLOB($blob) + function quoteBLOB($value) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($blob === null) { - return 'NULL'; - } - $value = "'"; - $data = null; - while (!$this->endOfLOB($blob)) { - $result = $this->readLOB($blob, $data, $db->options['lob_buffer_length']); - if (MDB2::isError($result)) { - return $result; - } - $value .= addslashes($data); - } - $value .= "'"; - return $value; + return (is_null($value)) ? 'NULL' : "'".addslashes($value)."'"; } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/mssql.php?r1=1.6&r2=1.7&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/mssql.php diff -u pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.6 pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.7 --- pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.6 Fri May 21 07:43:56 2004 +++ pear/MDB2/MDB2/Driver/Datatype/mssql.php Sat Sep 4 18:20:54 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.6 2004/05/21 11:43:56 lsmith Exp $ +// $Id: mssql.php,v 1.7 2004/09/04 22:20:54 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -310,64 +310,21 @@ } // }}} - // {{{ quoteCLOB() - - /** - * Convert a text value into a DBMS specific format that is suitable to - * compose query statements. - * - * @param $clob - * @return string text string that represents the given argument value in - * a DBMS specific format. - * @access public - */ - function quoteCLOB($clob) - { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($clob === null) { - return 'NULL'; - } - $value = "'"; - $data = null; - while (!$this->endOfLOB($clob)) { - $result = $this->readLOB($clob, $data, $db->options['lob_buffer_length']); - if (MDB2::isError($result)) { - return $result; - } - $value .= $db->escape($data); - } - $value .= "'"; - return $value; - } - - // }}} // {{{ quoteBLOB() /** * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * - * @param $blob + * @param $value * @return string text string that represents the given argument value in * a DBMS specific format. * @access public */ - function quoteBLOB($blob) + function quoteBLOB($value) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($blob === null) { - return 'NULL'; - } - $value = "0x"; - $data = null; - while (!$this->endOfLOB($blob)) { - $result = $this->readLOB($blob, $data, $db->options['lob_buffer_length']); - if (MDB2::isError($result)) { - return $result; - } - $value .= bin2hex($data); - } - return $value; + return (is_null($value)) ? 'NULL' : "'".bin2hex($value)."'"; } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/mysql.php?r1=1.5&r2=1.6&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/mysql.php diff -u pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.5 pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.6 --- pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.5 Fri May 21 07:43:56 2004 +++ pear/MDB2/MDB2/Driver/Datatype/mysql.php Sat Sep 4 18:20:54 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.5 2004/05/21 11:43:56 lsmith Exp $ +// $Id: mysql.php,v 1.6 2004/09/04 22:20:54 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -382,65 +382,21 @@ } // }}} - // {{{ quoteCLOB() - - /** - * Convert a text value into a DBMS specific format that is suitable to - * compose query statements. - * - * @param $clob - * @return string text string that represents the given argument value in - * a DBMS specific format. - * @access public - */ - function quoteCLOB($clob) - { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if (is_null($clob)) { - return 'NULL'; - } - $value = "'"; - $data = null; - while (!$this->endOfLOB($clob)) { - $result = $this->readLOB($clob, $data, $db->options['lob_buffer_length']); - if (MDB2::isError($result)) { - return $result; - } - $value .= $db->escape($data); - } - $value .= "'"; - return $value; - } - - // }}} // {{{ quoteBLOB() /** * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * - * @param $blob + * @param $value * @return string text string that represents the given argument value in * a DBMS specific format. * @access public */ - function quoteBLOB($blob) + function quoteBLOB($value) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if (is_null($blob)) { - return 'NULL'; - } - $value = "'"; - $data = null; - while (!$this->endOfLOB($blob)) { - $result = $this->readLOB($blob, $data, $db->options['lob_buffer_length']); - if (MDB2::isError($result)) { - return $result; - } - $value .= addslashes($data); - } - $value .= "'"; - return $value; + return (is_null($value)) ? 'NULL' : "'".addslashes($value)."'"; } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/sqlite.php?r1=1.7&r2=1.8&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/sqlite.php diff -u pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.7 pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.8 --- pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.7 Fri May 21 07:43:56 2004 +++ pear/MDB2/MDB2/Driver/Datatype/sqlite.php Sat Sep 4 18:20:54 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.7 2004/05/21 11:43:56 lsmith Exp $ +// $Id: sqlite.php,v 1.8 2004/09/04 22:20:54 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -393,60 +393,6 @@ * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * - * @param $clob - * @return string text string that represents the given argument value in - * a DBMS specific format. - * @access public - */ - function quoteCLOB($clob) - { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($clob === null) { - return 'NULL'; - } - $value = "'"; - $data = null; - while (!$this->endOfLOB($clob)) { - $result = $this->readLOB($clob, $data, $db->options['lob_buffer_length']); - if (MDB2::isError($result)) { - return $result; - } - $value .= $db->escape($data); - } - $value .= "'"; - return $value; - } - - // }}} - // {{{ quoteBLOB() - - /** - * Convert a text value into a DBMS specific format that is suitable to - * compose query statements. - * - * @param $blob - * @return string text string that represents the given argument value in - * a DBMS specific format. - * @access public - */ - function quoteBLOB($blob) - { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($blob === null) { - return 'NULL'; - } - $value = "'"; - $data = null; - while (!$this->endOfLOB($blob)) { - $result = $this->readLOB($blob, $data, $db->options['lob_buffer_length']); - if (MDB2::isError($result)) { - return $result; - } - $value .= $db->escape($data); - } - $value .= "'"; - return $value; - } // }}} // {{{ quoteFloat()
« previous php.pear.cvs (#23631) next »