manager.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 1,313 行 · 第 1/5 页
PHP
1,313 行
<?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: Manager.php,v 1.75.4.4 2004/03/10 14:42:59 lsmith Exp $//require_once('MDB/Parser.php');define('MDB_MANAGER_DUMP_ALL', 0);define('MDB_MANAGER_DUMP_STRUCTURE', 1);define('MDB_MANAGER_DUMP_CONTENT', 2);/** * The database manager is a class that provides a set of database * management services like installing, altering and dumping the data * structures of databases. * * @package MDB * @category Database * @author Lukas Smith <smith@backendmedia.com> */class MDB_Manager extends PEAR{ // {{{ properties var $database; var $options = array( 'fail_on_invalid_names' => 1, 'debug' => 0 ); var $invalid_names = array( 'user' => array(), 'is' => array(), 'file' => array( 'oci' => array(), 'oracle' => array() ), 'notify' => array( 'pgsql' => array() ), 'restrict' => array( 'mysql' => array() ), 'password' => array( 'ibase' => array() ) ); var $default_values = array( 'integer' => 0, 'float' => 0, 'decimal' => 0, 'text' => '', 'timestamp' => '0001-01-01 00:00:00', 'date' => '0001-01-01', 'time' => '00:00:00' ); var $warnings = array(); var $database_definition = array( 'name' => '', 'create' => 0, 'TABLES' => array() ); // }}} // {{{ 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_MANAGER_ERROR, $mode = NULL, $options = NULL, $userinfo = NULL, $nativecode = NULL) { // The error is yet a MDB error object if(is_object($code)) { $err = PEAR::raiseError($code, NULL, NULL, NULL, NULL, NULL, TRUE); return($err); } $err = PEAR::raiseError(NULL, $code, $mode, $options, $userinfo, 'MDB_Error', TRUE); return($err); } // }}} // {{{ captureDebugOutput() /** * set a debug handler * * @param string $capture name of the function that should be used in * debug() * @access public * @see debug() */ function captureDebugOutput($capture) { $this->options['debug'] = $capture; $this->database->captureDebugOutput(1); } // }}} // {{{ debugOutput() /** * output debug info * * @return string content of the debug_output class variable * @access public */ function debugOutput() { return($this->database->debugOutput()); } // }}} // {{{ resetWarnings() /** * reset the warning array * * @access public */ function resetWarnings() { $this->warnings = array(); } // }}} // {{{ getWarnings() /** * get all warnings in reverse order. * This means that the last warning is the first element in the array * * @return array with warnings * @access public * @see resetWarnings() */ function getWarnings() { return array_reverse($this->warnings); } // }}} // {{{ setOption() /** * set the option for the db class * * @param string $option option name * @param mixed $value value for the option * @return mixed MDB_OK or MDB_Error * @access public */ function setOption($option, $value) { if(isset($this->options[$option])) { $this->options[$option] = $value; return(MDB_OK); } return($this->raiseError(MDB_ERROR_UNSUPPORTED, NULL, NULL, "unknown option $option")); } // }}} // {{{ getOption() /** * returns the value of an option * * @param string $option option name * @return mixed the option value or error object * @access public */ function getOption($option) { if(isset($this->options[$option])) { return($this->options[$option]); } return($this->raiseError(MDB_ERROR_UNSUPPORTED, NULL, NULL, "unknown option $option")); } // }}} // {{{ connect() /** * Create a new MDB connection object and connect to the specified * database * * @param mixed $dbinfo 'data source name', see the MDB::parseDSN * method for a description of the dsn format. * Can also be specified as an array of the * format returned by MDB::parseDSN. * Finally you can also pass an existing db * object to be used. * @param mixed $options An associative array of option names and * their values. * @return mixed MDB_OK on success, or a MDB error object * @access public * @see MDB::parseDSN */ function &connect(&$dbinfo, $options = FALSE)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?