ContinueOnError() 공개 메소드

Call this method to enable or disable continuation of SQL execution if an error occurs. If the mode is set to TRUE (continue), AXMLS will continue to apply SQL to the database, even if an error occurs. If the mode is set to FALSE (halt), AXMLS will halt execution of generated sql if an error occurs, though parsing of the schema will continue.
public ContinueOnError ( boolean $mode = NULL ) : boolean
$mode boolean execute
리턴 boolean current continueOnError mode
예제 #1
0
 */
// 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>
');
예제 #2
0
 /**
  * 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
0
 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');
     }
 }