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

From: Date: Thu, 09 Sep 2004 14:15:22 +0000
Subject: cvs: pear /MDB2/MDB2/Driver/Datatype Common.php fbsql.php ibase.php mssql.php mysql.php oci8.php pgsql.php sqlite.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-23753@lists.php.net to get a copy of this message
lsmith Thu Sep 9 10:15:22 2004 EDT Modified files: /pear/MDB2/MDB2/Driver/Datatype Common.php fbsql.php ibase.php mssql.php mysql.php oci8.php pgsql.php sqlite.php Log: reapplied changes to the clob and blob quote methods that were overwritten with the last commit

http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/Common.php?r1=1.12&r2=1.13&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/Common.php diff -u pear/MDB2/MDB2/Driver/Datatype/Common.php:1.12 pear/MDB2/MDB2/Driver/Datatype/Common.php:1.13 --- pear/MDB2/MDB2/Driver/Datatype/Common.php:1.12 Thu Sep 9 07:59:43 2004 +++ pear/MDB2/MDB2/Driver/Datatype/Common.php Thu Sep 9 10:15:22 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.12 2004/09/09 11:59:43 lsmith Exp $ +// $Id: Common.php,v 1.13 2004/09/09 14:15:22 lsmith Exp $ /** * @package MDB2 @@ -718,16 +718,14 @@ * * @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 private */ - 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); } // }}} @@ -736,13 +734,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]); } // }}} @@ -754,16 +752,14 @@ * * @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 private */ - 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); } // }}} @@ -772,13 +768,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.8&r2=1.9&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/fbsql.php diff -u pear/MDB2/MDB2/Driver/Datatype/fbsql.php:1.8 pear/MDB2/MDB2/Driver/Datatype/fbsql.php:1.9 --- pear/MDB2/MDB2/Driver/Datatype/fbsql.php:1.8 Thu Sep 9 07:59:43 2004 +++ pear/MDB2/MDB2/Driver/Datatype/fbsql.php Thu Sep 9 10:15:22 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.8 2004/09/09 11:59:43 lsmith Exp $ +// $Id: fbsql.php,v 1.9 2004/09/09 14:15:22 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -423,65 +423,20 @@ } // }}} - // {{{ _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 private - */ - 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 private */ - 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 "'".addslashes($value)."'"; } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/ibase.php?r1=1.10&r2=1.11&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/ibase.php diff -u pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.10 pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.11 --- pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.10 Thu Sep 9 07:59:43 2004 +++ pear/MDB2/MDB2/Driver/Datatype/ibase.php Thu Sep 9 10:15:22 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.10 2004/09/09 11:59:43 lsmith Exp $ +// $Id: ibase.php,v 1.11 2004/09/09 14:15:22 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -463,18 +463,15 @@ * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * - * @param $clob + * @param $value * @return string text string that represents the given argument value in * a DBMS specific format. * @access private */ - function _quoteCLOB($clob) + function _quoteCLOB($value) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($clob === null) { - return 'NULL'; - } - return $this->_quoteLOB($clob); + return $this->_quoteLOB($value); } // }}} @@ -484,18 +481,15 @@ * 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 private */ - function _quoteBLOB($blob) + function _quoteBLOB($value) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($blob === null) { - return 'NULL'; - } - return $this->_quoteLOB($blob); + return $this->_quoteLOB($value); } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/mssql.php?r1=1.8&r2=1.9&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/mssql.php diff -u pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.8 pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.9 --- pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.8 Thu Sep 9 07:59:43 2004 +++ pear/MDB2/MDB2/Driver/Datatype/mssql.php Thu Sep 9 10:15:22 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.8 2004/09/09 11:59:43 lsmith Exp $ +// $Id: mssql.php,v 1.9 2004/09/09 14:15:22 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 private - */ - 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 private */ - 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 bin2hex("0x".$value); + } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/mysql.php?r1=1.7&r2=1.8&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/mysql.php diff -u pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.7 pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.8 --- pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.7 Thu Sep 9 07:59:43 2004 +++ pear/MDB2/MDB2/Driver/Datatype/mysql.php Thu Sep 9 10:15:22 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.7 2004/09/09 11:59:43 lsmith Exp $ +// $Id: mysql.php,v 1.8 2004/09/09 14:15:22 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -382,65 +382,20 @@ } // }}} - // {{{ _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 private - */ - 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 private */ - 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 "'".addslashes($value)."'"; } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/oci8.php?r1=1.10&r2=1.11&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/oci8.php diff -u pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.10 pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.11 --- pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.10 Thu Sep 9 07:59:44 2004 +++ pear/MDB2/MDB2/Driver/Datatype/oci8.php Thu Sep 9 10:15:22 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.10 2004/09/09 11:59:44 lsmith Exp $ +// $Id: oci8.php,v 1.11 2004/09/09 14:15:22 lsmith Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -430,17 +430,13 @@ * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * - * @param $clob + * @param $value * @return string text string that represents the given argument value in * a DBMS specific format. * @access private */ - function _quoteCLOB($clob) + function _quoteCLOB($value) { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($clob === null) { - return 'NULL'; - } return 'EMPTY_CLOB()'; } @@ -451,17 +447,13 @@ * 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 private */ - function _quoteBLOB($blob) + function _quoteBLOB($value) { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($blob === null) { - return 'NULL'; - } return 'EMPTY_BLOB()'; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/pgsql.php?r1=1.7&r2=1.8&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/pgsql.php diff -u pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.7 pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.8 --- pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.7 Thu Sep 9 07:59:44 2004 +++ pear/MDB2/MDB2/Driver/Datatype/pgsql.php Thu Sep 9 10:15:22 2004 @@ -42,7 +42,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.7 2004/09/09 11:59:44 lsmith Exp $ +// $Id: pgsql.php,v 1.8 2004/09/09 14:15:22 lsmith Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -438,18 +438,14 @@ * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * - * @param $clob + * @param $value * @return string text string that represents the given argument value in * a DBMS specific format. * @access private */ - function _quoteCLOB($clob) + function _quoteCLOB($value) { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($clob === null) { - return 'NULL'; - } - return $this->_quoteLOB($clob); + return $this->_quoteLOB($value); } // }}} @@ -459,18 +455,14 @@ * 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 private */ - function _quoteBLOB($blob) + function _quoteBLOB($value) { - $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - if ($blob === null) { - return 'NULL'; - } - return $this->_quoteLOB($blob); + return $this->_quoteLOB($value); } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/sqlite.php?r1=1.9&r2=1.10&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/sqlite.php diff -u pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.9 pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.10 --- pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.9 Thu Sep 9 07:59:44 2004 +++ pear/MDB2/MDB2/Driver/Datatype/sqlite.php Thu Sep 9 10:15:22 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.9 2004/09/09 11:59:44 lsmith Exp $ +// $Id: sqlite.php,v 1.10 2004/09/09 14:15:22 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -384,68 +384,6 @@ $this->quote($field['default'], 'decimal') : ''; $notnull = isset($field['notnull']) ? ' NOT NULL' : ''; return $name.' '.$type.$default.$notnull; - } - - // }}} - // {{{ _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 private - */ - 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 private - */ - 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; } // }}}
« previous php.pear.cvs (#23753) next »