more MDB2 updates
This commit is contained in:
parent
ddf0903ace
commit
77e2387d94
48 changed files with 22977 additions and 21917 deletions
2
3rdparty/Archive/Tar.php
vendored
2
3rdparty/Archive/Tar.php
vendored
|
@ -577,7 +577,7 @@ class Archive_Tar extends PEAR
|
|||
}
|
||||
|
||||
// ----- Get the arguments
|
||||
$v_att_list = &func_get_args();
|
||||
$v_att_list = func_get_args();
|
||||
|
||||
// ----- Read the attributes
|
||||
$i=0;
|
||||
|
|
8857
3rdparty/MDB2.php
vendored
8857
3rdparty/MDB2.php
vendored
File diff suppressed because it is too large
Load diff
366
3rdparty/MDB2/Date.php
vendored
366
3rdparty/MDB2/Date.php
vendored
|
@ -1,183 +1,183 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Date.php 208329 2006-03-01 12:15:38Z lsmith $
|
||||
//
|
||||
|
||||
/**
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Several methods to convert the MDB2 native timestamp format (ISO based)
|
||||
* to and from data structures that are convenient to worth with in side of php.
|
||||
* For more complex date arithmetic please take a look at the Date package in PEAR
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Date
|
||||
{
|
||||
// {{{ mdbNow()
|
||||
|
||||
/**
|
||||
* return the current datetime
|
||||
*
|
||||
* @return string current datetime in the MDB2 format
|
||||
* @access public
|
||||
*/
|
||||
function mdbNow()
|
||||
{
|
||||
return date('Y-m-d H:i:s');
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ mdbToday()
|
||||
|
||||
/**
|
||||
* return the current date
|
||||
*
|
||||
* @return string current date in the MDB2 format
|
||||
* @access public
|
||||
*/
|
||||
function mdbToday()
|
||||
{
|
||||
return date('Y-m-d');
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ mdbTime()
|
||||
|
||||
/**
|
||||
* return the current time
|
||||
*
|
||||
* @return string current time in the MDB2 format
|
||||
* @access public
|
||||
*/
|
||||
function mdbTime()
|
||||
{
|
||||
return date('H:i:s');
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ date2Mdbstamp()
|
||||
|
||||
/**
|
||||
* convert a date into a MDB2 timestamp
|
||||
*
|
||||
* @param int hour of the date
|
||||
* @param int minute of the date
|
||||
* @param int second of the date
|
||||
* @param int month of the date
|
||||
* @param int day of the date
|
||||
* @param int year of the date
|
||||
*
|
||||
* @return string a valid MDB2 timestamp
|
||||
* @access public
|
||||
*/
|
||||
function date2Mdbstamp($hour = null, $minute = null, $second = null,
|
||||
$month = null, $day = null, $year = null)
|
||||
{
|
||||
return MDB2_Date::unix2Mdbstamp(mktime($hour, $minute, $second, $month, $day, $year, -1));
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ unix2Mdbstamp()
|
||||
|
||||
/**
|
||||
* convert a unix timestamp into a MDB2 timestamp
|
||||
*
|
||||
* @param int a valid unix timestamp
|
||||
*
|
||||
* @return string a valid MDB2 timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unix2Mdbstamp($unix_timestamp)
|
||||
{
|
||||
return date('Y-m-d H:i:s', $unix_timestamp);
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ mdbstamp2Unix()
|
||||
|
||||
/**
|
||||
* convert a MDB2 timestamp into a unix timestamp
|
||||
*
|
||||
* @param int a valid MDB2 timestamp
|
||||
* @return string unix timestamp with the time stored in the MDB2 format
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function mdbstamp2Unix($mdb_timestamp)
|
||||
{
|
||||
$arr = MDB2_Date::mdbstamp2Date($mdb_timestamp);
|
||||
|
||||
return mktime($arr['hour'], $arr['minute'], $arr['second'], $arr['month'], $arr['day'], $arr['year'], -1);
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ mdbstamp2Date()
|
||||
|
||||
/**
|
||||
* convert a MDB2 timestamp into an array containing all
|
||||
* values necessary to pass to php's date() function
|
||||
*
|
||||
* @param int a valid MDB2 timestamp
|
||||
*
|
||||
* @return array with the time split
|
||||
* @access public
|
||||
*/
|
||||
function mdbstamp2Date($mdb_timestamp)
|
||||
{
|
||||
list($arr['year'], $arr['month'], $arr['day'], $arr['hour'], $arr['minute'], $arr['second']) =
|
||||
sscanf($mdb_timestamp, "%04u-%02u-%02u %02u:%02u:%02u");
|
||||
return $arr;
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
/**
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Several methods to convert the MDB2 native timestamp format (ISO based)
|
||||
* to and from data structures that are convenient to worth with in side of php.
|
||||
* For more complex date arithmetic please take a look at the Date package in PEAR
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Date
|
||||
{
|
||||
// {{{ mdbNow()
|
||||
|
||||
/**
|
||||
* return the current datetime
|
||||
*
|
||||
* @return string current datetime in the MDB2 format
|
||||
* @access public
|
||||
*/
|
||||
function mdbNow()
|
||||
{
|
||||
return date('Y-m-d H:i:s');
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ mdbToday()
|
||||
|
||||
/**
|
||||
* return the current date
|
||||
*
|
||||
* @return string current date in the MDB2 format
|
||||
* @access public
|
||||
*/
|
||||
function mdbToday()
|
||||
{
|
||||
return date('Y-m-d');
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ mdbTime()
|
||||
|
||||
/**
|
||||
* return the current time
|
||||
*
|
||||
* @return string current time in the MDB2 format
|
||||
* @access public
|
||||
*/
|
||||
function mdbTime()
|
||||
{
|
||||
return date('H:i:s');
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ date2Mdbstamp()
|
||||
|
||||
/**
|
||||
* convert a date into a MDB2 timestamp
|
||||
*
|
||||
* @param int hour of the date
|
||||
* @param int minute of the date
|
||||
* @param int second of the date
|
||||
* @param int month of the date
|
||||
* @param int day of the date
|
||||
* @param int year of the date
|
||||
*
|
||||
* @return string a valid MDB2 timestamp
|
||||
* @access public
|
||||
*/
|
||||
function date2Mdbstamp($hour = null, $minute = null, $second = null,
|
||||
$month = null, $day = null, $year = null)
|
||||
{
|
||||
return MDB2_Date::unix2Mdbstamp(mktime($hour, $minute, $second, $month, $day, $year, -1));
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ unix2Mdbstamp()
|
||||
|
||||
/**
|
||||
* convert a unix timestamp into a MDB2 timestamp
|
||||
*
|
||||
* @param int a valid unix timestamp
|
||||
*
|
||||
* @return string a valid MDB2 timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unix2Mdbstamp($unix_timestamp)
|
||||
{
|
||||
return date('Y-m-d H:i:s', $unix_timestamp);
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ mdbstamp2Unix()
|
||||
|
||||
/**
|
||||
* convert a MDB2 timestamp into a unix timestamp
|
||||
*
|
||||
* @param int a valid MDB2 timestamp
|
||||
* @return string unix timestamp with the time stored in the MDB2 format
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function mdbstamp2Unix($mdb_timestamp)
|
||||
{
|
||||
$arr = MDB2_Date::mdbstamp2Date($mdb_timestamp);
|
||||
|
||||
return mktime($arr['hour'], $arr['minute'], $arr['second'], $arr['month'], $arr['day'], $arr['year'], -1);
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ mdbstamp2Date()
|
||||
|
||||
/**
|
||||
* convert a MDB2 timestamp into an array containing all
|
||||
* values necessary to pass to php's date() function
|
||||
*
|
||||
* @param int a valid MDB2 timestamp
|
||||
*
|
||||
* @return array with the time split
|
||||
* @access public
|
||||
*/
|
||||
function mdbstamp2Date($mdb_timestamp)
|
||||
{
|
||||
list($arr['year'], $arr['month'], $arr['day'], $arr['hour'], $arr['minute'], $arr['second']) =
|
||||
sscanf($mdb_timestamp, "%04u-%02u-%02u %02u:%02u:%02u");
|
||||
return $arr;
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
3683
3rdparty/MDB2/Driver/Datatype/Common.php
vendored
3683
3rdparty/MDB2/Driver/Datatype/Common.php
vendored
File diff suppressed because it is too large
Load diff
1162
3rdparty/MDB2/Driver/Datatype/mysql.php
vendored
1162
3rdparty/MDB2/Driver/Datatype/mysql.php
vendored
File diff suppressed because it is too large
Load diff
1152
3rdparty/MDB2/Driver/Datatype/pgsql.php
vendored
1152
3rdparty/MDB2/Driver/Datatype/pgsql.php
vendored
File diff suppressed because it is too large
Load diff
834
3rdparty/MDB2/Driver/Datatype/sqlite.php
vendored
834
3rdparty/MDB2/Driver/Datatype/sqlite.php
vendored
|
@ -1,418 +1,418 @@
|
|||
<?php
|
||||
// vim: set et ts=4 sw=4 fdm=marker:
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Datatype/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 SQLite driver
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
|
||||
{
|
||||
// {{{ _getCollationFieldDeclaration()
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the COLLATION
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
*
|
||||
* @param string $collation name of the collation
|
||||
*
|
||||
* @return string DBMS specific SQL code portion needed to set the COLLATION
|
||||
* of a field declaration.
|
||||
*/
|
||||
function _getCollationFieldDeclaration($collation)
|
||||
{
|
||||
return 'COLLATE '.$collation;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ getTypeDeclaration()
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to declare an text type
|
||||
* field to be used in statements like CREATE TABLE.
|
||||
*
|
||||
* @param array $field associative array with the name of the properties
|
||||
* of the field being declared as array indexes. Currently, the types
|
||||
* of supported field properties are as follows:
|
||||
*
|
||||
* length
|
||||
* Integer value that determines the maximum length of the text
|
||||
* field. If this argument is missing the field should be
|
||||
* declared to have the longest length allowed by the DBMS.
|
||||
*
|
||||
* default
|
||||
* Text value to be used as default for this field.
|
||||
*
|
||||
* notnull
|
||||
* Boolean flag that indicates whether this field is constrained
|
||||
* to not be set to null.
|
||||
* @return string DBMS specific SQL code portion that should be used to
|
||||
* declare the specified field.
|
||||
* @access public
|
||||
*/
|
||||
function getTypeDeclaration($field)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
switch ($field['type']) {
|
||||
case 'text':
|
||||
$length = !empty($field['length'])
|
||||
? $field['length'] : false;
|
||||
$fixed = !empty($field['fixed']) ? $field['fixed'] : false;
|
||||
return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$db->options['default_text_field_length'].')')
|
||||
: ($length ? 'VARCHAR('.$length.')' : 'TEXT');
|
||||
case 'clob':
|
||||
if (!empty($field['length'])) {
|
||||
$length = $field['length'];
|
||||
if ($length <= 255) {
|
||||
return 'TINYTEXT';
|
||||
} elseif ($length <= 65532) {
|
||||
return 'TEXT';
|
||||
} elseif ($length <= 16777215) {
|
||||
return 'MEDIUMTEXT';
|
||||
}
|
||||
}
|
||||
return 'LONGTEXT';
|
||||
case 'blob':
|
||||
if (!empty($field['length'])) {
|
||||
$length = $field['length'];
|
||||
if ($length <= 255) {
|
||||
return 'TINYBLOB';
|
||||
} elseif ($length <= 65532) {
|
||||
return 'BLOB';
|
||||
} elseif ($length <= 16777215) {
|
||||
return 'MEDIUMBLOB';
|
||||
}
|
||||
}
|
||||
return 'LONGBLOB';
|
||||
case 'integer':
|
||||
if (!empty($field['length'])) {
|
||||
$length = $field['length'];
|
||||
if ($length <= 2) {
|
||||
return 'SMALLINT';
|
||||
} elseif ($length == 3 || $length == 4) {
|
||||
return 'INTEGER';
|
||||
} elseif ($length > 4) {
|
||||
return 'BIGINT';
|
||||
}
|
||||
}
|
||||
return 'INTEGER';
|
||||
case 'boolean':
|
||||
return 'BOOLEAN';
|
||||
case 'date':
|
||||
return 'DATE';
|
||||
case 'time':
|
||||
return 'TIME';
|
||||
case 'timestamp':
|
||||
return 'DATETIME';
|
||||
case 'float':
|
||||
return 'DOUBLE'.($db->options['fixed_float'] ? '('.
|
||||
($db->options['fixed_float']+2).','.$db->options['fixed_float'].')' : '');
|
||||
case 'decimal':
|
||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||
$scale = !empty($field['scale']) ? $field['scale'] : $db->options['decimal_places'];
|
||||
return 'DECIMAL('.$length.','.$scale.')';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ _getIntegerDeclaration()
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to declare an integer type
|
||||
* field to be used in statements like CREATE TABLE.
|
||||
*
|
||||
* @param string $name name the field to be declared.
|
||||
* @param string $field associative array with the name of the properties
|
||||
* of the field being declared as array indexes.
|
||||
* Currently, the types of supported field
|
||||
* properties are as follows:
|
||||
*
|
||||
* unsigned
|
||||
* Boolean flag that indicates whether the field
|
||||
* should be declared as unsigned integer if
|
||||
* possible.
|
||||
*
|
||||
* default
|
||||
* Integer value to be used as default for this
|
||||
* field.
|
||||
*
|
||||
* notnull
|
||||
* Boolean flag that indicates whether this field is
|
||||
* constrained to not be set to null.
|
||||
* @return string DBMS specific SQL code portion that should be used to
|
||||
* declare the specified field.
|
||||
* @access protected
|
||||
*/
|
||||
function _getIntegerDeclaration($name, $field)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$default = $autoinc = '';
|
||||
if (!empty($field['autoincrement'])) {
|
||||
$autoinc = ' PRIMARY KEY';
|
||||
} elseif (array_key_exists('default', $field)) {
|
||||
if ($field['default'] === '') {
|
||||
$field['default'] = empty($field['notnull']) ? null : 0;
|
||||
}
|
||||
$default = ' DEFAULT '.$this->quote($field['default'], 'integer');
|
||||
}
|
||||
|
||||
$notnull = empty($field['notnull']) ? '' : ' NOT NULL';
|
||||
$unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
|
||||
if (empty($default) && empty($notnull)) {
|
||||
$default = ' DEFAULT NULL';
|
||||
}
|
||||
$name = $db->quoteIdentifier($name, true);
|
||||
return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ matchPattern()
|
||||
|
||||
/**
|
||||
* build a pattern matching string
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param array $pattern even keys are strings, odd are patterns (% and _)
|
||||
* @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future)
|
||||
* @param string $field optional field name that is being matched against
|
||||
* (might be required when emulating ILIKE)
|
||||
*
|
||||
* @return string SQL pattern
|
||||
*/
|
||||
function matchPattern($pattern, $operator = null, $field = null)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$match = '';
|
||||
if (null !== $operator) {
|
||||
$field = (null === $field) ? '' : $field.' ';
|
||||
$operator = strtoupper($operator);
|
||||
switch ($operator) {
|
||||
// case insensitive
|
||||
case 'ILIKE':
|
||||
$match = $field.'LIKE ';
|
||||
break;
|
||||
case 'NOT ILIKE':
|
||||
$match = $field.'NOT LIKE ';
|
||||
break;
|
||||
// case sensitive
|
||||
case 'LIKE':
|
||||
$match = $field.'LIKE ';
|
||||
break;
|
||||
case 'NOT LIKE':
|
||||
$match = $field.'NOT LIKE ';
|
||||
break;
|
||||
default:
|
||||
return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'not a supported operator type:'. $operator, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
$match.= "'";
|
||||
foreach ($pattern as $key => $value) {
|
||||
if ($key % 2) {
|
||||
$match.= $value;
|
||||
} else {
|
||||
$match.= $db->escapePattern($db->escape($value));
|
||||
}
|
||||
}
|
||||
$match.= "'";
|
||||
$match.= $this->patternEscapeString();
|
||||
return $match;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ _mapNativeDatatype()
|
||||
|
||||
/**
|
||||
* Maps a native array description of a field to a MDB2 datatype and length
|
||||
*
|
||||
* @param array $field native field description
|
||||
* @return array containing the various possible types, length, sign, fixed
|
||||
* @access public
|
||||
*/
|
||||
function _mapNativeDatatype($field)
|
||||
{
|
||||
$db_type = strtolower($field['type']);
|
||||
$length = !empty($field['length']) ? $field['length'] : null;
|
||||
$unsigned = !empty($field['unsigned']) ? $field['unsigned'] : null;
|
||||
$fixed = null;
|
||||
$type = array();
|
||||
switch ($db_type) {
|
||||
case 'boolean':
|
||||
$type[] = 'boolean';
|
||||
break;
|
||||
case 'tinyint':
|
||||
$type[] = 'integer';
|
||||
$type[] = 'boolean';
|
||||
if (preg_match('/^(is|has)/', $field['name'])) {
|
||||
$type = array_reverse($type);
|
||||
}
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 1;
|
||||
break;
|
||||
case 'smallint':
|
||||
$type[] = 'integer';
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 2;
|
||||
break;
|
||||
case 'mediumint':
|
||||
$type[] = 'integer';
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 3;
|
||||
break;
|
||||
case 'int':
|
||||
case 'integer':
|
||||
case 'serial':
|
||||
$type[] = 'integer';
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 4;
|
||||
break;
|
||||
case 'bigint':
|
||||
case 'bigserial':
|
||||
$type[] = 'integer';
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 8;
|
||||
break;
|
||||
case 'clob':
|
||||
$type[] = 'clob';
|
||||
$fixed = false;
|
||||
break;
|
||||
case 'tinytext':
|
||||
case 'mediumtext':
|
||||
case 'longtext':
|
||||
case 'text':
|
||||
case 'varchar':
|
||||
case 'varchar2':
|
||||
$fixed = false;
|
||||
case 'char':
|
||||
$type[] = 'text';
|
||||
if ($length == '1') {
|
||||
$type[] = 'boolean';
|
||||
if (preg_match('/^(is|has)/', $field['name'])) {
|
||||
$type = array_reverse($type);
|
||||
}
|
||||
} elseif (strstr($db_type, 'text')) {
|
||||
$type[] = 'clob';
|
||||
$type = array_reverse($type);
|
||||
}
|
||||
if ($fixed !== false) {
|
||||
$fixed = true;
|
||||
}
|
||||
break;
|
||||
case 'date':
|
||||
$type[] = 'date';
|
||||
$length = null;
|
||||
break;
|
||||
case 'datetime':
|
||||
case 'timestamp':
|
||||
$type[] = 'timestamp';
|
||||
$length = null;
|
||||
break;
|
||||
case 'time':
|
||||
$type[] = 'time';
|
||||
$length = null;
|
||||
break;
|
||||
case 'float':
|
||||
case 'double':
|
||||
case 'real':
|
||||
$type[] = 'float';
|
||||
break;
|
||||
case 'decimal':
|
||||
case 'numeric':
|
||||
$type[] = 'decimal';
|
||||
$length = $length.','.$field['decimal'];
|
||||
break;
|
||||
case 'tinyblob':
|
||||
case 'mediumblob':
|
||||
case 'longblob':
|
||||
case 'blob':
|
||||
$type[] = 'blob';
|
||||
$length = null;
|
||||
break;
|
||||
case 'year':
|
||||
$type[] = 'integer';
|
||||
$type[] = 'date';
|
||||
$length = null;
|
||||
break;
|
||||
default:
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'unknown database attribute type: '.$db_type, __FUNCTION__);
|
||||
}
|
||||
|
||||
if ((int)$length <= 0) {
|
||||
$length = null;
|
||||
}
|
||||
|
||||
return array($type, $length, $unsigned, $fixed);
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
|
||||
<?php
|
||||
// vim: set et ts=4 sw=4 fdm=marker:
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Datatype/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 SQLite driver
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
|
||||
{
|
||||
// {{{ _getCollationFieldDeclaration()
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the COLLATION
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
*
|
||||
* @param string $collation name of the collation
|
||||
*
|
||||
* @return string DBMS specific SQL code portion needed to set the COLLATION
|
||||
* of a field declaration.
|
||||
*/
|
||||
function _getCollationFieldDeclaration($collation)
|
||||
{
|
||||
return 'COLLATE '.$collation;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ getTypeDeclaration()
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to declare an text type
|
||||
* field to be used in statements like CREATE TABLE.
|
||||
*
|
||||
* @param array $field associative array with the name of the properties
|
||||
* of the field being declared as array indexes. Currently, the types
|
||||
* of supported field properties are as follows:
|
||||
*
|
||||
* length
|
||||
* Integer value that determines the maximum length of the text
|
||||
* field. If this argument is missing the field should be
|
||||
* declared to have the longest length allowed by the DBMS.
|
||||
*
|
||||
* default
|
||||
* Text value to be used as default for this field.
|
||||
*
|
||||
* notnull
|
||||
* Boolean flag that indicates whether this field is constrained
|
||||
* to not be set to null.
|
||||
* @return string DBMS specific SQL code portion that should be used to
|
||||
* declare the specified field.
|
||||
* @access public
|
||||
*/
|
||||
function getTypeDeclaration($field)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
switch ($field['type']) {
|
||||
case 'text':
|
||||
$length = !empty($field['length'])
|
||||
? $field['length'] : false;
|
||||
$fixed = !empty($field['fixed']) ? $field['fixed'] : false;
|
||||
return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$db->options['default_text_field_length'].')')
|
||||
: ($length ? 'VARCHAR('.$length.')' : 'TEXT');
|
||||
case 'clob':
|
||||
if (!empty($field['length'])) {
|
||||
$length = $field['length'];
|
||||
if ($length <= 255) {
|
||||
return 'TINYTEXT';
|
||||
} elseif ($length <= 65532) {
|
||||
return 'TEXT';
|
||||
} elseif ($length <= 16777215) {
|
||||
return 'MEDIUMTEXT';
|
||||
}
|
||||
}
|
||||
return 'LONGTEXT';
|
||||
case 'blob':
|
||||
if (!empty($field['length'])) {
|
||||
$length = $field['length'];
|
||||
if ($length <= 255) {
|
||||
return 'TINYBLOB';
|
||||
} elseif ($length <= 65532) {
|
||||
return 'BLOB';
|
||||
} elseif ($length <= 16777215) {
|
||||
return 'MEDIUMBLOB';
|
||||
}
|
||||
}
|
||||
return 'LONGBLOB';
|
||||
case 'integer':
|
||||
if (!empty($field['length'])) {
|
||||
$length = $field['length'];
|
||||
if ($length <= 2) {
|
||||
return 'SMALLINT';
|
||||
} elseif ($length == 3 || $length == 4) {
|
||||
return 'INTEGER';
|
||||
} elseif ($length > 4) {
|
||||
return 'BIGINT';
|
||||
}
|
||||
}
|
||||
return 'INTEGER';
|
||||
case 'boolean':
|
||||
return 'BOOLEAN';
|
||||
case 'date':
|
||||
return 'DATE';
|
||||
case 'time':
|
||||
return 'TIME';
|
||||
case 'timestamp':
|
||||
return 'DATETIME';
|
||||
case 'float':
|
||||
return 'DOUBLE'.($db->options['fixed_float'] ? '('.
|
||||
($db->options['fixed_float']+2).','.$db->options['fixed_float'].')' : '');
|
||||
case 'decimal':
|
||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||
$scale = !empty($field['scale']) ? $field['scale'] : $db->options['decimal_places'];
|
||||
return 'DECIMAL('.$length.','.$scale.')';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ _getIntegerDeclaration()
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to declare an integer type
|
||||
* field to be used in statements like CREATE TABLE.
|
||||
*
|
||||
* @param string $name name the field to be declared.
|
||||
* @param string $field associative array with the name of the properties
|
||||
* of the field being declared as array indexes.
|
||||
* Currently, the types of supported field
|
||||
* properties are as follows:
|
||||
*
|
||||
* unsigned
|
||||
* Boolean flag that indicates whether the field
|
||||
* should be declared as unsigned integer if
|
||||
* possible.
|
||||
*
|
||||
* default
|
||||
* Integer value to be used as default for this
|
||||
* field.
|
||||
*
|
||||
* notnull
|
||||
* Boolean flag that indicates whether this field is
|
||||
* constrained to not be set to null.
|
||||
* @return string DBMS specific SQL code portion that should be used to
|
||||
* declare the specified field.
|
||||
* @access protected
|
||||
*/
|
||||
function _getIntegerDeclaration($name, $field)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$default = $autoinc = '';
|
||||
if (!empty($field['autoincrement'])) {
|
||||
$autoinc = ' PRIMARY KEY';
|
||||
} elseif (array_key_exists('default', $field)) {
|
||||
if ($field['default'] === '') {
|
||||
$field['default'] = empty($field['notnull']) ? null : 0;
|
||||
}
|
||||
$default = ' DEFAULT '.$this->quote($field['default'], 'integer');
|
||||
}
|
||||
|
||||
$notnull = empty($field['notnull']) ? '' : ' NOT NULL';
|
||||
$unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
|
||||
if (empty($default) && empty($notnull)) {
|
||||
$default = ' DEFAULT NULL';
|
||||
}
|
||||
$name = $db->quoteIdentifier($name, true);
|
||||
return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ matchPattern()
|
||||
|
||||
/**
|
||||
* build a pattern matching string
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param array $pattern even keys are strings, odd are patterns (% and _)
|
||||
* @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future)
|
||||
* @param string $field optional field name that is being matched against
|
||||
* (might be required when emulating ILIKE)
|
||||
*
|
||||
* @return string SQL pattern
|
||||
*/
|
||||
function matchPattern($pattern, $operator = null, $field = null)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$match = '';
|
||||
if (null !== $operator) {
|
||||
$field = (null === $field) ? '' : $field.' ';
|
||||
$operator = strtoupper($operator);
|
||||
switch ($operator) {
|
||||
// case insensitive
|
||||
case 'ILIKE':
|
||||
$match = $field.'LIKE ';
|
||||
break;
|
||||
case 'NOT ILIKE':
|
||||
$match = $field.'NOT LIKE ';
|
||||
break;
|
||||
// case sensitive
|
||||
case 'LIKE':
|
||||
$match = $field.'LIKE ';
|
||||
break;
|
||||
case 'NOT LIKE':
|
||||
$match = $field.'NOT LIKE ';
|
||||
break;
|
||||
default:
|
||||
return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'not a supported operator type:'. $operator, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
$match.= "'";
|
||||
foreach ($pattern as $key => $value) {
|
||||
if ($key % 2) {
|
||||
$match.= $value;
|
||||
} else {
|
||||
$match.= $db->escapePattern($db->escape($value));
|
||||
}
|
||||
}
|
||||
$match.= "'";
|
||||
$match.= $this->patternEscapeString();
|
||||
return $match;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ _mapNativeDatatype()
|
||||
|
||||
/**
|
||||
* Maps a native array description of a field to a MDB2 datatype and length
|
||||
*
|
||||
* @param array $field native field description
|
||||
* @return array containing the various possible types, length, sign, fixed
|
||||
* @access public
|
||||
*/
|
||||
function _mapNativeDatatype($field)
|
||||
{
|
||||
$db_type = strtolower($field['type']);
|
||||
$length = !empty($field['length']) ? $field['length'] : null;
|
||||
$unsigned = !empty($field['unsigned']) ? $field['unsigned'] : null;
|
||||
$fixed = null;
|
||||
$type = array();
|
||||
switch ($db_type) {
|
||||
case 'boolean':
|
||||
$type[] = 'boolean';
|
||||
break;
|
||||
case 'tinyint':
|
||||
$type[] = 'integer';
|
||||
$type[] = 'boolean';
|
||||
if (preg_match('/^(is|has)/', $field['name'])) {
|
||||
$type = array_reverse($type);
|
||||
}
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 1;
|
||||
break;
|
||||
case 'smallint':
|
||||
$type[] = 'integer';
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 2;
|
||||
break;
|
||||
case 'mediumint':
|
||||
$type[] = 'integer';
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 3;
|
||||
break;
|
||||
case 'int':
|
||||
case 'integer':
|
||||
case 'serial':
|
||||
$type[] = 'integer';
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 4;
|
||||
break;
|
||||
case 'bigint':
|
||||
case 'bigserial':
|
||||
$type[] = 'integer';
|
||||
$unsigned = preg_match('/ unsigned/i', $field['type']);
|
||||
$length = 8;
|
||||
break;
|
||||
case 'clob':
|
||||
$type[] = 'clob';
|
||||
$fixed = false;
|
||||
break;
|
||||
case 'tinytext':
|
||||
case 'mediumtext':
|
||||
case 'longtext':
|
||||
case 'text':
|
||||
case 'varchar':
|
||||
case 'varchar2':
|
||||
$fixed = false;
|
||||
case 'char':
|
||||
$type[] = 'text';
|
||||
if ($length == '1') {
|
||||
$type[] = 'boolean';
|
||||
if (preg_match('/^(is|has)/', $field['name'])) {
|
||||
$type = array_reverse($type);
|
||||
}
|
||||
} elseif (strstr($db_type, 'text')) {
|
||||
$type[] = 'clob';
|
||||
$type = array_reverse($type);
|
||||
}
|
||||
if ($fixed !== false) {
|
||||
$fixed = true;
|
||||
}
|
||||
break;
|
||||
case 'date':
|
||||
$type[] = 'date';
|
||||
$length = null;
|
||||
break;
|
||||
case 'datetime':
|
||||
case 'timestamp':
|
||||
$type[] = 'timestamp';
|
||||
$length = null;
|
||||
break;
|
||||
case 'time':
|
||||
$type[] = 'time';
|
||||
$length = null;
|
||||
break;
|
||||
case 'float':
|
||||
case 'double':
|
||||
case 'real':
|
||||
$type[] = 'float';
|
||||
break;
|
||||
case 'decimal':
|
||||
case 'numeric':
|
||||
$type[] = 'decimal';
|
||||
$length = $length.','.$field['decimal'];
|
||||
break;
|
||||
case 'tinyblob':
|
||||
case 'mediumblob':
|
||||
case 'longblob':
|
||||
case 'blob':
|
||||
$type[] = 'blob';
|
||||
$length = null;
|
||||
break;
|
||||
case 'year':
|
||||
$type[] = 'integer';
|
||||
$type[] = 'date';
|
||||
$length = null;
|
||||
break;
|
||||
default:
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'unknown database attribute type: '.$db_type, __FUNCTION__);
|
||||
}
|
||||
|
||||
if ((int)$length <= 0) {
|
||||
$length = null;
|
||||
}
|
||||
|
||||
return array($type, $length, $unsigned, $fixed);
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
|
||||
?>
|
584
3rdparty/MDB2/Driver/Function/Common.php
vendored
584
3rdparty/MDB2/Driver/Function/Common.php
vendored
|
@ -1,293 +1,293 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Common.php 295587 2010-02-28 17:16:38Z quipo $
|
||||
//
|
||||
|
||||
/**
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for the function modules that is extended by each MDB2 driver
|
||||
*
|
||||
* To load this module in the MDB2 object:
|
||||
* $mdb->loadModule('Function');
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Function_Common extends MDB2_Module_Common
|
||||
{
|
||||
// {{{ executeStoredProc()
|
||||
|
||||
/**
|
||||
* Execute a stored procedure and return any results
|
||||
*
|
||||
* @param string $name string that identifies the function to execute
|
||||
* @param mixed $params array that contains the paramaters to pass the stored proc
|
||||
* @param mixed $types array that contains the types of the columns in
|
||||
* the result set
|
||||
* @param mixed $result_class string which specifies which result class to use
|
||||
* @param mixed $result_wrap_class string which specifies which class to wrap results in
|
||||
*
|
||||
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
|
||||
* @access public
|
||||
*/
|
||||
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'method not implemented', __FUNCTION__);
|
||||
return $error;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ functionTable()
|
||||
|
||||
/**
|
||||
* return string for internal table used when calling only a function
|
||||
*
|
||||
* @return string for internal table used when calling only a function
|
||||
* @access public
|
||||
*/
|
||||
function functionTable()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ now()
|
||||
|
||||
/**
|
||||
* Return string to call a variable with the current timestamp inside an SQL statement
|
||||
* There are three special variables for current date and time:
|
||||
* - CURRENT_TIMESTAMP (date and time, TIMESTAMP type)
|
||||
* - CURRENT_DATE (date, DATE type)
|
||||
* - CURRENT_TIME (time, TIME type)
|
||||
*
|
||||
* @param string $type 'timestamp' | 'time' | 'date'
|
||||
*
|
||||
* @return string to call a variable with the current timestamp
|
||||
* @access public
|
||||
*/
|
||||
function now($type = 'timestamp')
|
||||
{
|
||||
switch ($type) {
|
||||
case 'time':
|
||||
return 'CURRENT_TIME';
|
||||
case 'date':
|
||||
return 'CURRENT_DATE';
|
||||
case 'timestamp':
|
||||
default:
|
||||
return 'CURRENT_TIMESTAMP';
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ unixtimestamp()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the unix timestamp from a iso timestamp
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return string to call a variable with the timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unixtimestamp($expression)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'method not implemented', __FUNCTION__);
|
||||
return $error;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ substring()
|
||||
|
||||
/**
|
||||
* return string to call a function to get a substring inside an SQL statement
|
||||
*
|
||||
* @return string to call a function to get a substring
|
||||
* @access public
|
||||
*/
|
||||
function substring($value, $position = 1, $length = null)
|
||||
{
|
||||
if (null !== $length) {
|
||||
return "SUBSTRING($value FROM $position FOR $length)";
|
||||
}
|
||||
return "SUBSTRING($value FROM $position)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ replace()
|
||||
|
||||
/**
|
||||
* return string to call a function to get replace inside an SQL statement.
|
||||
*
|
||||
* @return string to call a function to get a replace
|
||||
* @access public
|
||||
*/
|
||||
function replace($str, $from_str, $to_str)
|
||||
{
|
||||
return "REPLACE($str, $from_str , $to_str)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ concat()
|
||||
|
||||
/**
|
||||
* Returns string to concatenate two or more string parameters
|
||||
*
|
||||
* @param string $value1
|
||||
* @param string $value2
|
||||
* @param string $values...
|
||||
*
|
||||
* @return string to concatenate two strings
|
||||
* @access public
|
||||
*/
|
||||
function concat($value1, $value2)
|
||||
{
|
||||
$args = func_get_args();
|
||||
return "(".implode(' || ', $args).")";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ random()
|
||||
|
||||
/**
|
||||
* return string to call a function to get random value inside an SQL statement
|
||||
*
|
||||
* @return return string to generate float between 0 and 1
|
||||
* @access public
|
||||
*/
|
||||
function random()
|
||||
{
|
||||
return 'RAND()';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ lower()
|
||||
|
||||
/**
|
||||
* return string to call a function to lower the case of an expression
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return return string to lower case of an expression
|
||||
* @access public
|
||||
*/
|
||||
function lower($expression)
|
||||
{
|
||||
return "LOWER($expression)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ upper()
|
||||
|
||||
/**
|
||||
* return string to call a function to upper the case of an expression
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return return string to upper case of an expression
|
||||
* @access public
|
||||
*/
|
||||
function upper($expression)
|
||||
{
|
||||
return "UPPER($expression)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ length()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the length of a string expression
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return return string to get the string expression length
|
||||
* @access public
|
||||
*/
|
||||
function length($expression)
|
||||
{
|
||||
return "LENGTH($expression)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ guid()
|
||||
|
||||
/**
|
||||
* Returns global unique identifier
|
||||
*
|
||||
* @return string to get global unique identifier
|
||||
* @access public
|
||||
*/
|
||||
function guid()
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'method not implemented', __FUNCTION__);
|
||||
return $error;
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
/**
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for the function modules that is extended by each MDB2 driver
|
||||
*
|
||||
* To load this module in the MDB2 object:
|
||||
* $mdb->loadModule('Function');
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Function_Common extends MDB2_Module_Common
|
||||
{
|
||||
// {{{ executeStoredProc()
|
||||
|
||||
/**
|
||||
* Execute a stored procedure and return any results
|
||||
*
|
||||
* @param string $name string that identifies the function to execute
|
||||
* @param mixed $params array that contains the paramaters to pass the stored proc
|
||||
* @param mixed $types array that contains the types of the columns in
|
||||
* the result set
|
||||
* @param mixed $result_class string which specifies which result class to use
|
||||
* @param mixed $result_wrap_class string which specifies which class to wrap results in
|
||||
*
|
||||
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
|
||||
* @access public
|
||||
*/
|
||||
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'method not implemented', __FUNCTION__);
|
||||
return $error;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ functionTable()
|
||||
|
||||
/**
|
||||
* return string for internal table used when calling only a function
|
||||
*
|
||||
* @return string for internal table used when calling only a function
|
||||
* @access public
|
||||
*/
|
||||
function functionTable()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ now()
|
||||
|
||||
/**
|
||||
* Return string to call a variable with the current timestamp inside an SQL statement
|
||||
* There are three special variables for current date and time:
|
||||
* - CURRENT_TIMESTAMP (date and time, TIMESTAMP type)
|
||||
* - CURRENT_DATE (date, DATE type)
|
||||
* - CURRENT_TIME (time, TIME type)
|
||||
*
|
||||
* @param string $type 'timestamp' | 'time' | 'date'
|
||||
*
|
||||
* @return string to call a variable with the current timestamp
|
||||
* @access public
|
||||
*/
|
||||
function now($type = 'timestamp')
|
||||
{
|
||||
switch ($type) {
|
||||
case 'time':
|
||||
return 'CURRENT_TIME';
|
||||
case 'date':
|
||||
return 'CURRENT_DATE';
|
||||
case 'timestamp':
|
||||
default:
|
||||
return 'CURRENT_TIMESTAMP';
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ unixtimestamp()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the unix timestamp from a iso timestamp
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return string to call a variable with the timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unixtimestamp($expression)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'method not implemented', __FUNCTION__);
|
||||
return $error;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ substring()
|
||||
|
||||
/**
|
||||
* return string to call a function to get a substring inside an SQL statement
|
||||
*
|
||||
* @return string to call a function to get a substring
|
||||
* @access public
|
||||
*/
|
||||
function substring($value, $position = 1, $length = null)
|
||||
{
|
||||
if (null !== $length) {
|
||||
return "SUBSTRING($value FROM $position FOR $length)";
|
||||
}
|
||||
return "SUBSTRING($value FROM $position)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ replace()
|
||||
|
||||
/**
|
||||
* return string to call a function to get replace inside an SQL statement.
|
||||
*
|
||||
* @return string to call a function to get a replace
|
||||
* @access public
|
||||
*/
|
||||
function replace($str, $from_str, $to_str)
|
||||
{
|
||||
return "REPLACE($str, $from_str , $to_str)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ concat()
|
||||
|
||||
/**
|
||||
* Returns string to concatenate two or more string parameters
|
||||
*
|
||||
* @param string $value1
|
||||
* @param string $value2
|
||||
* @param string $values...
|
||||
*
|
||||
* @return string to concatenate two strings
|
||||
* @access public
|
||||
*/
|
||||
function concat($value1, $value2)
|
||||
{
|
||||
$args = func_get_args();
|
||||
return "(".implode(' || ', $args).")";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ random()
|
||||
|
||||
/**
|
||||
* return string to call a function to get random value inside an SQL statement
|
||||
*
|
||||
* @return return string to generate float between 0 and 1
|
||||
* @access public
|
||||
*/
|
||||
function random()
|
||||
{
|
||||
return 'RAND()';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ lower()
|
||||
|
||||
/**
|
||||
* return string to call a function to lower the case of an expression
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return return string to lower case of an expression
|
||||
* @access public
|
||||
*/
|
||||
function lower($expression)
|
||||
{
|
||||
return "LOWER($expression)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ upper()
|
||||
|
||||
/**
|
||||
* return string to call a function to upper the case of an expression
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return return string to upper case of an expression
|
||||
* @access public
|
||||
*/
|
||||
function upper($expression)
|
||||
{
|
||||
return "UPPER($expression)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ length()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the length of a string expression
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return return string to get the string expression length
|
||||
* @access public
|
||||
*/
|
||||
function length($expression)
|
||||
{
|
||||
return "LENGTH($expression)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ guid()
|
||||
|
||||
/**
|
||||
* Returns global unique identifier
|
||||
*
|
||||
* @return string to get global unique identifier
|
||||
* @access public
|
||||
*/
|
||||
function guid()
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'method not implemented', __FUNCTION__);
|
||||
return $error;
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
?>
|
270
3rdparty/MDB2/Driver/Function/mysql.php
vendored
270
3rdparty/MDB2/Driver/Function/mysql.php
vendored
|
@ -1,136 +1,136 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Function/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 MySQL driver for the function modules
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Function_mysql extends MDB2_Driver_Function_Common
|
||||
{
|
||||
// }}}
|
||||
// {{{ executeStoredProc()
|
||||
|
||||
/**
|
||||
* Execute a stored procedure and return any results
|
||||
*
|
||||
* @param string $name string that identifies the function to execute
|
||||
* @param mixed $params array that contains the paramaters to pass the stored proc
|
||||
* @param mixed $types array that contains the types of the columns in
|
||||
* the result set
|
||||
* @param mixed $result_class string which specifies which result class to use
|
||||
* @param mixed $result_wrap_class string which specifies which class to wrap results in
|
||||
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
|
||||
* @access public
|
||||
*/
|
||||
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$query = 'CALL '.$name;
|
||||
$query .= $params ? '('.implode(', ', $params).')' : '()';
|
||||
return $db->query($query, $types, $result_class, $result_wrap_class);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ unixtimestamp()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the unix timestamp from a iso timestamp
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return string to call a variable with the timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unixtimestamp($expression)
|
||||
{
|
||||
return 'UNIX_TIMESTAMP('. $expression.')';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ concat()
|
||||
|
||||
/**
|
||||
* Returns string to concatenate two or more string parameters
|
||||
*
|
||||
* @param string $value1
|
||||
* @param string $value2
|
||||
* @param string $values...
|
||||
* @return string to concatenate two strings
|
||||
* @access public
|
||||
**/
|
||||
function concat($value1, $value2)
|
||||
{
|
||||
$args = func_get_args();
|
||||
return "CONCAT(".implode(', ', $args).")";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ guid()
|
||||
|
||||
/**
|
||||
* Returns global unique identifier
|
||||
*
|
||||
* @return string to get global unique identifier
|
||||
* @access public
|
||||
*/
|
||||
function guid()
|
||||
{
|
||||
return 'UUID()';
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Function/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 MySQL driver for the function modules
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Function_mysql extends MDB2_Driver_Function_Common
|
||||
{
|
||||
// }}}
|
||||
// {{{ executeStoredProc()
|
||||
|
||||
/**
|
||||
* Execute a stored procedure and return any results
|
||||
*
|
||||
* @param string $name string that identifies the function to execute
|
||||
* @param mixed $params array that contains the paramaters to pass the stored proc
|
||||
* @param mixed $types array that contains the types of the columns in
|
||||
* the result set
|
||||
* @param mixed $result_class string which specifies which result class to use
|
||||
* @param mixed $result_wrap_class string which specifies which class to wrap results in
|
||||
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
|
||||
* @access public
|
||||
*/
|
||||
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$query = 'CALL '.$name;
|
||||
$query .= $params ? '('.implode(', ', $params).')' : '()';
|
||||
return $db->query($query, $types, $result_class, $result_wrap_class);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ unixtimestamp()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the unix timestamp from a iso timestamp
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return string to call a variable with the timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unixtimestamp($expression)
|
||||
{
|
||||
return 'UNIX_TIMESTAMP('. $expression.')';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ concat()
|
||||
|
||||
/**
|
||||
* Returns string to concatenate two or more string parameters
|
||||
*
|
||||
* @param string $value1
|
||||
* @param string $value2
|
||||
* @param string $values...
|
||||
* @return string to concatenate two strings
|
||||
* @access public
|
||||
**/
|
||||
function concat($value1, $value2)
|
||||
{
|
||||
$args = func_get_args();
|
||||
return "CONCAT(".implode(', ', $args).")";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ guid()
|
||||
|
||||
/**
|
||||
* Returns global unique identifier
|
||||
*
|
||||
* @return string to get global unique identifier
|
||||
* @access public
|
||||
*/
|
||||
function guid()
|
||||
{
|
||||
return 'UUID()';
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
?>
|
262
3rdparty/MDB2/Driver/Function/pgsql.php
vendored
262
3rdparty/MDB2/Driver/Function/pgsql.php
vendored
|
@ -1,132 +1,132 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Paul Cooper <pgc@ucecom.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: pgsql.php 296139 2010-03-13 04:15:22Z afz $
|
||||
|
||||
require_once 'MDB2/Driver/Function/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 MySQL driver for the function modules
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Function_pgsql extends MDB2_Driver_Function_Common
|
||||
{
|
||||
// {{{ executeStoredProc()
|
||||
|
||||
/**
|
||||
* Execute a stored procedure and return any results
|
||||
*
|
||||
* @param string $name string that identifies the function to execute
|
||||
* @param mixed $params array that contains the paramaters to pass the stored proc
|
||||
* @param mixed $types array that contains the types of the columns in
|
||||
* the result set
|
||||
* @param mixed $result_class string which specifies which result class to use
|
||||
* @param mixed $result_wrap_class string which specifies which class to wrap results in
|
||||
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
|
||||
* @access public
|
||||
*/
|
||||
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$query = 'SELECT * FROM '.$name;
|
||||
$query .= $params ? '('.implode(', ', $params).')' : '()';
|
||||
return $db->query($query, $types, $result_class, $result_wrap_class);
|
||||
}
|
||||
// }}}
|
||||
// {{{ unixtimestamp()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the unix timestamp from a iso timestamp
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return string to call a variable with the timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unixtimestamp($expression)
|
||||
{
|
||||
return 'EXTRACT(EPOCH FROM DATE_TRUNC(\'seconds\', CAST ((' . $expression . ') AS TIMESTAMP)))';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ substring()
|
||||
|
||||
/**
|
||||
* return string to call a function to get a substring inside an SQL statement
|
||||
*
|
||||
* @return string to call a function to get a substring
|
||||
* @access public
|
||||
*/
|
||||
function substring($value, $position = 1, $length = null)
|
||||
{
|
||||
if (null !== $length) {
|
||||
return "SUBSTRING(CAST($value AS VARCHAR) FROM $position FOR $length)";
|
||||
}
|
||||
return "SUBSTRING(CAST($value AS VARCHAR) FROM $position)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ random()
|
||||
|
||||
/**
|
||||
* return string to call a function to get random value inside an SQL statement
|
||||
*
|
||||
* @return return string to generate float between 0 and 1
|
||||
* @access public
|
||||
*/
|
||||
function random()
|
||||
{
|
||||
return 'RANDOM()';
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Paul Cooper <pgc@ucecom.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
|
||||
require_once 'MDB2/Driver/Function/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 MySQL driver for the function modules
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Function_pgsql extends MDB2_Driver_Function_Common
|
||||
{
|
||||
// {{{ executeStoredProc()
|
||||
|
||||
/**
|
||||
* Execute a stored procedure and return any results
|
||||
*
|
||||
* @param string $name string that identifies the function to execute
|
||||
* @param mixed $params array that contains the paramaters to pass the stored proc
|
||||
* @param mixed $types array that contains the types of the columns in
|
||||
* the result set
|
||||
* @param mixed $result_class string which specifies which result class to use
|
||||
* @param mixed $result_wrap_class string which specifies which class to wrap results in
|
||||
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
|
||||
* @access public
|
||||
*/
|
||||
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$query = 'SELECT * FROM '.$name;
|
||||
$query .= $params ? '('.implode(', ', $params).')' : '()';
|
||||
return $db->query($query, $types, $result_class, $result_wrap_class);
|
||||
}
|
||||
// }}}
|
||||
// {{{ unixtimestamp()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the unix timestamp from a iso timestamp
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return string to call a variable with the timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unixtimestamp($expression)
|
||||
{
|
||||
return 'EXTRACT(EPOCH FROM DATE_TRUNC(\'seconds\', CAST ((' . $expression . ') AS TIMESTAMP)))';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ substring()
|
||||
|
||||
/**
|
||||
* return string to call a function to get a substring inside an SQL statement
|
||||
*
|
||||
* @return string to call a function to get a substring
|
||||
* @access public
|
||||
*/
|
||||
function substring($value, $position = 1, $length = null)
|
||||
{
|
||||
if (null !== $length) {
|
||||
return "SUBSTRING(CAST($value AS VARCHAR) FROM $position FOR $length)";
|
||||
}
|
||||
return "SUBSTRING(CAST($value AS VARCHAR) FROM $position)";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ random()
|
||||
|
||||
/**
|
||||
* return string to call a function to get random value inside an SQL statement
|
||||
*
|
||||
* @return return string to generate float between 0 and 1
|
||||
* @access public
|
||||
*/
|
||||
function random()
|
||||
{
|
||||
return 'RANDOM()';
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
?>
|
324
3rdparty/MDB2/Driver/Function/sqlite.php
vendored
324
3rdparty/MDB2/Driver/Function/sqlite.php
vendored
|
@ -1,162 +1,162 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Function/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 SQLite driver for the function modules
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Function_sqlite extends MDB2_Driver_Function_Common
|
||||
{
|
||||
// {{{ constructor
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct($db_index)
|
||||
{
|
||||
parent::__construct($db_index);
|
||||
// create all sorts of UDFs
|
||||
}
|
||||
|
||||
// {{{ now()
|
||||
|
||||
/**
|
||||
* Return string to call a variable with the current timestamp inside an SQL statement
|
||||
* There are three special variables for current date and time.
|
||||
*
|
||||
* @return string to call a variable with the current timestamp
|
||||
* @access public
|
||||
*/
|
||||
function now($type = 'timestamp')
|
||||
{
|
||||
switch ($type) {
|
||||
case 'time':
|
||||
return 'time(\'now\')';
|
||||
case 'date':
|
||||
return 'date(\'now\')';
|
||||
case 'timestamp':
|
||||
default:
|
||||
return 'datetime(\'now\')';
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ unixtimestamp()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the unix timestamp from a iso timestamp
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return string to call a variable with the timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unixtimestamp($expression)
|
||||
{
|
||||
return 'strftime("%s",'. $expression.', "utc")';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ substring()
|
||||
|
||||
/**
|
||||
* return string to call a function to get a substring inside an SQL statement
|
||||
*
|
||||
* @return string to call a function to get a substring
|
||||
* @access public
|
||||
*/
|
||||
function substring($value, $position = 1, $length = null)
|
||||
{
|
||||
if (null !== $length) {
|
||||
return "substr($value, $position, $length)";
|
||||
}
|
||||
return "substr($value, $position, length($value))";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ random()
|
||||
|
||||
/**
|
||||
* return string to call a function to get random value inside an SQL statement
|
||||
*
|
||||
* @return return string to generate float between 0 and 1
|
||||
* @access public
|
||||
*/
|
||||
function random()
|
||||
{
|
||||
return '((RANDOM()+2147483648)/4294967296)';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ replace()
|
||||
|
||||
/**
|
||||
* return string to call a function to get a replacement inside an SQL statement.
|
||||
*
|
||||
* @return string to call a function to get a replace
|
||||
* @access public
|
||||
*/
|
||||
function replace($str, $from_str, $to_str)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'method not implemented', __FUNCTION__);
|
||||
return $error;
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Function/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 SQLite driver for the function modules
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Function_sqlite extends MDB2_Driver_Function_Common
|
||||
{
|
||||
// {{{ constructor
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct($db_index)
|
||||
{
|
||||
parent::__construct($db_index);
|
||||
// create all sorts of UDFs
|
||||
}
|
||||
|
||||
// {{{ now()
|
||||
|
||||
/**
|
||||
* Return string to call a variable with the current timestamp inside an SQL statement
|
||||
* There are three special variables for current date and time.
|
||||
*
|
||||
* @return string to call a variable with the current timestamp
|
||||
* @access public
|
||||
*/
|
||||
function now($type = 'timestamp')
|
||||
{
|
||||
switch ($type) {
|
||||
case 'time':
|
||||
return 'time(\'now\')';
|
||||
case 'date':
|
||||
return 'date(\'now\')';
|
||||
case 'timestamp':
|
||||
default:
|
||||
return 'datetime(\'now\')';
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ unixtimestamp()
|
||||
|
||||
/**
|
||||
* return string to call a function to get the unix timestamp from a iso timestamp
|
||||
*
|
||||
* @param string $expression
|
||||
*
|
||||
* @return string to call a variable with the timestamp
|
||||
* @access public
|
||||
*/
|
||||
function unixtimestamp($expression)
|
||||
{
|
||||
return 'strftime("%s",'. $expression.', "utc")';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ substring()
|
||||
|
||||
/**
|
||||
* return string to call a function to get a substring inside an SQL statement
|
||||
*
|
||||
* @return string to call a function to get a substring
|
||||
* @access public
|
||||
*/
|
||||
function substring($value, $position = 1, $length = null)
|
||||
{
|
||||
if (null !== $length) {
|
||||
return "substr($value, $position, $length)";
|
||||
}
|
||||
return "substr($value, $position, length($value))";
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ random()
|
||||
|
||||
/**
|
||||
* return string to call a function to get random value inside an SQL statement
|
||||
*
|
||||
* @return return string to generate float between 0 and 1
|
||||
* @access public
|
||||
*/
|
||||
function random()
|
||||
{
|
||||
return '((RANDOM()+2147483648)/4294967296)';
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ replace()
|
||||
|
||||
/**
|
||||
* return string to call a function to get a replacement inside an SQL statement.
|
||||
*
|
||||
* @return string to call a function to get a replace
|
||||
* @access public
|
||||
*/
|
||||
function replace($str, $from_str, $to_str)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
|
||||
'method not implemented', __FUNCTION__);
|
||||
return $error;
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
?>
|
||||
|
|
2052
3rdparty/MDB2/Driver/Manager/Common.php
vendored
2052
3rdparty/MDB2/Driver/Manager/Common.php
vendored
File diff suppressed because it is too large
Load diff
2907
3rdparty/MDB2/Driver/Manager/mysql.php
vendored
2907
3rdparty/MDB2/Driver/Manager/mysql.php
vendored
File diff suppressed because it is too large
Load diff
1932
3rdparty/MDB2/Driver/Manager/pgsql.php
vendored
1932
3rdparty/MDB2/Driver/Manager/pgsql.php
vendored
File diff suppressed because it is too large
Load diff
2752
3rdparty/MDB2/Driver/Manager/sqlite.php
vendored
2752
3rdparty/MDB2/Driver/Manager/sqlite.php
vendored
File diff suppressed because it is too large
Load diff
120
3rdparty/MDB2/Driver/Native/Common.php
vendored
120
3rdparty/MDB2/Driver/Native/Common.php
vendored
|
@ -1,61 +1,61 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Common.php 242348 2007-09-09 13:47:36Z quipo $
|
||||
//
|
||||
|
||||
/**
|
||||
* Base class for the natuve modules that is extended by each MDB2 driver
|
||||
*
|
||||
* To load this module in the MDB2 object:
|
||||
* $mdb->loadModule('Native');
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Native_Common extends MDB2_Module_Common
|
||||
{
|
||||
}
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
/**
|
||||
* Base class for the natuve modules that is extended by each MDB2 driver
|
||||
*
|
||||
* To load this module in the MDB2 object:
|
||||
* $mdb->loadModule('Native');
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Native_Common extends MDB2_Module_Common
|
||||
{
|
||||
}
|
||||
?>
|
118
3rdparty/MDB2/Driver/Native/mysql.php
vendored
118
3rdparty/MDB2/Driver/Native/mysql.php
vendored
|
@ -1,60 +1,60 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: mysql.php 215004 2006-06-18 21:59:05Z lsmith $
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Native/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 MySQL driver for the native module
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Native_mysql extends MDB2_Driver_Native_Common
|
||||
{
|
||||
}
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Native/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 MySQL driver for the native module
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Native_mysql extends MDB2_Driver_Native_Common
|
||||
{
|
||||
}
|
||||
?>
|
174
3rdparty/MDB2/Driver/Native/pgsql.php
vendored
174
3rdparty/MDB2/Driver/Native/pgsql.php
vendored
|
@ -1,88 +1,88 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Paul Cooper <pgc@ucecom.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $
|
||||
|
||||
require_once 'MDB2/Driver/Native/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 PostGreSQL driver for the native module
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Paul Cooper <pgc@ucecom.com>
|
||||
*/
|
||||
class MDB2_Driver_Native_pgsql extends MDB2_Driver_Native_Common
|
||||
{
|
||||
// }}}
|
||||
// {{{ deleteOID()
|
||||
|
||||
/**
|
||||
* delete an OID
|
||||
*
|
||||
* @param integer $OID
|
||||
* @return mixed MDB2_OK on success or MDB2 Error Object on failure
|
||||
* @access public
|
||||
*/
|
||||
function deleteOID($OID)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$connection = $db->getConnection();
|
||||
if (PEAR::isError($connection)) {
|
||||
return $connection;
|
||||
}
|
||||
|
||||
if (!@pg_lo_unlink($connection, $OID)) {
|
||||
return $db->raiseError(null, null, null,
|
||||
'Unable to unlink OID: '.$OID, __FUNCTION__);
|
||||
}
|
||||
return MDB2_OK;
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Paul Cooper <pgc@ucecom.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
|
||||
require_once 'MDB2/Driver/Native/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 PostGreSQL driver for the native module
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Paul Cooper <pgc@ucecom.com>
|
||||
*/
|
||||
class MDB2_Driver_Native_pgsql extends MDB2_Driver_Native_Common
|
||||
{
|
||||
// }}}
|
||||
// {{{ deleteOID()
|
||||
|
||||
/**
|
||||
* delete an OID
|
||||
*
|
||||
* @param integer $OID
|
||||
* @return mixed MDB2_OK on success or MDB2 Error Object on failure
|
||||
* @access public
|
||||
*/
|
||||
function deleteOID($OID)
|
||||
{
|
||||
$db = $this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$connection = $db->getConnection();
|
||||
if (PEAR::isError($connection)) {
|
||||
return $connection;
|
||||
}
|
||||
|
||||
if (!@pg_lo_unlink($connection, $OID)) {
|
||||
return $db->raiseError(null, null, null,
|
||||
'Unable to unlink OID: '.$OID, __FUNCTION__);
|
||||
}
|
||||
return MDB2_OK;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
118
3rdparty/MDB2/Driver/Native/sqlite.php
vendored
118
3rdparty/MDB2/Driver/Native/sqlite.php
vendored
|
@ -1,60 +1,60 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: sqlite.php 215004 2006-06-18 21:59:05Z lsmith $
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Native/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 SQLite driver for the native module
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Native_sqlite extends MDB2_Driver_Native_Common
|
||||
{
|
||||
}
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
require_once 'MDB2/Driver/Native/Common.php';
|
||||
|
||||
/**
|
||||
* MDB2 SQLite driver for the native module
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Driver_Native_sqlite extends MDB2_Driver_Native_Common
|
||||
{
|
||||
}
|
||||
?>
|
1032
3rdparty/MDB2/Driver/Reverse/Common.php
vendored
1032
3rdparty/MDB2/Driver/Reverse/Common.php
vendored
File diff suppressed because it is too large
Load diff
1090
3rdparty/MDB2/Driver/Reverse/mysql.php
vendored
1090
3rdparty/MDB2/Driver/Reverse/mysql.php
vendored
File diff suppressed because it is too large
Load diff
1146
3rdparty/MDB2/Driver/Reverse/pgsql.php
vendored
1146
3rdparty/MDB2/Driver/Reverse/pgsql.php
vendored
File diff suppressed because it is too large
Load diff
1218
3rdparty/MDB2/Driver/Reverse/sqlite.php
vendored
1218
3rdparty/MDB2/Driver/Reverse/sqlite.php
vendored
File diff suppressed because it is too large
Load diff
3439
3rdparty/MDB2/Driver/mysql.php
vendored
3439
3rdparty/MDB2/Driver/mysql.php
vendored
File diff suppressed because it is too large
Load diff
3131
3rdparty/MDB2/Driver/pgsql.php
vendored
3131
3rdparty/MDB2/Driver/pgsql.php
vendored
File diff suppressed because it is too large
Load diff
2197
3rdparty/MDB2/Driver/sqlite.php
vendored
2197
3rdparty/MDB2/Driver/sqlite.php
vendored
File diff suppressed because it is too large
Load diff
1441
3rdparty/MDB2/Extended.php
vendored
1441
3rdparty/MDB2/Extended.php
vendored
File diff suppressed because it is too large
Load diff
519
3rdparty/MDB2/Iterator.php
vendored
519
3rdparty/MDB2/Iterator.php
vendored
|
@ -1,259 +1,262 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP version 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Iterator.php 295586 2010-02-28 17:04:17Z quipo $
|
||||
|
||||
/**
|
||||
* PHP5 Iterator
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Iterator implements Iterator
|
||||
{
|
||||
protected $fetchmode;
|
||||
protected $result;
|
||||
protected $row;
|
||||
|
||||
// {{{ constructor
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct($result, $fetchmode = MDB2_FETCHMODE_DEFAULT)
|
||||
{
|
||||
$this->result = $result;
|
||||
$this->fetchmode = $fetchmode;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ seek()
|
||||
|
||||
/**
|
||||
* Seek forward to a specific row in a result set
|
||||
*
|
||||
* @param int number of the row where the data can be found
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function seek($rownum)
|
||||
{
|
||||
$this->row = null;
|
||||
if ($this->result) {
|
||||
$this->result->seek($rownum);
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ next()
|
||||
|
||||
/**
|
||||
* Fetch next row of data
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
$this->row = null;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ current()
|
||||
|
||||
/**
|
||||
* return a row of data
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
if (null === $this->row) {
|
||||
$row = $this->result->fetchRow($this->fetchmode);
|
||||
if (PEAR::isError($row)) {
|
||||
$row = false;
|
||||
}
|
||||
$this->row = $row;
|
||||
}
|
||||
return $this->row;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ valid()
|
||||
|
||||
/**
|
||||
* Check if the end of the result set has been reached
|
||||
*
|
||||
* @return bool true/false, false is also returned on failure
|
||||
* @access public
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return (bool)$this->current();
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ free()
|
||||
|
||||
/**
|
||||
* Free the internal resources associated with result.
|
||||
*
|
||||
* @return bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
|
||||
* @access public
|
||||
*/
|
||||
public function free()
|
||||
{
|
||||
if ($this->result) {
|
||||
return $this->result->free();
|
||||
}
|
||||
$this->result = false;
|
||||
$this->row = null;
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ key()
|
||||
|
||||
/**
|
||||
* Returns the row number
|
||||
*
|
||||
* @return int|bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
|
||||
* @access public
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
if ($this->result) {
|
||||
return $this->result->rowCount();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ rewind()
|
||||
|
||||
/**
|
||||
* Seek to the first row in a result set
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ destructor
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->free();
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP5 buffered Iterator
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_BufferedIterator extends MDB2_Iterator implements SeekableIterator
|
||||
{
|
||||
// {{{ valid()
|
||||
|
||||
/**
|
||||
* Check if the end of the result set has been reached
|
||||
*
|
||||
* @return bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
|
||||
* @access public
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
if ($this->result) {
|
||||
return $this->result->valid();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{count()
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result object
|
||||
*
|
||||
* @return int|MDB2_Error number of rows, false|MDB2_Error if result is invalid
|
||||
* @access public
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
if ($this->result) {
|
||||
return $this->result->numRows();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ rewind()
|
||||
|
||||
/**
|
||||
* Seek to the first row in a result set
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->seek(0);
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP version 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/**
|
||||
* PHP5 Iterator
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_Iterator implements Iterator
|
||||
{
|
||||
protected $fetchmode;
|
||||
/**
|
||||
* @var MDB2_Result_Common
|
||||
*/
|
||||
protected $result;
|
||||
protected $row;
|
||||
|
||||
// {{{ constructor
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct(MDB2_Result_Common $result, $fetchmode = MDB2_FETCHMODE_DEFAULT)
|
||||
{
|
||||
$this->result = $result;
|
||||
$this->fetchmode = $fetchmode;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ seek()
|
||||
|
||||
/**
|
||||
* Seek forward to a specific row in a result set
|
||||
*
|
||||
* @param int number of the row where the data can be found
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function seek($rownum)
|
||||
{
|
||||
$this->row = null;
|
||||
if ($this->result) {
|
||||
$this->result->seek($rownum);
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ next()
|
||||
|
||||
/**
|
||||
* Fetch next row of data
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
$this->row = null;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ current()
|
||||
|
||||
/**
|
||||
* return a row of data
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
if (null === $this->row) {
|
||||
$row = $this->result->fetchRow($this->fetchmode);
|
||||
if (PEAR::isError($row)) {
|
||||
$row = false;
|
||||
}
|
||||
$this->row = $row;
|
||||
}
|
||||
return $this->row;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ valid()
|
||||
|
||||
/**
|
||||
* Check if the end of the result set has been reached
|
||||
*
|
||||
* @return bool true/false, false is also returned on failure
|
||||
* @access public
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return (bool)$this->current();
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ free()
|
||||
|
||||
/**
|
||||
* Free the internal resources associated with result.
|
||||
*
|
||||
* @return bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
|
||||
* @access public
|
||||
*/
|
||||
public function free()
|
||||
{
|
||||
if ($this->result) {
|
||||
return $this->result->free();
|
||||
}
|
||||
$this->result = false;
|
||||
$this->row = null;
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ key()
|
||||
|
||||
/**
|
||||
* Returns the row number
|
||||
*
|
||||
* @return int|bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
|
||||
* @access public
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
if ($this->result) {
|
||||
return $this->result->rowCount();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ rewind()
|
||||
|
||||
/**
|
||||
* Seek to the first row in a result set
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ destructor
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->free();
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP5 buffered Iterator
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_BufferedIterator extends MDB2_Iterator implements SeekableIterator
|
||||
{
|
||||
// {{{ valid()
|
||||
|
||||
/**
|
||||
* Check if the end of the result set has been reached
|
||||
*
|
||||
* @return bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
|
||||
* @access public
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
if ($this->result) {
|
||||
return $this->result->valid();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{count()
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result object
|
||||
*
|
||||
* @return int|MDB2_Error number of rows, false|MDB2_Error if result is invalid
|
||||
* @access public
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
if ($this->result) {
|
||||
return $this->result->numRows();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ rewind()
|
||||
|
||||
/**
|
||||
* Seek to the first row in a result set
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->seek(0);
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
?>
|
528
3rdparty/MDB2/LOB.php
vendored
528
3rdparty/MDB2/LOB.php
vendored
|
@ -1,264 +1,264 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP version 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: LOB.php 222350 2006-10-25 11:52:21Z lsmith $
|
||||
|
||||
/**
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
|
||||
require_once 'MDB2.php';
|
||||
|
||||
/**
|
||||
* MDB2_LOB: user land stream wrapper implementation for LOB support
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_LOB
|
||||
{
|
||||
/**
|
||||
* contains the key to the global MDB2 instance array of the associated
|
||||
* MDB2 instance
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
var $db_index;
|
||||
|
||||
/**
|
||||
* contains the key to the global MDB2_LOB instance array of the associated
|
||||
* MDB2_LOB instance
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
var $lob_index;
|
||||
|
||||
// {{{ stream_open()
|
||||
|
||||
/**
|
||||
* open stream
|
||||
*
|
||||
* @param string specifies the URL that was passed to fopen()
|
||||
* @param string the mode used to open the file
|
||||
* @param int holds additional flags set by the streams API
|
||||
* @param string not used
|
||||
*
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
if (!preg_match('/^rb?\+?$/', $mode)) {
|
||||
return false;
|
||||
}
|
||||
$url = parse_url($path);
|
||||
if (empty($url['host'])) {
|
||||
return false;
|
||||
}
|
||||
$this->db_index = (int)$url['host'];
|
||||
if (!isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
return false;
|
||||
}
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
$this->lob_index = (int)$url['user'];
|
||||
if (!isset($db->datatype->lobs[$this->lob_index])) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_read()
|
||||
|
||||
/**
|
||||
* read stream
|
||||
*
|
||||
* @param int number of bytes to read
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function stream_read($count)
|
||||
{
|
||||
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
$db->datatype->_retrieveLOB($db->datatype->lobs[$this->lob_index]);
|
||||
|
||||
$data = $db->datatype->_readLOB($db->datatype->lobs[$this->lob_index], $count);
|
||||
$length = strlen($data);
|
||||
if ($length == 0) {
|
||||
$db->datatype->lobs[$this->lob_index]['endOfLOB'] = true;
|
||||
}
|
||||
$db->datatype->lobs[$this->lob_index]['position'] += $length;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_write()
|
||||
|
||||
/**
|
||||
* write stream, note implemented
|
||||
*
|
||||
* @param string data
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
function stream_write($data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_tell()
|
||||
|
||||
/**
|
||||
* return the current position
|
||||
*
|
||||
* @return int current position
|
||||
* @access public
|
||||
*/
|
||||
function stream_tell()
|
||||
{
|
||||
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
return $db->datatype->lobs[$this->lob_index]['position'];
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_eof()
|
||||
|
||||
/**
|
||||
* Check if stream reaches EOF
|
||||
*
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
function stream_eof()
|
||||
{
|
||||
if (!isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
$result = $db->datatype->_endOfLOB($db->datatype->lobs[$this->lob_index]);
|
||||
if (version_compare(phpversion(), "5.0", ">=")
|
||||
&& version_compare(phpversion(), "5.1", "<")
|
||||
) {
|
||||
return !$result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_seek()
|
||||
|
||||
/**
|
||||
* Seek stream, not implemented
|
||||
*
|
||||
* @param int offset
|
||||
* @param int whence
|
||||
*
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
function stream_seek($offset, $whence)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_stat()
|
||||
|
||||
/**
|
||||
* return information about stream
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function stream_stat()
|
||||
{
|
||||
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
return array(
|
||||
'db_index' => $this->db_index,
|
||||
'lob_index' => $this->lob_index,
|
||||
);
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_close()
|
||||
|
||||
/**
|
||||
* close stream
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function stream_close()
|
||||
{
|
||||
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
if (isset($db->datatype->lobs[$this->lob_index])) {
|
||||
$db->datatype->_destroyLOB($db->datatype->lobs[$this->lob_index]);
|
||||
unset($db->datatype->lobs[$this->lob_index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
// register streams wrapper
|
||||
if (!stream_wrapper_register("MDB2LOB", "MDB2_LOB")) {
|
||||
MDB2::raiseError();
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP version 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lukas Smith <smith@pooteeweet.org> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/**
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
|
||||
require_once 'MDB2.php';
|
||||
|
||||
/**
|
||||
* MDB2_LOB: user land stream wrapper implementation for LOB support
|
||||
*
|
||||
* @package MDB2
|
||||
* @category Database
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
*/
|
||||
class MDB2_LOB
|
||||
{
|
||||
/**
|
||||
* contains the key to the global MDB2 instance array of the associated
|
||||
* MDB2 instance
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
var $db_index;
|
||||
|
||||
/**
|
||||
* contains the key to the global MDB2_LOB instance array of the associated
|
||||
* MDB2_LOB instance
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
var $lob_index;
|
||||
|
||||
// {{{ stream_open()
|
||||
|
||||
/**
|
||||
* open stream
|
||||
*
|
||||
* @param string specifies the URL that was passed to fopen()
|
||||
* @param string the mode used to open the file
|
||||
* @param int holds additional flags set by the streams API
|
||||
* @param string not used
|
||||
*
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
if (!preg_match('/^rb?\+?$/', $mode)) {
|
||||
return false;
|
||||
}
|
||||
$url = parse_url($path);
|
||||
if (empty($url['host'])) {
|
||||
return false;
|
||||
}
|
||||
$this->db_index = (int)$url['host'];
|
||||
if (!isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
return false;
|
||||
}
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
$this->lob_index = (int)$url['user'];
|
||||
if (!isset($db->datatype->lobs[$this->lob_index])) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_read()
|
||||
|
||||
/**
|
||||
* read stream
|
||||
*
|
||||
* @param int number of bytes to read
|
||||
*
|
||||
* @return string
|
||||
* @access public
|
||||
*/
|
||||
function stream_read($count)
|
||||
{
|
||||
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
$db->datatype->_retrieveLOB($db->datatype->lobs[$this->lob_index]);
|
||||
|
||||
$data = $db->datatype->_readLOB($db->datatype->lobs[$this->lob_index], $count);
|
||||
$length = strlen($data);
|
||||
if ($length == 0) {
|
||||
$db->datatype->lobs[$this->lob_index]['endOfLOB'] = true;
|
||||
}
|
||||
$db->datatype->lobs[$this->lob_index]['position'] += $length;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_write()
|
||||
|
||||
/**
|
||||
* write stream, note implemented
|
||||
*
|
||||
* @param string data
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
function stream_write($data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_tell()
|
||||
|
||||
/**
|
||||
* return the current position
|
||||
*
|
||||
* @return int current position
|
||||
* @access public
|
||||
*/
|
||||
function stream_tell()
|
||||
{
|
||||
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
return $db->datatype->lobs[$this->lob_index]['position'];
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_eof()
|
||||
|
||||
/**
|
||||
* Check if stream reaches EOF
|
||||
*
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
function stream_eof()
|
||||
{
|
||||
if (!isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
$result = $db->datatype->_endOfLOB($db->datatype->lobs[$this->lob_index]);
|
||||
if (version_compare(phpversion(), "5.0", ">=")
|
||||
&& version_compare(phpversion(), "5.1", "<")
|
||||
) {
|
||||
return !$result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_seek()
|
||||
|
||||
/**
|
||||
* Seek stream, not implemented
|
||||
*
|
||||
* @param int offset
|
||||
* @param int whence
|
||||
*
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
function stream_seek($offset, $whence)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_stat()
|
||||
|
||||
/**
|
||||
* return information about stream
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function stream_stat()
|
||||
{
|
||||
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
return array(
|
||||
'db_index' => $this->db_index,
|
||||
'lob_index' => $this->lob_index,
|
||||
);
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ stream_close()
|
||||
|
||||
/**
|
||||
* close stream
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function stream_close()
|
||||
{
|
||||
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
|
||||
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
|
||||
if (isset($db->datatype->lobs[$this->lob_index])) {
|
||||
$db->datatype->_destroyLOB($db->datatype->lobs[$this->lob_index]);
|
||||
unset($db->datatype->lobs[$this->lob_index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
// register streams wrapper
|
||||
if (!stream_wrapper_register("MDB2LOB", "MDB2_LOB")) {
|
||||
MDB2::raiseError();
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
109
3rdparty/MDB2/Schema.php
vendored
109
3rdparty/MDB2/Schema.php
vendored
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* PHP version 4, 5
|
||||
*
|
||||
* Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -39,15 +37,14 @@
|
|||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Smith <smith@pooteeweet.org>
|
||||
* Author: Igor Feghali <ifeghali@php.net>
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
* @author Igor Feghali <ifeghali@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version CVS: $Id: Schema.php,v 1.132 2009/02/22 21:43:22 ifeghali Exp $
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
|
@ -96,7 +93,7 @@ class MDB2_Schema extends PEAR
|
|||
'parser' => 'MDB2_Schema_Parser',
|
||||
'writer' => 'MDB2_Schema_Writer',
|
||||
'validate' => 'MDB2_Schema_Validate',
|
||||
'drop_missing_tables' => false
|
||||
'drop_obsolete_objects' => false
|
||||
);
|
||||
|
||||
// }}}
|
||||
|
@ -237,9 +234,9 @@ class MDB2_Schema extends PEAR
|
|||
* @access public
|
||||
* @see MDB2::parseDSN
|
||||
*/
|
||||
function &factory(&$db, $options = array())
|
||||
static function &factory(&$db, $options = array())
|
||||
{
|
||||
$obj =& new MDB2_Schema();
|
||||
$obj = new MDB2_Schema();
|
||||
|
||||
$result = $obj->connect($db, $options);
|
||||
if (PEAR::isError($result)) {
|
||||
|
@ -284,14 +281,14 @@ class MDB2_Schema extends PEAR
|
|||
|
||||
$this->disconnect();
|
||||
if (!MDB2::isConnection($db)) {
|
||||
$db =& MDB2::factory($db, $db_options);
|
||||
$db = MDB2::factory($db, $db_options);
|
||||
}
|
||||
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
}
|
||||
|
||||
$this->db =& $db;
|
||||
$this->db = $db;
|
||||
$this->db->loadModule('Datatype');
|
||||
$this->db->loadModule('Manager');
|
||||
$this->db->loadModule('Reverse');
|
||||
|
@ -380,7 +377,7 @@ class MDB2_Schema extends PEAR
|
|||
$dtd_file = $this->options['dtd_file'];
|
||||
if ($dtd_file) {
|
||||
include_once 'XML/DTD/XmlValidator.php';
|
||||
$dtd =& new XML_DTD_XmlValidator;
|
||||
$dtd = new XML_DTD_XmlValidator;
|
||||
if (!$dtd->isValid($dtd_file, $input_file)) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_PARSE, null, null, $dtd->getMessage());
|
||||
}
|
||||
|
@ -393,7 +390,16 @@ class MDB2_Schema extends PEAR
|
|||
return $result;
|
||||
}
|
||||
|
||||
$parser =& new $class_name($variables, $fail_on_invalid_names, $structure, $this->options['valid_types'], $this->options['force_defaults']);
|
||||
$max_identifiers_length = null;
|
||||
if (isset($this->db->options['max_identifiers_length'])) {
|
||||
$max_identifiers_length = $this->db->options['max_identifiers_length'];
|
||||
}
|
||||
|
||||
$parser = new $class_name($variables, $fail_on_invalid_names, $structure,
|
||||
$this->options['valid_types'], $this->options['force_defaults'],
|
||||
$max_identifiers_length
|
||||
);
|
||||
|
||||
$result = $parser->setInputFile($input_file);
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
|
@ -436,7 +442,17 @@ class MDB2_Schema extends PEAR
|
|||
return $result;
|
||||
}
|
||||
|
||||
$val =& new $class_name($this->options['fail_on_invalid_names'], $this->options['valid_types'], $this->options['force_defaults']);
|
||||
$max_identifiers_length = null;
|
||||
if (isset($this->db->options['max_identifiers_length'])) {
|
||||
$max_identifiers_length = $this->db->options['max_identifiers_length'];
|
||||
}
|
||||
|
||||
$val = new $class_name(
|
||||
$this->options['fail_on_invalid_names'],
|
||||
$this->options['valid_types'],
|
||||
$this->options['force_defaults'],
|
||||
$max_identifiers_length
|
||||
);
|
||||
|
||||
$database_definition = array(
|
||||
'name' => $database,
|
||||
|
@ -470,7 +486,7 @@ class MDB2_Schema extends PEAR
|
|||
'initialization' => array()
|
||||
);
|
||||
|
||||
$table_definition =& $database_definition['tables'][$table_name];
|
||||
$table_definition = $database_definition['tables'][$table_name];
|
||||
foreach ($fields as $field_name) {
|
||||
$definition = $this->db->reverse->getTableFieldDefinition($table_name, $field_name);
|
||||
if (PEAR::isError($definition)) {
|
||||
|
@ -1455,16 +1471,17 @@ class MDB2_Schema extends PEAR
|
|||
$changes['tables'] = MDB2_Schema::arrayMergeClobber($changes['tables'], $change);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($previous_definition['tables'])
|
||||
&& is_array($previous_definition['tables'])) {
|
||||
foreach ($previous_definition['tables'] as $table_name => $table) {
|
||||
if (empty($defined_tables[$table_name])) {
|
||||
$changes['tables']['remove'][$table_name] = true;
|
||||
}
|
||||
}
|
||||
if (!empty($previous_definition['tables'])
|
||||
&& is_array($previous_definition['tables'])
|
||||
) {
|
||||
foreach ($previous_definition['tables'] as $table_name => $table) {
|
||||
if (empty($defined_tables[$table_name])) {
|
||||
$changes['tables']['remove'][$table_name] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($current_definition['sequences']) && is_array($current_definition['sequences'])) {
|
||||
$changes['sequences'] = $defined_sequences = array();
|
||||
foreach ($current_definition['sequences'] as $sequence_name => $sequence) {
|
||||
|
@ -1484,14 +1501,17 @@ class MDB2_Schema extends PEAR
|
|||
$changes['sequences'] = MDB2_Schema::arrayMergeClobber($changes['sequences'], $change);
|
||||
}
|
||||
}
|
||||
if (!empty($previous_definition['sequences']) && is_array($previous_definition['sequences'])) {
|
||||
foreach ($previous_definition['sequences'] as $sequence_name => $sequence) {
|
||||
if (empty($defined_sequences[$sequence_name])) {
|
||||
$changes['sequences']['remove'][$sequence_name] = true;
|
||||
}
|
||||
}
|
||||
if (!empty($previous_definition['sequences'])
|
||||
&& is_array($previous_definition['sequences'])
|
||||
) {
|
||||
foreach ($previous_definition['sequences'] as $sequence_name => $sequence) {
|
||||
if (empty($defined_sequences[$sequence_name])) {
|
||||
$changes['sequences']['remove'][$sequence_name] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $changes;
|
||||
}
|
||||
|
||||
|
@ -2022,9 +2042,10 @@ class MDB2_Schema extends PEAR
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->options['drop_missing_tables']
|
||||
if ($this->options['drop_obsolete_objects']
|
||||
&& !empty($changes['remove'])
|
||||
&& is_array($changes['remove'])) {
|
||||
&& is_array($changes['remove'])
|
||||
) {
|
||||
foreach ($changes['remove'] as $table_name => $table) {
|
||||
$result = $this->db->manager->dropTable($table_name);
|
||||
if (PEAR::isError($result)) {
|
||||
|
@ -2105,7 +2126,10 @@ class MDB2_Schema extends PEAR
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($changes['remove']) && is_array($changes['remove'])) {
|
||||
if ($this->options['drop_obsolete_objects']
|
||||
&& !empty($changes['remove'])
|
||||
&& is_array($changes['remove'])
|
||||
) {
|
||||
foreach ($changes['remove'] as $sequence_name => $sequence) {
|
||||
$result = $this->db->manager->dropSequence($sequence_name);
|
||||
if (PEAR::isError($result)) {
|
||||
|
@ -2232,7 +2256,7 @@ class MDB2_Schema extends PEAR
|
|||
}
|
||||
|
||||
if (!empty($changes['tables']['remove']) && is_array($changes['tables']['remove'])) {
|
||||
if ($this->options['drop_missing_tables']) {
|
||||
if ($this->options['drop_obsolete_objects']) {
|
||||
foreach ($changes['tables']['remove'] as $table_name => $table) {
|
||||
$this->db->debug("$table_name:", __FUNCTION__);
|
||||
$this->db->debug("\tRemoved table '$table_name'", __FUNCTION__);
|
||||
|
@ -2338,9 +2362,15 @@ class MDB2_Schema extends PEAR
|
|||
}
|
||||
}
|
||||
if (!empty($changes['sequences']['remove']) && is_array($changes['sequences']['remove'])) {
|
||||
foreach ($changes['sequences']['remove'] as $sequence_name => $sequence) {
|
||||
$this->db->debug("$sequence_name:", __FUNCTION__);
|
||||
$this->db->debug("\tAdded sequence '$sequence_name'", __FUNCTION__);
|
||||
if ($this->options['drop_obsolete_objects']) {
|
||||
foreach ($changes['sequences']['remove'] as $sequence_name => $sequence) {
|
||||
$this->db->debug("$sequence_name:", __FUNCTION__);
|
||||
$this->db->debug("\tRemoved sequence '$sequence_name'", __FUNCTION__);
|
||||
}
|
||||
} else {
|
||||
foreach ($changes['sequences']['remove'] as $sequence_name => $sequence) {
|
||||
$this->db->debug("\tObsolete sequence '$sequence_name' left as is", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($changes['sequences']['change']) && is_array($changes['sequences']['change'])) {
|
||||
|
@ -2448,7 +2478,7 @@ class MDB2_Schema extends PEAR
|
|||
}
|
||||
}
|
||||
|
||||
$writer =& new $class_name($this->options['valid_types']);
|
||||
$writer = new $class_name($this->options['valid_types']);
|
||||
return $writer->dumpDatabase($database_definition, $arguments, $dump);
|
||||
}
|
||||
|
||||
|
@ -2696,9 +2726,9 @@ class MDB2_Schema extends PEAR
|
|||
* @access public
|
||||
* @see PEAR_Error
|
||||
*/
|
||||
function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
|
||||
static function &raiseError($code = null, $mode = null, $options = null, $userinfo = null, $dummy1 = null, $dummy2 = null, $dummy3 = false)
|
||||
{
|
||||
$err =& PEAR::raiseError(null, $code, $mode, $options,
|
||||
$err = PEAR::raiseError(null, $code, $mode, $options,
|
||||
$userinfo, 'MDB2_Schema_Error', true);
|
||||
return $err;
|
||||
}
|
||||
|
@ -2717,7 +2747,7 @@ class MDB2_Schema extends PEAR
|
|||
* @return bool true if parameter is an error
|
||||
* @access public
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
static function isError($data, $code = null)
|
||||
{
|
||||
if (is_a($data, 'MDB2_Schema_Error')) {
|
||||
if (is_null($code)) {
|
||||
|
@ -2764,4 +2794,3 @@ class MDB2_Schema_Error extends PEAR_Error
|
|||
$mode, $level, $debuginfo);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
132
3rdparty/MDB2/Schema/Parser.php
vendored
132
3rdparty/MDB2/Schema/Parser.php
vendored
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -39,21 +37,17 @@
|
|||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Christian Dickmann <dickmann@php.net>
|
||||
* Author: Igor Feghali <ifeghali@php.net>
|
||||
*
|
||||
* $Id: Parser.php,v 1.68 2008/11/30 03:34:00 clockwerx Exp $
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Christian Dickmann <dickmann@php.net>
|
||||
* @author Igor Feghali <ifeghali@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version CVS: $Id: Parser.php,v 1.68 2008/11/30 03:34:00 clockwerx Exp $
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
|
||||
require_once 'XML/Parser.php';
|
||||
require_once 'MDB2/Schema/Validate.php';
|
||||
|
||||
|
@ -114,27 +108,83 @@ class MDB2_Schema_Parser extends XML_Parser
|
|||
|
||||
var $val;
|
||||
|
||||
/**
|
||||
* PHP 5 constructor
|
||||
*
|
||||
* @param array $variables mixed array with user defined schema
|
||||
* variables
|
||||
* @param bool $fail_on_invalid_names array with reserved words per RDBMS
|
||||
* @param array $structure multi dimensional array with
|
||||
* database schema and data
|
||||
* @param array $valid_types information of all valid fields
|
||||
* types
|
||||
* @param bool $force_defaults if true sets a default value to
|
||||
* field when not explicit
|
||||
* @param int $max_identifiers_length maximum allowed size for entities
|
||||
* name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function __construct($variables, $fail_on_invalid_names = true,
|
||||
$structure = false, $valid_types = array(),
|
||||
$force_defaults = true)
|
||||
{
|
||||
$structure = false, $valid_types = array(), $force_defaults = true,
|
||||
$max_identifiers_length = null
|
||||
) {
|
||||
// force ISO-8859-1 due to different defaults for PHP4 and PHP5
|
||||
// todo: this probably needs to be investigated some more andcleaned up
|
||||
parent::XML_Parser('ISO-8859-1');
|
||||
parent::__construct('ISO-8859-1');
|
||||
|
||||
$this->variables = $variables;
|
||||
$this->structure = $structure;
|
||||
$this->val =& new MDB2_Schema_Validate($fail_on_invalid_names, $valid_types, $force_defaults);
|
||||
$this->val = new MDB2_Schema_Validate(
|
||||
$fail_on_invalid_names,
|
||||
$valid_types,
|
||||
$force_defaults,
|
||||
$max_identifiers_length
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP 4 compatible constructor
|
||||
*
|
||||
* @param array $variables mixed array with user defined schema
|
||||
* variables
|
||||
* @param bool $fail_on_invalid_names array with reserved words per RDBMS
|
||||
* @param array $structure multi dimensional array with
|
||||
* database schema and data
|
||||
* @param array $valid_types information of all valid fields
|
||||
* types
|
||||
* @param bool $force_defaults if true sets a default value to
|
||||
* field when not explicit
|
||||
* @param int $max_identifiers_length maximum allowed size for entities
|
||||
* name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function MDB2_Schema_Parser($variables, $fail_on_invalid_names = true,
|
||||
$structure = false, $valid_types = array(),
|
||||
$force_defaults = true)
|
||||
{
|
||||
$structure = false, $valid_types = array(), $force_defaults = true,
|
||||
$max_identifiers_length = null
|
||||
) {
|
||||
$this->__construct($variables, $fail_on_invalid_names, $structure, $valid_types, $force_defaults);
|
||||
}
|
||||
|
||||
function startHandler($xp, $element, $attribs)
|
||||
/**
|
||||
* Triggered when reading a XML open tag <element>
|
||||
*
|
||||
* @param resource $xp xml parser resource
|
||||
* @param string $element element name
|
||||
* @param array $attribs attributes
|
||||
*
|
||||
* @return void
|
||||
* @access private
|
||||
* @static
|
||||
*/
|
||||
function startHandler($xp, $element, &$attribs)
|
||||
{
|
||||
if (strtolower($element) == 'variable') {
|
||||
$this->var_mode = true;
|
||||
|
@ -335,12 +385,21 @@ class MDB2_Schema_Parser extends XML_Parser
|
|||
'start' => '',
|
||||
'description' => '',
|
||||
'comments' => '',
|
||||
'on' => array('table' => '', 'field' => '')
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when reading a XML close tag </element>
|
||||
*
|
||||
* @param resource $xp xml parser resource
|
||||
* @param string $element element name
|
||||
*
|
||||
* @return void
|
||||
* @access private
|
||||
* @static
|
||||
*/
|
||||
function endHandler($xp, $element)
|
||||
{
|
||||
if (strtolower($element) == 'variable') {
|
||||
|
@ -503,7 +562,21 @@ class MDB2_Schema_Parser extends XML_Parser
|
|||
$this->element = implode('-', $this->elements);
|
||||
}
|
||||
|
||||
function &raiseError($msg = null, $xmlecode = 0, $xp = null, $ecode = MDB2_SCHEMA_ERROR_PARSE)
|
||||
/**
|
||||
* Pushes a MDB2_Schema_Error into stack and returns it
|
||||
*
|
||||
* @param string $msg textual message
|
||||
* @param int $xmlecode PHP's XML parser error code
|
||||
* @param resource $xp xml parser resource
|
||||
* @param int $ecode MDB2_Schema's error code
|
||||
*
|
||||
* @return object
|
||||
* @access private
|
||||
* @static
|
||||
*/
|
||||
static function &raiseError($msg = null, $xmlecode = 0, $xp = null, $ecode = MDB2_SCHEMA_ERROR_PARSE, $userinfo = null,
|
||||
$error_class = null,
|
||||
$skipmsg = false)
|
||||
{
|
||||
if (is_null($this->error)) {
|
||||
$error = '';
|
||||
|
@ -530,11 +603,21 @@ class MDB2_Schema_Parser extends XML_Parser
|
|||
|
||||
$error .= "\n";
|
||||
|
||||
$this->error =& MDB2_Schema::raiseError($ecode, null, null, $error);
|
||||
$this->error = MDB2_Schema::raiseError($ecode, null, null, $error);
|
||||
}
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when reading data in a XML element (text between tags)
|
||||
*
|
||||
* @param resource $xp xml parser resource
|
||||
* @param string $data text
|
||||
*
|
||||
* @return void
|
||||
* @access private
|
||||
* @static
|
||||
*/
|
||||
function cdataHandler($xp, $data)
|
||||
{
|
||||
if ($this->var_mode == true) {
|
||||
|
@ -806,6 +889,9 @@ class MDB2_Schema_Parser extends XML_Parser
|
|||
case 'database-sequence-comments':
|
||||
$this->sequence['comments'] .= $data;
|
||||
break;
|
||||
case 'database-sequence-on':
|
||||
$this->sequence['on'] = array('table' => '', 'field' => '');
|
||||
break;
|
||||
case 'database-sequence-on-table':
|
||||
$this->sequence['on']['table'] .= $data;
|
||||
break;
|
||||
|
@ -815,5 +901,3 @@ class MDB2_Schema_Parser extends XML_Parser
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
247
3rdparty/MDB2/Schema/Parser2.php
vendored
247
3rdparty/MDB2/Schema/Parser2.php
vendored
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -39,13 +37,13 @@
|
|||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Igor Feghali <ifeghali@php.net>
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Igor Feghali <ifeghali@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version CVS: $Id: Parser2.php,v 1.12 2008/11/30 03:34:00 clockwerx Exp $
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
|
@ -100,8 +98,30 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
|
||||
var $init = array();
|
||||
|
||||
function __construct($variables, $fail_on_invalid_names = true, $structure = false, $valid_types = array(), $force_defaults = true)
|
||||
{
|
||||
/**
|
||||
* PHP 5 constructor
|
||||
*
|
||||
* @param array $variables mixed array with user defined schema
|
||||
* variables
|
||||
* @param bool $fail_on_invalid_names array with reserved words per RDBMS
|
||||
* @param array $structure multi dimensional array with
|
||||
* database schema and data
|
||||
* @param array $valid_types information of all valid fields
|
||||
* types
|
||||
* @param bool $force_defaults if true sets a default value to
|
||||
* field when not explicit
|
||||
* @param int $max_identifiers_length maximum allowed size for entities
|
||||
* name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function __construct($variables, $fail_on_invalid_names = true,
|
||||
$structure = false, $valid_types = array(), $force_defaults = true,
|
||||
$max_identifiers_length = null
|
||||
) {
|
||||
// force ISO-8859-1 due to different defaults for PHP4 and PHP5
|
||||
// todo: this probably needs to be investigated some more and cleaned up
|
||||
$this->options['encoding'] = 'ISO-8859-1';
|
||||
|
@ -119,15 +139,44 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
$this->variables = $variables;
|
||||
$this->structure = $structure;
|
||||
|
||||
$this->val =& new MDB2_Schema_Validate($fail_on_invalid_names, $valid_types, $force_defaults);
|
||||
$this->val = new MDB2_Schema_Validate($fail_on_invalid_names, $valid_types, $force_defaults);
|
||||
parent::XML_Unserializer($this->options);
|
||||
}
|
||||
|
||||
function MDB2_Schema_Parser2($variables, $fail_on_invalid_names = true, $structure = false, $valid_types = array(), $force_defaults = true)
|
||||
{
|
||||
/**
|
||||
* PHP 4 compatible constructor
|
||||
*
|
||||
* @param array $variables mixed array with user defined schema
|
||||
* variables
|
||||
* @param bool $fail_on_invalid_names array with reserved words per RDBMS
|
||||
* @param array $structure multi dimensional array with
|
||||
* database schema and data
|
||||
* @param array $valid_types information of all valid fields
|
||||
* types
|
||||
* @param bool $force_defaults if true sets a default value to
|
||||
* field when not explicit
|
||||
* @param int $max_identifiers_length maximum allowed size for entities
|
||||
* name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function MDB2_Schema_Parser2($variables, $fail_on_invalid_names = true,
|
||||
$structure = false, $valid_types = array(), $force_defaults = true,
|
||||
$max_identifiers_length = null
|
||||
) {
|
||||
$this->__construct($variables, $fail_on_invalid_names, $structure, $valid_types, $force_defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Main method. Parses XML Schema File.
|
||||
*
|
||||
* @return bool|error object
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function parse()
|
||||
{
|
||||
$result = $this->unserialize($this->filename, true);
|
||||
|
@ -140,18 +189,33 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the necessary stuff to set the input XML schema file
|
||||
*
|
||||
* @param string $filename full path to schema file
|
||||
*
|
||||
* @return boolean MDB2_OK on success
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setInputFile($filename)
|
||||
{
|
||||
$this->filename = $filename;
|
||||
return MDB2_OK;
|
||||
}
|
||||
|
||||
function renameKey(&$arr, $oKey, $nKey)
|
||||
{
|
||||
$arr[$nKey] = &$arr[$oKey];
|
||||
unset($arr[$oKey]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce the default values for mandatory keys and ensure everything goes
|
||||
* always in the same order (simulates the behaviour of the original
|
||||
* parser). Works at database level.
|
||||
*
|
||||
* @param array $database multi dimensional array with database definition
|
||||
* and data.
|
||||
*
|
||||
* @return bool|error MDB2_OK on success or error object
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function fixDatabaseKeys($database)
|
||||
{
|
||||
$this->database_definition = array(
|
||||
|
@ -204,6 +268,18 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
return MDB2_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce the default values for mandatory keys and ensure everything goes
|
||||
* always in the same order (simulates the behaviour of the original
|
||||
* parser). Works at table level.
|
||||
*
|
||||
* @param array $table multi dimensional array with table definition
|
||||
* and data.
|
||||
*
|
||||
* @return bool|error MDB2_OK on success or error object
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function fixTableKeys($table)
|
||||
{
|
||||
$this->table = array(
|
||||
|
@ -279,6 +355,17 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
return MDB2_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce the default values for mandatory keys and ensure everything goes
|
||||
* always in the same order (simulates the behaviour of the original
|
||||
* parser). Works at table field level.
|
||||
*
|
||||
* @param array $field array with table field definition
|
||||
*
|
||||
* @return bool|error MDB2_OK on success or error object
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function fixTableFieldKeys($field)
|
||||
{
|
||||
$this->field = array();
|
||||
|
@ -328,6 +415,17 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
return MDB2_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce the default values for mandatory keys and ensure everything goes
|
||||
* always in the same order (simulates the behaviour of the original
|
||||
* parser). Works at table index level.
|
||||
*
|
||||
* @param array $index array with table index definition
|
||||
*
|
||||
* @return bool|error MDB2_OK on success or error object
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function fixTableIndexKeys($index)
|
||||
{
|
||||
$this->index = array(
|
||||
|
@ -389,6 +487,17 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
return MDB2_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce the default values for mandatory keys and ensure everything goes
|
||||
* always in the same order (simulates the behaviour of the original
|
||||
* parser). Works at table constraint level.
|
||||
*
|
||||
* @param array $constraint array with table index definition
|
||||
*
|
||||
* @return bool|error MDB2_OK on success or error object
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function fixTableConstraintKeys($constraint)
|
||||
{
|
||||
$this->constraint = array(
|
||||
|
@ -468,6 +577,18 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
return MDB2_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce the default values for mandatory keys and ensure everything goes
|
||||
* always in the same order (simulates the behaviour of the original
|
||||
* parser). Works at table data level.
|
||||
*
|
||||
* @param array $element multi dimensional array with query definition
|
||||
* @param string $type whether its a insert|update|delete query
|
||||
*
|
||||
* @return bool|error MDB2_OK on success or error object
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function fixTableInitializationKeys($element, $type = '')
|
||||
{
|
||||
if (!empty($element['select']) && is_array($element['select'])) {
|
||||
|
@ -480,6 +601,43 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
$this->table['initialization'][] = array( 'type' => $type, 'data' => $this->init );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce the default values for mandatory keys and ensure everything goes
|
||||
* always in the same order (simulates the behaviour of the original
|
||||
* parser). Works deeper at the table initialization level (data). At this
|
||||
* point we are look at one of the below:
|
||||
*
|
||||
* <insert>
|
||||
* {field}+
|
||||
* </insert>
|
||||
*
|
||||
* <select> (this is a select extracted off a insert-select query)
|
||||
* <table/>
|
||||
* {field}+
|
||||
* <where>
|
||||
* {expression}
|
||||
* </where>?
|
||||
* </select>
|
||||
*
|
||||
* <update>
|
||||
* {field}+
|
||||
* <where>
|
||||
* {expression}
|
||||
* </where>?
|
||||
* </update>
|
||||
*
|
||||
* <delete>
|
||||
* <where>
|
||||
* {expression}
|
||||
* </where>
|
||||
* </delete>
|
||||
*
|
||||
* @param array $element multi dimensional array with query definition
|
||||
*
|
||||
* @return bool|error MDB2_OK on success or error object
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function fixTableInitializationDataKeys($element)
|
||||
{
|
||||
$this->init = array();
|
||||
|
@ -505,6 +663,22 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively diggs into an "expression" element. According to our
|
||||
* documentation an "expression" element is of the kind:
|
||||
*
|
||||
* <expression>
|
||||
* <null/> or <value/> or <column/> or {function} or {expression}
|
||||
* <operator/>
|
||||
* <null/> or <value/> or <column/> or {function} or {expression}
|
||||
* </expression>
|
||||
*
|
||||
* @param array &$arr reference to current element definition
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function setExpression(&$arr)
|
||||
{
|
||||
$element = each($arr);
|
||||
|
@ -555,6 +729,30 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce the default values for mandatory keys and ensure everything goes
|
||||
* always in the same order (simulates the behaviour of the original
|
||||
* parser). Works at database sequences level. A "sequence" element looks
|
||||
* like:
|
||||
*
|
||||
* <sequence>
|
||||
* <name/>
|
||||
* <was/>?
|
||||
* <start/>?
|
||||
* <description/>?
|
||||
* <comments/>?
|
||||
* <on>
|
||||
* <table/>
|
||||
* <field/>
|
||||
* </on>?
|
||||
* </sequence>
|
||||
*
|
||||
* @param array $sequence multi dimensional array with sequence definition
|
||||
*
|
||||
* @return bool|error MDB2_OK on success or error object
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function fixSequenceKeys($sequence)
|
||||
{
|
||||
$this->sequence = array(
|
||||
|
@ -562,7 +760,6 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
'start' => '',
|
||||
'description' => '',
|
||||
'comments' => '',
|
||||
'on' => array('table' => '', 'field' => '')
|
||||
);
|
||||
|
||||
if (!empty($sequence['name'])) {
|
||||
|
@ -610,15 +807,23 @@ class MDB2_Schema_Parser2 extends XML_Unserializer
|
|||
return MDB2_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes a MDB2_Schema_Error into stack and returns it
|
||||
*
|
||||
* @param string $msg textual message
|
||||
* @param int $ecode MDB2_Schema's error code
|
||||
*
|
||||
* @return object
|
||||
* @access private
|
||||
* @static
|
||||
*/
|
||||
function &raiseError($msg = null, $ecode = MDB2_SCHEMA_ERROR_PARSE)
|
||||
{
|
||||
if (is_null($this->error)) {
|
||||
$error = 'Parser error: '.$msg."\n";
|
||||
|
||||
$this->error =& MDB2_Schema::raiseError($ecode, null, null, $error);
|
||||
$this->error = MDB2_Schema::raiseError($ecode, null, null, $error);
|
||||
}
|
||||
return $this->error;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
95
3rdparty/MDB2/Schema/Reserved/ibase.php
vendored
95
3rdparty/MDB2/Schema/Reserved/ibase.php
vendored
|
@ -1,49 +1,51 @@
|
|||
<?php
|
||||
// {{{ Disclaimer, Licence, copyrights
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Lorenzo Alberton <l.alberton@quipo.it> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// }}}
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
* MDB2_Schema enables users to maintain RDBMS independant schema files
|
||||
* in XML that can be used to manipulate both data and database schemas
|
||||
* This LICENSE is in the BSD license style.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
|
||||
* Lukas Smith, Igor Feghali nor the names of his contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
|
||||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Lorenzo Alberton <l.alberton@quipo.it>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
// {{{ $GLOBALS['_MDB2_Schema_Reserved']['ibase']
|
||||
/**
|
||||
* Has a list of reserved words of Interbase/Firebird
|
||||
|
@ -433,4 +435,3 @@ $GLOBALS['_MDB2_Schema_Reserved']['ibase'] = array(
|
|||
'ZONE',
|
||||
);
|
||||
// }}}
|
||||
?>
|
96
3rdparty/MDB2/Schema/Reserved/mssql.php
vendored
96
3rdparty/MDB2/Schema/Reserved/mssql.php
vendored
|
@ -1,48 +1,52 @@
|
|||
<?php
|
||||
// {{{ Disclaimer, Licence, copyrights
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: David Coallier <davidc@php.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
// }}}
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
* MDB2_Schema enables users to maintain RDBMS independant schema files
|
||||
* in XML that can be used to manipulate both data and database schemas
|
||||
* This LICENSE is in the BSD license style.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
|
||||
* Lukas Smith, Igor Feghali nor the names of his contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
|
||||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author David Coallier <davidc@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
// {{{ $GLOBALS['_MDB2_Schema_Reserved']['mssql']
|
||||
/**
|
||||
* Has a list of all the reserved words for mssql.
|
||||
|
@ -254,5 +258,3 @@ $GLOBALS['_MDB2_Schema_Reserved']['mssql'] = array(
|
|||
'SELECT',
|
||||
);
|
||||
//}}}
|
||||
|
||||
?>
|
||||
|
|
97
3rdparty/MDB2/Schema/Reserved/mysql.php
vendored
97
3rdparty/MDB2/Schema/Reserved/mysql.php
vendored
|
@ -1,50 +1,52 @@
|
|||
<?php
|
||||
// {{{ Disclaimer, Licence, copyrights
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: David Coallier <davidc@php.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: mysql.php,v 1.3 2006/03/01 12:16:40 lsmith Exp $
|
||||
// }}}
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
* MDB2_Schema enables users to maintain RDBMS independant schema files
|
||||
* in XML that can be used to manipulate both data and database schemas
|
||||
* This LICENSE is in the BSD license style.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
|
||||
* Lukas Smith, Igor Feghali nor the names of his contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
|
||||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author David Coallier <davidc@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
// {{{ $GLOBALS['_MDB2_Schema_Reserved']['mysql']
|
||||
/**
|
||||
* Has a list of reserved words of mysql
|
||||
|
@ -281,4 +283,3 @@ $GLOBALS['_MDB2_Schema_Reserved']['mysql'] = array(
|
|||
'ZEROFILL',
|
||||
);
|
||||
// }}}
|
||||
?>
|
||||
|
|
96
3rdparty/MDB2/Schema/Reserved/oci8.php
vendored
96
3rdparty/MDB2/Schema/Reserved/oci8.php
vendored
|
@ -1,48 +1,52 @@
|
|||
<?php
|
||||
// {{{ Disclaimer, Licence, copyrights
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: David Coallier <davidc@php.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
// }}}
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
* MDB2_Schema enables users to maintain RDBMS independant schema files
|
||||
* in XML that can be used to manipulate both data and database schemas
|
||||
* This LICENSE is in the BSD license style.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
|
||||
* Lukas Smith, Igor Feghali nor the names of his contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
|
||||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author David Coallier <davidc@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
// {{{ $GLOBALS['_MDB2_Schema_Reserved']['oci8']
|
||||
/**
|
||||
* Has a list of all the reserved words for oracle.
|
||||
|
@ -167,5 +171,3 @@ $GLOBALS['_MDB2_Schema_Reserved']['oci8'] = array(
|
|||
'WITH',
|
||||
);
|
||||
// }}}
|
||||
|
||||
?>
|
||||
|
|
97
3rdparty/MDB2/Schema/Reserved/pgsql.php
vendored
97
3rdparty/MDB2/Schema/Reserved/pgsql.php
vendored
|
@ -1,49 +1,52 @@
|
|||
<?php
|
||||
// {{{ Disclaimer, Licence, copyrights
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP versions 4 and 5 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
|
||||
// | Stig. S. Bakken, Lukas Smith |
|
||||
// | All rights reserved. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
|
||||
// | API as well as database abstraction for PHP applications. |
|
||||
// | This LICENSE is in the BSD license style. |
|
||||
// | |
|
||||
// | Redistribution and use in source and binary forms, with or without |
|
||||
// | modification, are permitted provided that the following conditions |
|
||||
// | are met: |
|
||||
// | |
|
||||
// | Redistributions of source code must retain the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer. |
|
||||
// | |
|
||||
// | Redistributions in binary form must reproduce the above copyright |
|
||||
// | notice, this list of conditions and the following disclaimer in the |
|
||||
// | documentation and/or other materials provided with the distribution. |
|
||||
// | |
|
||||
// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
|
||||
// | Lukas Smith nor the names of his contributors may be used to endorse |
|
||||
// | or promote products derived from this software without specific prior|
|
||||
// | written permission. |
|
||||
// | |
|
||||
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
|
||||
// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
||||
// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
|
||||
// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
// | POSSIBILITY OF SUCH DAMAGE. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Marcelo Santos Araujo <msaraujo@php.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// }}}
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
* MDB2_Schema enables users to maintain RDBMS independant schema files
|
||||
* in XML that can be used to manipulate both data and database schemas
|
||||
* This LICENSE is in the BSD license style.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
|
||||
* Lukas Smith, Igor Feghali nor the names of his contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
|
||||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Marcelo Santos Araujo <msaraujo@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
// {{{ $GLOBALS['_MDB2_Schema_Reserved']['pgsql']
|
||||
/**
|
||||
* Has a list of reserved words of pgsql
|
||||
|
@ -143,5 +146,3 @@ $GLOBALS['_MDB2_Schema_Reserved']['pgsql'] = array(
|
|||
'WHERE'
|
||||
);
|
||||
// }}}
|
||||
?>
|
||||
|
||||
|
|
71
3rdparty/MDB2/Schema/Tool.php
vendored
71
3rdparty/MDB2/Schema/Tool.php
vendored
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -39,14 +37,13 @@
|
|||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Christian Weiske <cweiske@php.net>
|
||||
* $Id: Tool.php,v 1.6 2008/12/13 00:26:07 clockwerx Exp $
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Christian Weiske <cweiske@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version CVS: $Id: Tool.php,v 1.6 2008/12/13 00:26:07 clockwerx Exp $
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
|
@ -152,7 +149,9 @@ class MDB2_Schema_Tool
|
|||
case '--init':
|
||||
return 'init';
|
||||
default:
|
||||
throw new MDB2_Schema_Tool_ParameterException("Unknown mode \"$arg\"");
|
||||
throw new MDB2_Schema_Tool_ParameterException(
|
||||
"Unknown mode \"$arg\""
|
||||
);
|
||||
}
|
||||
}//protected function getAction(&$args)
|
||||
|
||||
|
@ -179,7 +178,8 @@ class MDB2_Schema_Tool
|
|||
*/
|
||||
protected function doHelp()
|
||||
{
|
||||
self::toStdErr(<<<EOH
|
||||
self::toStdErr(
|
||||
<<<EOH
|
||||
Usage: mdb2_schematool mode parameters
|
||||
|
||||
Works with database schemas
|
||||
|
@ -205,7 +205,8 @@ EOH
|
|||
*/
|
||||
protected function doHelpDump()
|
||||
{
|
||||
self::toStdErr( <<<EOH
|
||||
self::toStdErr(
|
||||
<<<EOH
|
||||
Usage: mdb2_schematool dump [all|data|schema] [-p] DSN
|
||||
|
||||
Dumps a database schema to stdout
|
||||
|
@ -216,7 +217,8 @@ DSN: Data source name in the form of
|
|||
driver://user:password@host/database
|
||||
|
||||
User and password may be omitted.
|
||||
Using -p reads password from stdin which is more secure than passing it in the parameter.
|
||||
Using -p reads password from stdin which is more secure than passing it in the
|
||||
parameter.
|
||||
|
||||
EOH
|
||||
);
|
||||
|
@ -231,7 +233,8 @@ EOH
|
|||
*/
|
||||
protected function doHelpInit()
|
||||
{
|
||||
self::toStdErr( <<<EOH
|
||||
self::toStdErr(
|
||||
<<<EOH
|
||||
Usage: mdb2_schematool init source [-p] destination
|
||||
|
||||
Initializes a database with data
|
||||
|
@ -244,7 +247,8 @@ DSN: Data source name in the form of
|
|||
driver://user:password@host/database
|
||||
|
||||
User and password may be omitted.
|
||||
Using -p reads password from stdin which is more secure than passing it in the parameter.
|
||||
Using -p reads password from stdin which is more secure than passing it in the
|
||||
parameter.
|
||||
|
||||
EOH
|
||||
);
|
||||
|
@ -259,7 +263,8 @@ EOH
|
|||
*/
|
||||
protected function doHelpLoad()
|
||||
{
|
||||
self::toStdErr( <<<EOH
|
||||
self::toStdErr(
|
||||
<<<EOH
|
||||
Usage: mdb2_schematool load [-p] source [-p] destination
|
||||
|
||||
Loads a database schema from source to destination
|
||||
|
@ -272,7 +277,8 @@ DSN: Data source name in the form of
|
|||
driver://user:password@host/database
|
||||
|
||||
User and password may be omitted.
|
||||
Using -p reads password from stdin which is more secure than passing it in the parameter.
|
||||
Using -p reads password from stdin which is more secure than passing it in the
|
||||
parameter.
|
||||
|
||||
EOH
|
||||
);
|
||||
|
@ -334,7 +340,9 @@ EOH
|
|||
protected function getFileOrDsn(&$args)
|
||||
{
|
||||
if (count($args) == 0) {
|
||||
throw new MDB2_Schema_Tool_ParameterException('File or DSN expected');
|
||||
throw new MDB2_Schema_Tool_ParameterException(
|
||||
'File or DSN expected'
|
||||
);
|
||||
}
|
||||
|
||||
$arg = array_shift($args);
|
||||
|
@ -450,7 +458,8 @@ EOH
|
|||
list($type, $dsn) = $this->getFileOrDsn($args);
|
||||
if ($type == 'file') {
|
||||
throw new MDB2_Schema_Tool_ParameterException(
|
||||
'Dumping a schema file as a schema file does not make much sense'
|
||||
'Dumping a schema file as a schema file does not make much ' .
|
||||
'sense'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -503,8 +512,14 @@ EOH
|
|||
$definition = $schemaDest->parseDatabaseDefinitionFile($dsnSource);
|
||||
$where = 'loading schema file';
|
||||
} else {
|
||||
$schemaSource = MDB2_Schema::factory($dsnSource, $this->getSchemaOptions());
|
||||
$this->throwExceptionOnError($schemaSource, 'connecting to source database');
|
||||
$schemaSource = MDB2_Schema::factory(
|
||||
$dsnSource,
|
||||
$this->getSchemaOptions()
|
||||
);
|
||||
$this->throwExceptionOnError(
|
||||
$schemaSource,
|
||||
'connecting to source database'
|
||||
);
|
||||
|
||||
$definition = $schemaSource->getDefinitionFromDatabase();
|
||||
$where = 'loading definition from database';
|
||||
|
@ -514,7 +529,11 @@ EOH
|
|||
|
||||
//create destination database from definition
|
||||
$simulate = false;
|
||||
$op = $schemaDest->createDatabase($definition, array(), $simulate);
|
||||
$op = $schemaDest->createDatabase(
|
||||
$definition,
|
||||
array(),
|
||||
$simulate
|
||||
);
|
||||
$this->throwExceptionOnError($op, 'creating the database');
|
||||
}//protected function doLoad($args)
|
||||
|
||||
|
@ -545,10 +564,16 @@ EOH
|
|||
}
|
||||
|
||||
$schemaDest = MDB2_Schema::factory($dsnDest, $this->getSchemaOptions());
|
||||
$this->throwExceptionOnError($schemaDest, 'connecting to destination database');
|
||||
$this->throwExceptionOnError(
|
||||
$schemaDest,
|
||||
'connecting to destination database'
|
||||
);
|
||||
|
||||
$definition = $schemaDest->getDefinitionFromDatabase();
|
||||
$this->throwExceptionOnError($definition, 'loading definition from database');
|
||||
$this->throwExceptionOnError(
|
||||
$definition,
|
||||
'loading definition from database'
|
||||
);
|
||||
|
||||
$op = $schemaDest->writeInitialization($dsnSource, $definition);
|
||||
$this->throwExceptionOnError($op, 'initializing database');
|
||||
|
@ -556,5 +581,3 @@ EOH
|
|||
|
||||
|
||||
}//class MDB2_Schema_Tool
|
||||
|
||||
?>
|
||||
|
|
63
3rdparty/MDB2/Schema/Tool/ParameterException.php
vendored
63
3rdparty/MDB2/Schema/Tool/ParameterException.php
vendored
|
@ -1,6 +1,61 @@
|
|||
<?php
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
* MDB2_Schema enables users to maintain RDBMS independant schema files
|
||||
* in XML that can be used to manipulate both data and database schemas
|
||||
* This LICENSE is in the BSD license style.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
|
||||
* Lukas Smith, Igor Feghali nor the names of his contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
|
||||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Christian Weiske <cweiske@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
/**
|
||||
* To be implemented yet
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Christian Weiske <cweiske@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
class MDB2_Schema_Tool_ParameterException extends Exception
|
||||
{}
|
||||
|
||||
?>
|
||||
{
|
||||
}
|
||||
|
|
264
3rdparty/MDB2/Schema/Validate.php
vendored
264
3rdparty/MDB2/Schema/Validate.php
vendored
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -39,15 +37,14 @@
|
|||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Christian Dickmann <dickmann@php.net>
|
||||
* Author: Igor Feghali <ifeghali@php.net>
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Christian Dickmann <dickmann@php.net>
|
||||
* @author Igor Feghali <ifeghali@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version CVS: $Id: Validate.php,v 1.42 2008/11/30 03:34:00 clockwerx Exp $
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
|
@ -70,11 +67,30 @@ class MDB2_Schema_Validate
|
|||
|
||||
var $force_defaults = true;
|
||||
|
||||
var $max_identifiers_length = null;
|
||||
|
||||
// }}}
|
||||
// {{{ constructor
|
||||
|
||||
function __construct($fail_on_invalid_names = true, $valid_types = array(), $force_defaults = true)
|
||||
{
|
||||
/**
|
||||
* PHP 5 constructor
|
||||
*
|
||||
* @param bool $fail_on_invalid_names array with reserved words per RDBMS
|
||||
* @param array $valid_types information of all valid fields
|
||||
* types
|
||||
* @param bool $force_defaults if true sets a default value to
|
||||
* field when not explicit
|
||||
* @param int $max_identifiers_length maximum allowed size for entities
|
||||
* name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function __construct($fail_on_invalid_names = true, $valid_types = array(),
|
||||
$force_defaults = true, $max_identifiers_length = null
|
||||
) {
|
||||
if (empty($GLOBALS['_MDB2_Schema_Reserved'])) {
|
||||
$GLOBALS['_MDB2_Schema_Reserved'] = array();
|
||||
}
|
||||
|
@ -87,21 +103,49 @@ class MDB2_Schema_Validate
|
|||
} else {
|
||||
$this->fail_on_invalid_names = array();
|
||||
}
|
||||
$this->valid_types = $valid_types;
|
||||
$this->force_defaults = $force_defaults;
|
||||
$this->valid_types = $valid_types;
|
||||
$this->force_defaults = $force_defaults;
|
||||
$this->max_identifiers_length = $max_identifiers_length;
|
||||
}
|
||||
|
||||
function MDB2_Schema_Validate($fail_on_invalid_names = true, $valid_types = array(), $force_defaults = true)
|
||||
{
|
||||
/**
|
||||
* PHP 4 compatible constructor
|
||||
*
|
||||
* @param bool $fail_on_invalid_names array with reserved words per RDBMS
|
||||
* @param array $valid_types information of all valid fields
|
||||
* types
|
||||
* @param bool $force_defaults if true sets a default value to
|
||||
* field when not explicit
|
||||
* @param int $max_identifiers_length maximum allowed size for entities
|
||||
* name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function MDB2_Schema_Validate($fail_on_invalid_names = true, $valid_types = array(),
|
||||
$force_defaults = true, $max_identifiers_length = null
|
||||
) {
|
||||
$this->__construct($fail_on_invalid_names, $valid_types, $force_defaults);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ raiseError()
|
||||
|
||||
/**
|
||||
* Pushes a MDB2_Schema_Error into stack and returns it
|
||||
*
|
||||
* @param int $ecode MDB2_Schema's error code
|
||||
* @param string $msg textual message
|
||||
*
|
||||
* @return object
|
||||
* @access private
|
||||
* @static
|
||||
*/
|
||||
function &raiseError($ecode, $msg = null)
|
||||
{
|
||||
$error =& MDB2_Schema::raiseError($ecode, null, null, $msg);
|
||||
$error = MDB2_Schema::raiseError($ecode, null, null, $msg);
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
@ -176,27 +220,18 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateTable($tables, &$table, $table_name)
|
||||
{
|
||||
/* Have we got a name? */
|
||||
if (!$table_name) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'a table has to have a name');
|
||||
}
|
||||
|
||||
/* Table name duplicated? */
|
||||
if (is_array($tables) && isset($tables[$table_name])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'table "'.$table_name.'" already exists');
|
||||
}
|
||||
|
||||
/* Table name reserved? */
|
||||
if (is_array($this->fail_on_invalid_names)) {
|
||||
$name = strtoupper($table_name);
|
||||
foreach ($this->fail_on_invalid_names as $rdbms) {
|
||||
if (in_array($name, $GLOBALS['_MDB2_Schema_Reserved'][$rdbms])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'table name "'.$table_name.'" is a reserved word in: '.$rdbms);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($table_name, 'table');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* Was */
|
||||
|
@ -289,10 +324,12 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateField($fields, &$field, $field_name)
|
||||
{
|
||||
/* Have we got a name? */
|
||||
if (!$field_name) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'field name missing');
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($field_name, 'field');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* Field name duplicated? */
|
||||
|
@ -301,17 +338,6 @@ class MDB2_Schema_Validate
|
|||
'field "'.$field_name.'" already exists');
|
||||
}
|
||||
|
||||
/* Field name reserverd? */
|
||||
if (is_array($this->fail_on_invalid_names)) {
|
||||
$name = strtoupper($field_name);
|
||||
foreach ($this->fail_on_invalid_names as $rdbms) {
|
||||
if (in_array($name, $GLOBALS['_MDB2_Schema_Reserved'][$rdbms])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'field name "'.$field_name.'" is a reserved word in: '.$rdbms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Type check */
|
||||
if (empty($field['type'])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
|
@ -422,10 +448,14 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateIndex($table_indexes, &$index, $index_name)
|
||||
{
|
||||
if (!$index_name) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'an index has to have a name');
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($index_name, 'index');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (is_array($table_indexes) && isset($table_indexes[$index_name])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'index "'.$index_name.'" already exists');
|
||||
|
@ -470,14 +500,18 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateIndexField($index_fields, &$field, $field_name)
|
||||
{
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($field_name, 'index field');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (is_array($index_fields) && isset($index_fields[$field_name])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'index field "'.$field_name.'" already exists');
|
||||
}
|
||||
if (!$field_name) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'the index-field-name is required');
|
||||
}
|
||||
if (empty($field['sorting'])) {
|
||||
$field['sorting'] = 'ascending';
|
||||
} elseif ($field['sorting'] !== 'ascending' && $field['sorting'] !== 'descending') {
|
||||
|
@ -506,10 +540,14 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateConstraint($table_constraints, &$constraint, $constraint_name)
|
||||
{
|
||||
if (!$constraint_name) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'a foreign key has to have a name');
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($constraint_name, 'foreign key');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (is_array($table_constraints) && isset($table_constraints[$constraint_name])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'foreign key "'.$constraint_name.'" already exists');
|
||||
|
@ -555,10 +593,14 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateConstraintField($constraint_fields, $field_name)
|
||||
{
|
||||
if (!$field_name) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'empty value for foreign-field');
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($field_name, 'foreign key field');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (is_array($constraint_fields) && isset($constraint_fields[$field_name])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'foreign field "'.$field_name.'" already exists');
|
||||
|
@ -582,10 +624,14 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateConstraintReferencedField($referenced_fields, $field_name)
|
||||
{
|
||||
if (!$field_name) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'empty value for referenced foreign-field');
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($field_name, 'referenced foreign field');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (is_array($referenced_fields) && isset($referenced_fields[$field_name])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'foreign field "'.$field_name.'" already referenced');
|
||||
|
@ -612,9 +658,12 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateSequence($sequences, &$sequence, $sequence_name)
|
||||
{
|
||||
if (!$sequence_name) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'a sequence has to have a name');
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($sequence_name, 'sequence');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (is_array($sequences) && isset($sequences[$sequence_name])) {
|
||||
|
@ -661,21 +710,17 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateDatabase(&$database)
|
||||
{
|
||||
/* Have we got a name? */
|
||||
if (!is_array($database) || !isset($database['name']) || !$database['name']) {
|
||||
if (!is_array($database)) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'a database has to have a name');
|
||||
'something wrong went with database definition');
|
||||
}
|
||||
|
||||
/* Database name reserved? */
|
||||
if (is_array($this->fail_on_invalid_names)) {
|
||||
$name = strtoupper($database['name']);
|
||||
foreach ($this->fail_on_invalid_names as $rdbms) {
|
||||
if (in_array($name, $GLOBALS['_MDB2_Schema_Reserved'][$rdbms])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'database name "'.$database['name'].'" is a reserved word in: '.$rdbms);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($database['name'], 'database');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* Create */
|
||||
|
@ -798,9 +843,12 @@ class MDB2_Schema_Validate
|
|||
*/
|
||||
function validateDataField($table_fields, $instruction_fields, &$field)
|
||||
{
|
||||
if (!$field['name']) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
'field-name has to be specified');
|
||||
/**
|
||||
* Valid name ?
|
||||
*/
|
||||
$result = $this->validateIdentifier($field['name'], 'field');
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (is_array($instruction_fields) && isset($instruction_fields[$field['name']])) {
|
||||
|
@ -917,6 +965,62 @@ class MDB2_Schema_Validate
|
|||
}
|
||||
return MDB2_OK;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
// }}}
|
||||
// {{{ validateIdentifier()
|
||||
|
||||
/**
|
||||
* Checks whether a given identifier is valid for current driver.
|
||||
*
|
||||
* @param string $id identifier to check
|
||||
* @param string $type whether identifier represents a table name, index, etc.
|
||||
*
|
||||
* @return bool|error object
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function validateIdentifier($id, $type)
|
||||
{
|
||||
$max_length = $this->max_identifiers_length;
|
||||
$cur_length = strlen($id);
|
||||
|
||||
/**
|
||||
* Have we got a name?
|
||||
*/
|
||||
if (!$id) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
"a $type has to have a name");
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported length ?
|
||||
*/
|
||||
if ($max_length !== null
|
||||
&& $cur_length > $max_length
|
||||
) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
"$type name '$id' is too long for current driver");
|
||||
} elseif ($cur_length > 30) {
|
||||
// FIXME: find a way to issue a warning in MDB2_Schema object
|
||||
/* $this->warnings[] = "$type name '$id' might not be
|
||||
portable to other drivers"; */
|
||||
}
|
||||
|
||||
/**
|
||||
* Reserved ?
|
||||
*/
|
||||
if (is_array($this->fail_on_invalid_names)) {
|
||||
$name = strtoupper($id);
|
||||
foreach ($this->fail_on_invalid_names as $rdbms) {
|
||||
if (in_array($name, $GLOBALS['_MDB2_Schema_Reserved'][$rdbms])) {
|
||||
return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
|
||||
"$type name '$id' is a reserved word in: $rdbms");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return MDB2_OK;
|
||||
}
|
||||
|
||||
// }}}
|
||||
}
|
||||
|
|
57
3rdparty/MDB2/Schema/Writer.php
vendored
57
3rdparty/MDB2/Schema/Writer.php
vendored
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
|
||||
/**
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
|
||||
* Stig. S. Bakken, Lukas Smith, Igor Feghali
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -39,15 +37,14 @@
|
|||
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Lukas Smith <smith@pooteeweet.org>
|
||||
* Author: Igor Feghali <ifeghali@php.net>
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Database
|
||||
* @package MDB2_Schema
|
||||
* @author Lukas Smith <smith@pooteeweet.org>
|
||||
* @author Igor Feghali <ifeghali@php.net>
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version CVS: $Id: Writer.php,v 1.40 2008/11/30 03:34:00 clockwerx Exp $
|
||||
* @version SVN: $Id$
|
||||
* @link http://pear.php.net/packages/MDB2_Schema
|
||||
*/
|
||||
|
||||
|
@ -69,11 +66,33 @@ class MDB2_Schema_Writer
|
|||
// }}}
|
||||
// {{{ constructor
|
||||
|
||||
/**
|
||||
* PHP 5 constructor
|
||||
*
|
||||
* @param array $valid_types information of all valid fields
|
||||
* types
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function __construct($valid_types = array())
|
||||
{
|
||||
$this->valid_types = $valid_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP 4 compatible constructor
|
||||
*
|
||||
* @param array $valid_types information of all valid fields
|
||||
* types
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function MDB2_Schema_Writer($valid_types = array())
|
||||
{
|
||||
$this->__construct($valid_types);
|
||||
|
@ -87,15 +106,18 @@ class MDB2_Schema_Writer
|
|||
* callbacks etc. Basically a wrapper for PEAR::raiseError
|
||||
* without the message string.
|
||||
*
|
||||
* @param int|PEAR_Error $code integer error code or and PEAR_Error instance
|
||||
* @param int $mode error mode, see PEAR_Error docs
|
||||
* error level (E_USER_NOTICE etc). If error mode is
|
||||
* PEAR_ERROR_CALLBACK, this is the callback function,
|
||||
* either as a function name, or as an array of an
|
||||
* object and method name. For other error modes this
|
||||
* parameter is ignored.
|
||||
* @param string $options Extra debug information. Defaults to the last
|
||||
* query and native error code.
|
||||
* @param int|PEAR_Error $code integer error code or and PEAR_Error
|
||||
* instance
|
||||
* @param int $mode error mode, see PEAR_Error docs error
|
||||
* level (E_USER_NOTICE etc). If error mode
|
||||
* is PEAR_ERROR_CALLBACK, this is the
|
||||
* callback function, either as a function
|
||||
* name, or as an array of an object and
|
||||
* method name. For other error modes this
|
||||
* parameter is ignored.
|
||||
* @param string $options Extra debug information. Defaults to the
|
||||
* last query and native error code.
|
||||
* @param string $userinfo User-friendly error message
|
||||
*
|
||||
* @return object a PEAR error object
|
||||
* @access public
|
||||
|
@ -103,7 +125,7 @@ class MDB2_Schema_Writer
|
|||
*/
|
||||
function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
$error =& MDB2_Schema::raiseError($code, $mode, $options, $userinfo);
|
||||
$error = MDB2_Schema::raiseError($code, $mode, $options, $userinfo);
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
@ -578,4 +600,3 @@ class MDB2_Schema_Writer
|
|||
|
||||
// }}}
|
||||
}
|
||||
?>
|
||||
|
|
10
3rdparty/PEAR.php
vendored
10
3rdparty/PEAR.php
vendored
|
@ -247,7 +247,7 @@ class PEAR
|
|||
* @access public
|
||||
* @return bool true if parameter is an error
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
static function isError($data, $code = null)
|
||||
{
|
||||
if (!is_a($data, 'PEAR_Error')) {
|
||||
return false;
|
||||
|
@ -469,7 +469,7 @@ class PEAR
|
|||
* @see PEAR::setErrorHandling
|
||||
* @since PHP 4.0.5
|
||||
*/
|
||||
function &raiseError($message = null,
|
||||
static function &raiseError($message = null,
|
||||
$code = null,
|
||||
$mode = null,
|
||||
$options = null,
|
||||
|
@ -555,11 +555,11 @@ class PEAR
|
|||
function &throwError($message = null, $code = null, $userinfo = null)
|
||||
{
|
||||
if (isset($this) && is_a($this, 'PEAR')) {
|
||||
$a = &$this->raiseError($message, $code, null, null, $userinfo);
|
||||
$a = $this->raiseError($message, $code, null, null, $userinfo);
|
||||
return $a;
|
||||
}
|
||||
|
||||
$a = &PEAR::raiseError($message, $code, null, null, $userinfo);
|
||||
$a = PEAR::raiseError($message, $code, null, null, $userinfo);
|
||||
return $a;
|
||||
}
|
||||
|
||||
|
@ -695,7 +695,7 @@ class PEAR
|
|||
* @param string $ext The extension name
|
||||
* @return bool Success or not on the dl() call
|
||||
*/
|
||||
function loadExtension($ext)
|
||||
static function loadExtension($ext)
|
||||
{
|
||||
if (extension_loaded($ext)) {
|
||||
return true;
|
||||
|
|
2
3rdparty/PEAR/Autoloader.php
vendored
2
3rdparty/PEAR/Autoloader.php
vendored
|
@ -144,7 +144,7 @@ class PEAR_Autoloader extends PEAR
|
|||
$include_file = preg_replace('/[^a-z0-9]/i', '_', $classname);
|
||||
include_once $include_file;
|
||||
}
|
||||
$obj =& new $classname;
|
||||
$obj = new $classname;
|
||||
$methods = get_class_methods($classname);
|
||||
foreach ($methods as $method) {
|
||||
// don't import priviate methods and constructors
|
||||
|
|
6
3rdparty/PEAR/Command.php
vendored
6
3rdparty/PEAR/Command.php
vendored
|
@ -133,8 +133,8 @@ class PEAR_Command
|
|||
$a = PEAR::raiseError("unknown command `$command'");
|
||||
return $a;
|
||||
}
|
||||
$ui =& PEAR_Command::getFrontendObject();
|
||||
$obj = &new $class($ui, $config);
|
||||
$ui = PEAR_Command::getFrontendObject();
|
||||
$obj = new $class($ui, $config);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ class PEAR_Command
|
|||
if (!class_exists($class)) {
|
||||
return PEAR::raiseError("unknown command `$command'");
|
||||
}
|
||||
$ui =& PEAR_Command::getFrontendObject();
|
||||
$ui = PEAR_Command::getFrontendObject();
|
||||
$config = &PEAR_Config::singleton();
|
||||
$obj = &new $class($ui, $config);
|
||||
return $obj;
|
||||
|
|
2
3rdparty/PEAR/Common.php
vendored
2
3rdparty/PEAR/Common.php
vendored
|
@ -168,7 +168,7 @@ class PEAR_Common extends PEAR
|
|||
function PEAR_Common()
|
||||
{
|
||||
parent::PEAR();
|
||||
$this->config = &PEAR_Config::singleton();
|
||||
$this->config = PEAR_Config::singleton();
|
||||
$this->debug = $this->config->get('verbose');
|
||||
}
|
||||
|
||||
|
|
2
3rdparty/PEAR/PackageFile/Generator/v1.php
vendored
2
3rdparty/PEAR/PackageFile/Generator/v1.php
vendored
|
@ -109,7 +109,7 @@ class PEAR_PackageFile_Generator_v1
|
|||
// }}}
|
||||
$packagexml = $this->toPackageFile($where, PEAR_VALIDATE_PACKAGING, 'package.xml', true);
|
||||
if ($packagexml) {
|
||||
$tar =& new Archive_Tar($dest_package, $compress);
|
||||
$tar = new Archive_Tar($dest_package, $compress);
|
||||
$tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
|
||||
// ----- Creates with the package.xml file
|
||||
$ok = $tar->createModify(array($packagexml), '', $where);
|
||||
|
|
2
3rdparty/PEAR/PackageFile/Generator/v2.php
vendored
2
3rdparty/PEAR/PackageFile/Generator/v2.php
vendored
|
@ -269,7 +269,7 @@ http://pear.php.net/dtd/package-2.0.xsd',
|
|||
$name = $pf1 !== null ? 'package2.xml' : 'package.xml';
|
||||
$packagexml = $this->toPackageFile($where, PEAR_VALIDATE_PACKAGING, $name);
|
||||
if ($packagexml) {
|
||||
$tar =& new Archive_Tar($dest_package, $compress);
|
||||
$tar = new Archive_Tar($dest_package, $compress);
|
||||
$tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
|
||||
// ----- Creates with the package.xml file
|
||||
$ok = $tar->createModify(array($packagexml), '', $where);
|
||||
|
|
36
3rdparty/XML/Parser.php
vendored
36
3rdparty/XML/Parser.php
vendored
|
@ -191,26 +191,6 @@ class XML_Parser extends PEAR
|
|||
*/
|
||||
var $_validEncodings = array('ISO-8859-1', 'UTF-8', 'US-ASCII');
|
||||
|
||||
// }}}
|
||||
// {{{ php4 constructor
|
||||
|
||||
/**
|
||||
* Creates an XML parser.
|
||||
*
|
||||
* This is needed for PHP4 compatibility, it will
|
||||
* call the constructor, when a new instance is created.
|
||||
*
|
||||
* @param string $srcenc source charset encoding, use NULL (default) to use
|
||||
* whatever the document specifies
|
||||
* @param string $mode how this parser object should work, "event" for
|
||||
* startelement/endelement-type events, "func"
|
||||
* to have it call functions named after elements
|
||||
* @param string $tgtenc a valid target encoding
|
||||
*/
|
||||
function XML_Parser($srcenc = null, $mode = 'event', $tgtenc = null)
|
||||
{
|
||||
XML_Parser::__construct($srcenc, $mode, $tgtenc);
|
||||
}
|
||||
// }}}
|
||||
// {{{ php5 constructor
|
||||
|
||||
|
@ -364,7 +344,7 @@ class XML_Parser extends PEAR
|
|||
}
|
||||
$this->parser = $xp;
|
||||
$result = $this->_initHandlers($this->mode);
|
||||
if ($this->isError($result)) {
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, $this->folding);
|
||||
|
@ -393,7 +373,7 @@ class XML_Parser extends PEAR
|
|||
function reset()
|
||||
{
|
||||
$result = $this->_create();
|
||||
if ($this->isError($result)) {
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
return true;
|
||||
|
@ -505,7 +485,7 @@ class XML_Parser extends PEAR
|
|||
* reset the parser
|
||||
*/
|
||||
$result = $this->reset();
|
||||
if ($this->isError($result)) {
|
||||
if (PEAR::isError($result)) {
|
||||
return $result;
|
||||
}
|
||||
// if $this->fp was fopened previously
|
||||
|
@ -610,10 +590,16 @@ class XML_Parser extends PEAR
|
|||
*
|
||||
* @return XML_Parser_Error reference to the error object
|
||||
**/
|
||||
function &raiseError($msg = null, $ecode = 0)
|
||||
static function &raiseError($message = null,
|
||||
$code = 0,
|
||||
$mode = null,
|
||||
$options = null,
|
||||
$userinfo = null,
|
||||
$error_class = null,
|
||||
$skipmsg = false)
|
||||
{
|
||||
$msg = !is_null($msg) ? $msg : $this->parser;
|
||||
$err = &new XML_Parser_Error($msg, $ecode);
|
||||
$err = new XML_Parser_Error($msg, $ecode);
|
||||
return parent::raiseError($err);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue