本文整理匯總了PHP中adoSchema::ContinueOnError方法的典型用法代碼示例。如果您正苦於以下問題:PHP adoSchema::ContinueOnError方法的具體用法?PHP adoSchema::ContinueOnError怎麽用?PHP adoSchema::ContinueOnError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類adoSchema
的用法示例。
在下文中一共展示了adoSchema::ContinueOnError方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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><phpGACL root>/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>
');
示例2: 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;
}
}
示例3: 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');
}
}