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


PHP adoSchema::ExecuteSchema方法代码示例

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


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

function adodb_session_create_table($schemaFile = null, $conn = null)
{
    // set default values
    if ($schemaFile === null) {
        $schemaFile = ADODB_SESSION . '/session_schema.xml';
    }
    if ($conn === null) {
        $conn =& ADODB_Session::_conn();
    }
    if (!$conn) {
        return 0;
    }
    $schema = new adoSchema($conn);
    $schema->ParseSchema($schemaFile);
    return $schema->ExecuteSchema();
}
开发者ID:amjadtbssm,项目名称:website,代码行数:16,代码来源:adodb-session.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: createTables

 function createTables($schemaFile, $dbHostName = false, $userName = false, $userPassword = false, $dbName = false, $dbType = false)
 {
     $this->println("ADODB createTables " . $schemaFile);
     if ($dbHostName != false) {
         $this->dbHostName = $dbHostName;
     }
     if ($userName != false) {
         $this->userName = $userPassword;
     }
     if ($userPassword != false) {
         $this->userPassword = $userPassword;
     }
     if ($dbName != false) {
         $this->dbName = $dbName;
     }
     if ($dbType != false) {
         $this->dbType = $dbType;
     }
     $this->checkConnection();
     $db = $this->database;
     $schema = new adoSchema($db);
     //Debug Adodb XML Schema
     $schema->XMLS_DEBUG = TRUE;
     //Debug Adodb
     $schema->debug = true;
     $sql = $schema->ParseSchema($schemaFile);
     $this->println("--------------Starting the table creation------------------");
     $result = $schema->ExecuteSchema($sql, $this->continueInstallOnError);
     if ($result) {
         print $db->errorMsg();
     }
     // needs to return in a decent way
     $this->println("ADODB createTables " . $schemaFile . " status=" . $result);
     return $result;
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:35,代码来源:PearDatabase.php

示例5: domains

                // add the default domain to the system
                // This is a manual add with hard coded values for timers.
                $xmldefdomain = <<<EOL
<?xml version="1.0"?>
<schema version="0.3">
<sql>
    <query>INSERT INTO domains (id,name,admin_email,default_ttl,refresh,retry,expiry,minimum) VALUES (1,'{$default_domain}','hostmaster', 86400, 86400, 3600, 3600, 3600)</query>
    <query>UPDATE sys_config SET value='{$default_domain}' WHERE name like 'dns_defaultdomain'</query>
</sql>
</schema>
EOL;
                $schema = new adoSchema($db);
                // Build the SQL array from the schema XML file
                $domainsql = $schema->ParseSchemaString($xmldefdomain);
                // Execute the SQL on the database
                if ($schema->ExecuteSchema($domainsql) == 2) {
                    $text .= "<img src=\"{$images}/silk/accept.png\" border=\"0\" /> Created default DNS domain '{$default_domain}'.<br>";
                } else {
                    $status++;
                    $text .= "<img src=\"{$images}/silk/exclamation.png\" border=\"0\" /> Failed to create default DNS domain '{$default_domain}'.<br><span style='font-size: xx-small;'>" . $db->ErrorMsg() . "</span><br>";
                }
                // Open the database config and write the contents to it.
                if (!($fh = @fopen($dbconffile, 'w'))) {
                    $status++;
                    $text .= "<img src=\"{$images}/silk/exclamation.png\" border=\"0\" /> Failed to open config file for writing: '{$dbconffile}'.<br>";
                } else {
                    fwrite($fh, "<?php\n\n\$ona_contexts=" . var_export($ona_contexts, TRUE) . ";\n\n?>");
                    fclose($fh);
                    $text .= "<img src=\"{$images}/silk/accept.png\" border=\"0\" /> Created database connection config file.<br>";
                }
                // Update the version element in the sys_config table
开发者ID:edt82,项目名称:ona,代码行数:31,代码来源:install.php

示例6: 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

示例7: execute

 /**
  * Parse an XML database file and output the corresponding SQL statements.
  * See lib/pkp/dtd/xmlSchema.dtd for the format of the XML files.
  */
 function execute()
 {
     require_once './lib/pkp/lib/adodb/adodb-xmlschema.inc.php';
     if (in_array($this->command, array('print', 'save'))) {
         // Don't connect to actual database (so parser won't build upgrade XML)
         $conn = new DBConnection(Config::getVar('database', 'driver'), null, null, null, null, true, Config::getVar('i18n', 'connection_charset'));
         $dbconn = $conn->getDBConn();
     } else {
         // Create or upgrade existing database
         $dbconn =& DBConnection::getConn();
     }
     $schema = new adoSchema($dbconn);
     $dict =& $schema->dict;
     $dict->SetCharSet(Config::getVar('i18n', 'database_charset'));
     if ($this->type == 'schema') {
         // Parse XML schema files
         $sql = $schema->parseSchema($this->inputFile);
         switch ($this->command) {
             case 'execute':
                 $schema->ExecuteSchema();
                 break;
             case 'save':
             case 'save_upgrade':
                 $schema->SaveSQL($this->outputFile);
                 break;
             case 'print':
             case 'print_upgrade':
             default:
                 echo @$schema->PrintSQL('TEXT') . "\n";
                 break;
         }
     } else {
         if ($this->type == 'data') {
             // Parse XML data files
             $dataXMLParser = new DBDataXMLParser();
             $dataXMLParser->setDBConn($dbconn);
             $sql = $dataXMLParser->parseData($this->inputFile);
             switch ($this->command) {
                 case 'execute':
                     $schema->addSQL($sql);
                     $schema->ExecuteSchema();
                     break;
                 case 'save':
                 case 'save_upgrade':
                     $schema->addSQL($sql);
                     $schema->SaveSQL($this->outputFile);
                     break;
                 case 'print':
                 case 'print_upgrade':
                 default:
                     $schema->addSQL($sql);
                     echo @$schema->PrintSQL('TEXT') . "\n";
                     break;
             }
             $schema->destroy();
             $dataXMLParser->destroy();
         }
     }
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:63,代码来源:XmlToSqlTool.inc.php

示例8: adoSchema

// Create the schema object and build the query array.
$schema = new adoSchema($db);
$schema->SetPrefix($db_table_prefix);
// Build the SQL array
$schema->ParseSchema('schema.xml');
// maybe display this if $gacl->debug is true?
if ($gacl->_debug) {
    print "Here's the SQL to do the build:<br />\n<code>";
    print $schema->getSQL('html');
    print "</code>\n";
    // exit;
}
// Execute the SQL on the database
#ADODB's xmlschema is being lame, continue on error.
$schema->ContinueOnError(TRUE);
$result = $schema->ExecuteSchema();
if ($result != 2) {
    echo_failed('Failed creating tables. Please enable DEBUG mode (set it to TRUE in $gacl_options near top of admin/gacl_admin.inc.php) to see the error and try again. You will most likely need to delete any tables already created.');
}
if ($failed <= 0) {
    echo_success('
Installation Successful!!!
<div align="center">
<font color="red"><b>*IMPORTANT*</b></font><br/>
<p>Please make sure you create the <b>&lt;phpGACL root&gt;/admin/templates_c</b> directory,
and give it <b>write permissions</b> for the user your web server runs as.</p>
<p>Please read the manual, and example.php to familiarize yourself with phpGACL.</p>
<a href="admin/about.php?first_run=1"><b>Let\'s get started!</b></a>
</div>
');
} else {
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:setup.php

示例9: adoSchema

   // To create a schema object and build the query array.
   $schema = new adoSchema($db);
   // To upgrade an existing schema object, use the following
   // To upgrade an existing database to the provided schema,
   // uncomment the following line:
   #$schema->upgradeSchema();
   print "<b>SQL to build xmlschema.xml</b>:\n<pre>";
   // Build the SQL array
   $sql = $schema->ParseSchema("xmlschema.xml");
   print_r($sql);
   print "</pre>\n";
   // Execute the SQL on the database
   $db->debug = true;
   if ($_POST['create_test']) {
       print "<pre><hr>\n";
       $result = $schema->ExecuteSchema($sql);
       print "</pre>\n";
   }
   // Finally, clean up after the XML parser
   // (PHP won't do this for you!)
   //$schema->Destroy();
   print "<pre><hr>\n";
   foreach ($sql as $s) {
       echo "\$db2->Execute(\"{$s}\");<br><br>";
   }
   print "</pre>\n";
   ?>
   </td>
 </tr>
  <tr>
   <td colspan="2" valign="top"><p align="center"><br>
开发者ID:briandodson,项目名称:bdcms,代码行数:31,代码来源:test_datadictionary.php

示例10: setupDDBB

 function setupDDBB()
 {
     require_once $this->adodb_path . '/adodb.inc.php';
     require_once $this->adodb_path . '/adodb-xmlschema.inc.php';
     $bol_error = true;
     $int = 1;
     do {
         $SGBDs = $this->getAllSGBD();
         $select = $this->cli->prompt(agt('ddbbSGBD'), $SGBDs);
         $platform = $SGBDs[$select];
         $dbHost = $this->cli->prompt(agt('ddbbHost') . ': ');
         $dbUser = $this->cli->prompt(agt('ddbbUser') . ': ');
         $dbPassword = $this->cli->prompt(agt('ddbbPasswd') . ': ');
         $dbName = $this->cli->prompt(agt('ddbbName') . ': ');
         $db = ADONewConnection($platform);
         $db->Connect($dbHost, $dbUser, $dbPassword, $dbName);
         if (is_resource($db->_connectionID)) {
             $this->log(agt('ddbbConnOk'), 'success');
             $bol_error = false;
             break;
         } else {
             $this->log(agt('ddbbConnErr'), 'error');
         }
         $int++;
     } while ($int < 4);
     if ($bol_error) {
         return false;
     }
     $allDDBB = $db->MetaDatabases();
     if (!empty($allDDBB)) {
         if (in_array($dbName, $allDDBB)) {
             $this->log(agt('ddbbNameOk'), 'success');
         } else {
             $this->log(agt('ddbbNameErr'), 'warning');
             $this->log(agt('ddbbCreate'), 'warning');
             if (!$db->Execute("create database {$dbName}")) {
                 $this->cli->fatal(agt('ddbbCreateErr'));
             } else {
                 $this->log(agt('ddbbCreateOk'), 'success');
                 //Reconectamos
                 $db->Connect($dbHost, $dbUser, $dbPassword, $dbName);
             }
         }
     }
     $schemaFile = $this->miguel_path . '/' . $this->miguel_name . '/modules/common/include/miguel_schema.xml';
     if (file_exists($schemaFile)) {
         //Preparamos el proceso de creación de la BBDD
         $schema = new adoSchema($db);
         $sql = $schema->ParseSchema($schemaFile);
         $result = $schema->ExecuteSchema($sql, true);
         if ($result != 2) {
             $this->cli->fatal(agt('ddbbTableErr'));
         }
         $this->log(agt('ddbbTableOk'), 'success');
     } else {
         $this->cli->fatal(agt('fsErr'));
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:migueloo,代码行数:59,代码来源:setup_cli.class.php

示例11: createTables

 function createTables($schemaFile, $dbHostName = false, $userName = false, $userPassword = false, $dbName = false, $dbType = false)
 {
     $this->println("ADODB createTables " . $schemaFile);
     if ($dbHostName != false) {
         $this->dbHostName = $dbHostName;
     }
     if ($userName != false) {
         $this->userName = $userPassword;
     }
     if ($userPassword != false) {
         $this->userPassword = $userPassword;
     }
     if ($dbName != false) {
         $this->dbName = $dbName;
     }
     if ($dbType != false) {
         $this->dbType = $dbType;
     }
     //$db = ADONewConnection($this->dbType);
     $this->checkConnection();
     $db = $this->database;
     //$db->debug = true;
     //$this->println("ADODB createTables connect status=".$db->Connect($this->dbHostName, $this->userName, $this->userPassword, $this->dbName));
     $schema = new adoSchema($db);
     //Debug Adodb XML Schema
     $sehema->XMLS_DEBUG = TRUE;
     //Debug Adodb
     $sehema->debug = true;
     $sql = $schema->ParseSchema($schemaFile);
     $this->println("--------------Starting the table creation------------------");
     //$this->println($sql);
     //integer ExecuteSchema ([array $sqlArray = NULL], [boolean $continueOnErr = NULL])
     $result = $schema->ExecuteSchema($sql, $this->continueInstallOnError);
     //if($result) print $db->errorMsg();
     $this->println("ADODB createTables error: " . $db->errorMsg());
     // needs to return in a decent way
     $this->println("ADODB createTables " . $schemaFile . " status=" . $result);
     return $result;
 }
开发者ID:honj51,项目名称:taobaocrm,代码行数:39,代码来源:PearDatabase.php

示例12: strtolower

 function _upgrade_database($table_prefix)
 {
     $dbcon = AMP_Registry::getDbcon();
     $table_names = $dbcon->MetaTables();
     $target_table = strtolower($table_prefix . 'phpgacl');
     if (array_search($target_table, $table_names) !== FALSE) {
         return true;
     }
     require_once 'adodb/adodb-xmlschema.inc.php';
     $schema = new adoSchema($dbcon);
     $schema->SetPrefix($table_prefix, FALSE);
     $schema->ParseSchema(AMP_BASE_INCLUDE_PATH . 'phpgacl/schema.xml');
     $schema->ContinueOnError(TRUE);
     $result = $schema->ExecuteSchema();
     if ($result == 2) {
         $this->message('Database upgraded successfully');
     } else {
         $this->error('Database upgrade failed');
     }
 }
开发者ID:radicalsuz,项目名称:amp,代码行数:20,代码来源:Controller.php


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