common.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 2,015 行 · 第 1/5 页
PHP
2,015 行
<?php// +----------------------------------------------------------------------+// | PHP Version 4 |// +----------------------------------------------------------------------+// | Copyright (c) 1998-2004 Manuel Lemos, Tomas V.V.Cox, |// | Stig. S. Bakken, Lukas Smith |// | All rights reserved. |// +----------------------------------------------------------------------+// | MDB 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@backendmedia.com> |// +----------------------------------------------------------------------+//// $Id: Common.php,v 1.114.4.22 2004/04/08 19:11:58 lsmith Exp $/** * @package MDB * @author Lukas Smith <smith@backendmedia.com> */// }}}// {{{ MDB_defaultDebugOutput()/** * default debug output handler * * @param object $db reference to an MDB database object * @param string $message message that should be appended to the debug * variable * @return string the corresponding error message, of FALSE * if the error code was unknown * @access public */function MDB_defaultDebugOutput(&$db, $message){ $db->debug_output .= $db->database . " $message" . $db->getOption('log_line_break');}/** * MDB_Common: Base class that is extended by each MDB driver * * @package MDB * @category Database * @author Lukas Smith <smith@backendmedia.com> */class MDB_Common extends PEAR{ // {{{ properties /** * index of the MDB object withing the global $_MDB_databases array * @var integer * @access private */ var $database = 0; /** * @var string * @access private */ var $host = ''; /** * @var string * @access private */ var $port = ''; /** * @var string * @access private */ var $user = ''; /** * @var string * @access private */ var $password = ''; /** * @var string * @access private */ var $database_name = ''; /** * @var array * @access private */ var $supported = array(); /** * $options["persistent"] -> boolean persistent connection true|false? * $options["debug"] -> integer numeric debug level * $options["autofree"] -> boolean * $options["lob_buffer_length"] -> integer LOB buffer length * $options["log_line_break"] -> string line-break format * $options["seqname_format"] -> string pattern for sequence name * $options["includelob"] -> boolean * $options["includemanager"] -> boolean * $options["UseTransactions"] -> boolean * $options["optimize"] -> string 'performance' or 'portability' * @var array * @access private */ var $options = array( 'persistent' => FALSE, 'debug' => FALSE, 'autofree' => FALSE, 'lob_buffer_length' => 8192, 'log_line_break' => "\n", 'seqname_format' => '%s_seq', 'sequence_col_name' => 'sequence', 'includelob' => FALSE, 'includemanager' => FALSE, 'UseTransactions' => FALSE, 'optimize' => 'performance', ); /** * @var string * @access private */ var $escape_quotes = ''; /** * @var integer * @access private */ var $decimal_places = 2; /** * @var string * @access private */ var $manager_included_constant = ''; /** * @var string * @access private */ var $manager_include = ''; /** * @var string * @access private */ var $manager_class_name = ''; /** * @var object * @access private */ var $manager; /** * @var array * @access private */ var $warnings = array(); /** * @var string * @access private */ var $debug = ''; /** * @var string * @access private */ var $debug_output = ''; /** * @var boolean * @access private */ var $pass_debug_handle = FALSE; /** * @var boolean * @access private */ var $auto_commit = TRUE; /** * @var boolean * @access private */ var $in_transaction = FALSE; /** * @var integer * @access private */ var $first_selected_row = 0; /** * @var integer * @access private */ var $selected_row_limit = 0; /** * DB type (mysql, oci8, odbc etc.) * @var string * @access private */ var $type; /** * @var array * @access private */ var $prepared_queries = array(); /** * @var array * @access private */ var $result_types; /** * @var string * @access private */ var $last_query = ''; /** * @var integer * @access private */ var $fetchmode = MDB_FETCHMODE_ORDERED; /** * @var integer * @access private */ var $affected_rows = -1; /** * @var array * @access private */ var $lobs = array(); /** * @var array * @access private */ var $clobs = array(); /** * @var array * @access private */ var $blobs = array(); // }}} // {{{ constructor /** * Constructor */ function MDB_Common() { $database = count($GLOBALS['_MDB_databases']) + 1; $GLOBALS['_MDB_databases'][$database] = &$this; $this->database = $database; $this->PEAR('MDB_Error'); $this->supported = array(); $this->errorcode_map = array(); $this->fetchmode = MDB_FETCHMODE_ORDERED; } // }}} // {{{ __toString() /** * String conversation * * @return string * @access public */ function __toString() { $info = get_class($this); $info .= ': (phptype = ' . $this->phptype . ', dbsyntax = ' . $this->dbsyntax . ')'; if ($this->connection) { $info .= ' [connected]'; } return($info); } // }}} // {{{ errorCode() /** * Map native error codes to MDB's portable ones. Requires that * the DB implementation's constructor fills in the $errorcode_map * property. * * @param mixed $nativecode the native error code, as returned by the * backend database extension (string or integer) * @return int a portable MDB error code, or FALSE if this MDB * implementation has no mapping for the given error code. * @access public */ function errorCode($nativecode) { if (isset($this->errorcode_map[$nativecode])) { return($this->errorcode_map[$nativecode]); } // Fall back to MDB_ERROR if there was no mapping. return(MDB_ERROR); } // }}} // {{{ errorMessage() /** * Map a MDB error code to a textual message. This is actually * just a wrapper for MDB::errorMessage(). * * @param integer $dbcode the MDB error code * @return string the corresponding error message, of FALSE * if the error code was unknown * @access public */ function errorMessage($dbcode) { return(MDB::errorMessage($this->errorcode_map[$dbcode])); } // }}} // {{{ raiseError() /** * This method is used to communicate an error and invoke error * callbacks etc. Basically a wrapper for PEAR::raiseError * without the message string. * * @param mixed $code integer error code, or a PEAR error object (all * other parameters are ignored if this parameter is an object * @param int $mode error mode, see PEAR_Error docs * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the * 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 $userinfo Extra debug information. Defaults to the last * query and native error code. * @param mixed $nativecode Native error code, integer or string depending * the backend. * @return object a PEAR error object * @access public * @see PEAR_Error */ function &raiseError($code = MDB_ERROR, $mode = NULL, $options = NULL, $userinfo = NULL, $nativecode = NULL) { // The error is yet a MDB error object if (is_object($code)) { // because we the static PEAR::raiseError, our global // handler should be used if it is set if ($mode === null && !empty($this->_default_error_mode)) { $mode = $this->_default_error_mode; $options = $this->_default_error_options; } $err = PEAR::raiseError($code, NULL, $mode, $options, NULL, NULL, TRUE); return($err);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?