当前位置: 首页>>代码示例>>PHP>>正文


PHP MDB::loadFile方法代码示例

本文整理汇总了PHP中MDB::loadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB::loadFile方法的具体用法?PHP MDB::loadFile怎么用?PHP MDB::loadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MDB的用法示例。


在下文中一共展示了MDB::loadFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createTables

 /**
  * Create tables and indexes for the given database type.
  *
  * @throws PhpError
  * @access public
  */
 function createTables()
 {
     MDB::loadFile('Manager');
     $manager =& new MDB_Manager();
     $err = $manager->connect($this->dbConn);
     if (MDB::isError($err)) {
         return $err;
     }
     $filename = dirname(__FILE__) . '/database_schema.xml';
     $err = $manager->updateDatabase($filename, $filename . '.old', array('database' => $this->dbConn->database_name));
     if (MDB::isError($err)) {
         return $err;
     }
     $dsn = $this->dbConn->getDSN();
     if (isset($dsn['phptype']) && $dsn['phptype'] == 'mysql') {
         $this->dbConn->query('CREATE INDEX s_mod_idx ON statements (modelID)');
         $sql = 'CREATE INDEX s_sub_pred_idx ON statements (subject(200),predicate(200))';
         $this->dbConn->query($sql);
         $this->dbConn->query('CREATE INDEX s_obj_idx ON statements (object(250))');
     }
     return true;
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:28,代码来源:MDB.php

示例2: date_time_string

<?php

# $Id$
require_once "grab_globals.inc.php";
include "config.inc.php";
include "functions.inc";
require_once "database.inc.php";
MDB::loadFile("Date");
include "{$dbsys}.inc";
function date_time_string($t)
{
    global $twentyfourhour_format;
    if ($twentyfourhour_format) {
        $timeformat = "%H:%M:%S";
    } else {
        # This bit's necessary, because it seems %p in strftime format
        # strings doesn't work
        $ampm = utf8_date("a", $t);
        $timeformat = "%I:%M:%S{$ampm}";
    }
    return utf8_strftime("%A %d %B %Y " . $timeformat, $t);
}
# Convert a start time and end time to a plain language description.
# This is similar but different from the way it is done in view_entry.
function describe_span($starts, $ends)
{
    global $twentyfourhour_format;
    $start_date = utf8_strftime('%A %d %B %Y', $starts);
    if ($twentyfourhour_format) {
        $timeformat = "%H:%M:%S";
    } else {
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:31,代码来源:report.php

示例3: array

// Set $db_create to 0 to NOT create the database.
$db_create = 1;
// Communication protocol tu use. For pgsql, you can use 'unix' instead of
// 'tcp' to use Unix Domain Sockets instead of TCP/IP.
$db_protocol = "tcp";
/**************************
* DBMS specific options
***************************/
//****ORACLE*****
// Home directory path where Oracle is installed if it is running in the local machine.
// Default value: value of the environment variable ORACLE_HOME
$oci8_home = "";
/**************************
* End of database settings
***************************/
include_once "MDB.php";
MDB::loadFile("Manager");
$schema_file = "mrbs.schema.xml";
$variables = array("database_name" => $db_database, "database_create" => $db_create);
$dsn = array("phptype" => $dbsys, "username" => $db_login, "password" => $db_password, "hostspec" => $db_host, "protocol" => $db_protocol, "port" => $db_port);
$options = array("HOME" => $oci8_home, "optimize" => 'portability');
$manager = new MDB_manager();
$manager->connect($dsn, $options);
$success = $manager->updateDatabase($schema_file, $schema_file . ".before", $variables);
if (MDB::isError($success)) {
    echo "Error: " . $success->getMessage() . "<BR>";
    echo "Error: " . $success->getUserInfo() . "<BR>";
}
if (count($manager->warnings) > 0) {
    echo "WARNING:<BR>", implode($manager->getWarnings(), "!\n"), "\n";
}
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:31,代码来源:mrbs_create.php

示例4:

//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
/**
 * MDB container for Authentication
 *
 * @package  LiveUser
 * @category authentication
 */
/**
 * Require parent class definition and PEAR::MDB class.
 */
require_once 'LiveUser/Auth/Common.php';
require_once 'MDB.php';
MDB::loadFile('Date');
/**
 * Class LiveUser_Auth_Container_MDB
 *
 * Description:
 * This is a PEAR::MDB backend driver for the LiveUser class.
 * A PEAR::MDB connection object can be passed to the constructor to reuse an
 * existing connection. Alternatively, a DSN can be passed to open a new one.
 *
 * Requirements:
 * - File "LoginManager.php" (contains the parent class "LiveUser")
 * - Array of connection options or a PEAR::MDB connection object must be
 *   passed to the constructor.
 *   Example: array('dsn'                   => 'mysql://user:pass@host/db_name',
 *                  'connection             => &$conn, # PEAR::MDB connection object
 *                  'loginTimeout'          => 0,
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:31,代码来源:MDB.php

示例5: define

//
// MDB test script.
//
// BC hack to define PATH_SEPARATOR for version of PHP prior 4.3
if (!defined('PATH_SEPARATOR')) {
    if (defined('DIRECTORY_SEPARATOR') && DIRECTORY_SEPARATOR == "\\") {
        define('PATH_SEPARATOR', ';');
    } else {
        define('PATH_SEPARATOR', ':');
    }
}
ini_set('include_path', '..' . PATH_SEPARATOR . ini_get('include_path'));
// MDB.php doesnt have to be included since manager.php does that
// manager.php is only necessary for handling xml schema files
require_once 'MDB.php';
MDB::loadFile('Manager');
// only including this to output result data
require_once 'Var_Dump.php';
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handle_pear_error');
function handle_pear_error($error_obj)
{
    print '<pre><b>PEAR-Error</b><br />';
    echo $error_obj->getMessage() . ': ' . $error_obj->getUserinfo();
    print '</pre>';
}
// just for kicks you can mess up this part to see some pear error handling
$user = 'metapear';
$pass = 'funky';
//$pass = '';
$host = 'localhost';
$db_name = 'metapear_test_db';
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:31,代码来源:MDB_test.php

示例6: Output

// | 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: Manuel Lemos <mlemos@acm.org>                                |
// +----------------------------------------------------------------------+
//
// $Id: setup_test.php,v 1.10.4.1 2004/01/08 13:43:00 lsmith Exp $
//
require 'MDB.php';
MDB::loadFile('Manager');
MDB::loadFile('metabase_wrapper');
/**
 * Part of Metabase test suite
 *
 * @package MDB
 * @category Database
 * @author  Manuel Lemos <mlemos@acm.org>>
 */
function Output($message)
{
    echo $message, "\n";
}
function Dump($output)
{
    echo $output;
}
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:31,代码来源:setup_test.php

示例7: define

// $Id: MDB_pear_wrapper_test.php,v 1.21 2003/01/18 21:35:19 lsmith Exp $
//
// MDB test script for the PEAR DB Wrapper.
//
// BC hack to define PATH_SEPARATOR for version of PHP prior 4.3
if (!defined('PATH_SEPARATOR')) {
    if (defined('DIRECTORY_SEPARATOR') && DIRECTORY_SEPARATOR == "\\") {
        define('PATH_SEPARATOR', ';');
    } else {
        define('PATH_SEPARATOR', ':');
    }
}
ini_set('include_path', '..' . PATH_SEPARATOR . ini_get('include_path'));
require_once 'MDB.php';
MDB::loadFile('peardb_wrapper');
require_once 'Var_Dump.php';
// just for kicks you can mess up this part to see some pear error handling
$user = 'metapear';
$pass = 'funky';
//$pass = '';
$host = 'localhost';
$db_name = 'metapear_test_db';
// Data Source Name: This is the universal connection string
$dsn = "mysql://{$user}:{$pass}@{$host}/{$db_name}";
// MDB::connect will return a Pear DB object on success
// or a Pear DB Error object on error
// You can also set to TRUE the second param
// if you want a persistent connection:
// $db = DB::connect($dsn, TRUE);
$db =& DB::connect($dsn);
开发者ID:laiello,项目名称:coopcrucial,代码行数:30,代码来源:MDB_pear_wrapper_test.php


注:本文中的MDB::loadFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。