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


PHP adoSchema::setPrefix方法代码示例

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


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

示例1: create_table

function create_table($schemaFile, $prefix, $db, $drop = true)
{
    $result = array();
    $schema = new adoSchema($db);
    $schema->setPrefix($prefix);
    $sql = $schema->ParseSchema($schemaFile);
    $dbTable = $schema->obj;
    $adoDB = $schema->db;
    $stmt = sprintf($adoDB->_dropSeqSQL, $dbTable->name);
    $dropresult = true;
    if ($drop) {
        $ok = $db->Execute($stmt);
        if (!$ok) {
            $dropresult = false;
        }
        $schema = new adoSchema($db);
        $schema->setPrefix($prefix);
        $sql = $schema->ParseSchema($schemaFile);
    }
    $result = $schema->ExecuteSchema($sql);
    ob_start();
    print_r($sql);
    $sql_r = ob_get_contents();
    ob_end_clean();
    return array('result' => $result, 'sql' => $sql_r);
}
开发者ID:umbecr,项目名称:camilaframework,代码行数:26,代码来源:schema.inc.php

示例2: GetTableCreationSQL

/**
 * Generates the SQL commands necessary to create all tables
 * @param string $db_type Database type for which to generate SQL 
 * @return array Array of SQL commands or false if error
 */
function GetTableCreationSQL($db_type, $tbl_prefix)
{
    $db = NewAdoConnection($db_type);
    $schema = new adoSchema($db);
    $schema->setPrefix($tbl_prefix);
    if ($sql = $schema->ParseSchema('create.xml')) {
        return $sql;
    } else {
        return false;
    }
}
开发者ID:guzzisto,项目名称:retrospect-gds,代码行数:16,代码来源:generate_sql.php

示例3: execXML

 /**
  * Using an XML string, build or update a table.
  */
 function execXML($xml, $mode = 'REPLACE')
 {
     global $db, $AppUI;
     include_once DP_BASE_DIR . '/lib/adodb/adodb-xmlschema.inc.php';
     $schema = new adoSchema($db);
     $schema->setUpgradeMode($mode);
     if (isset($this->_table_prefix) && $this->_table_prefix) {
         $schema->setPrefix($this->_table_prefix, false);
     }
     $schema->ContinueOnError(true);
     if (($sql = $scheme->ParseSchemaString($xml)) == false) {
         $AppUI->setMsg(array('Error in XML Schema', 'Error', $db->ErrorMsg()), UI_MSG_ERR);
         return false;
     }
     if ($schema->ExecuteSchema($sql, true)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:magsilva,项目名称:dotproject,代码行数:23,代码来源:query.class.php

示例4: execute_upgrade_file

function execute_upgrade_file($folder, $installed_version)
{
    global $db, $page, $conf;
    // At first the config file
    $upgrade_path = BASEDIR . '/upgrade/' . $folder;
    new ConfUpdater(CONFIG_PATH, $upgrade_path);
    $upgrade_info = parse_ini_file($upgrade_path . '/upgrade.info', true);
    // dev version upgrade?
    if ($folder == Flyspray::base_version($installed_version)) {
        $type = 'develupgrade';
    } else {
        $type = 'defaultupgrade';
    }
    // Next a mix of XML schema files and PHP upgrade scripts
    if (!isset($upgrade_info[$type])) {
        die('#1 Bad upgrade.info file.');
    }
    ksort($upgrade_info[$type]);
    foreach ($upgrade_info[$type] as $file) {
        if (substr($file, -4) == '.php') {
            require_once $upgrade_path . '/' . $file;
        }
        if (substr($file, -4) == '.xml') {
            $schema = new adoSchema($db->dblink);
            $xml = file_get_contents($upgrade_path . '/' . $file);
            // $xml = str_replace('<table name="', '<table name="' . $conf['database']['dbprefix'], $xml);
            // Set the prefix for database objects ( before parsing)
            $schema->setPrefix($conf['database']['dbprefix'], false);
            $schema->ParseSchemaString($xml);
            $schema->ExecuteSchema(null, true);
        }
    }
    // Last but not least global prefs update
    if (isset($upgrade_info['fsprefs'])) {
        $sql = $db->Query('SELECT pref_name FROM {prefs}');
        $existing = $db->FetchCol($sql);
        // Add what is missing
        foreach ($upgrade_info['fsprefs'] as $name => $value) {
            if (!in_array($name, $existing)) {
                $db->Query('INSERT INTO {prefs} (pref_name, pref_value) VALUES (?, ?)', array($name, $value));
            }
        }
        // Delete what is too much
        foreach ($existing as $name) {
            if (!isset($upgrade_info['fsprefs'][$name])) {
                $db->Query('DELETE FROM {prefs} WHERE pref_name = ?', array($name));
            }
        }
    }
    $db->Query('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(basename($upgrade_path), 'fs_ver'));
    #$page->assign('done', true);
    return "Write " . basename($upgrade_path) . " into table {prefs} fs_ver in database";
}
开发者ID:canneverbe,项目名称:flyspray,代码行数:53,代码来源:upgrade.php

示例5: adoSchema

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Retrospect-GDS - Installation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="install.css" rel="stylesheet" type="text/css" />
</head>
<body>
  <h1>Retrospect-GDS Installer</h1>
  
  <h2>Step 4 - Upgrading Tables</h2>
  
  <?php 
# update tables and indexes
$schema = new adoSchema($db);
$schema->setPrefix($g_db_prefix);
$sql = $schema->ParseSchema('upgrade.xml');
$result = $schema->ExecuteSchema($sql);
$error = $db->ErrorMsg();
if ($result != true) {
    die('The following error was encountered while creating the database tables:<br/> ' . $error);
} else {
    echo 'No error were encountered.';
}
?>
 
    
    <h2>Step 5 - Updating Records</h2>

    <?php 
$upgrader = new Upgrader();
开发者ID:guzzisto,项目名称:retrospect-gds,代码行数:31,代码来源:upgrade.php


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