Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/ddllib.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00018 
00044 defined('MOODLE_INTERNAL') || die();
00045 
00046 // Add required library
00047 require_once($CFG->libdir.'/xmlize.php');
00048 
00049 // Add required XMLDB constants
00050 require_once($CFG->libdir.'/xmldb/xmldb_constants.php');
00051 
00052 // Add required XMLDB DB classes
00053 require_once($CFG->libdir.'/xmldb/xmldb_object.php');
00054 // Add required XMLDB DB classes
00055 require_once($CFG->libdir.'/xmldb/xmldb_file.php');
00056 // Add required XMLDB DB classes
00057 require_once($CFG->libdir.'/xmldb/xmldb_structure.php');
00058 // Add required XMLDB DB classes
00059 require_once($CFG->libdir.'/xmldb/xmldb_table.php');
00060 // Add required XMLDB DB classes
00061 require_once($CFG->libdir.'/xmldb/xmldb_field.php');
00062 // Add required XMLDB DB classes
00063 require_once($CFG->libdir.'/xmldb/xmldb_key.php');
00064 // Add required XMLDB DB classes
00065 require_once($CFG->libdir.'/xmldb/xmldb_index.php');
00066 
00067 require_once($CFG->libdir.'/ddl/sql_generator.php');
00068 require_once($CFG->libdir.'/ddl/database_manager.php');
00069 
00070 
00071 
00075 class ddl_exception extends moodle_exception {
00080     function __construct($errorcode, $a=NULL, $debuginfo=null) {
00081         parent::__construct($errorcode, '', '', $a, $debuginfo);
00082     }
00083 }
00084 
00088 class ddl_table_missing_exception extends ddl_exception {
00093     function __construct($tablename, $debuginfo=null) {
00094         parent::__construct('ddltablenotexist', $tablename, $debuginfo);
00095     }
00096 }
00097 
00101 class ddl_field_missing_exception extends ddl_exception {
00107     function __construct($fieldname, $tablename, $debuginfo=null) {
00108         $a = new stdClass();
00109         $a->fieldname = $fieldname;
00110         $a->tablename = $tablename;
00111         parent::__construct('ddlfieldnotexist', $a, $debuginfo);
00112     }
00113 }
00114 
00118 class ddl_change_structure_exception extends ddl_exception {
00120     public $error;
00121     public $sql;
00126     function __construct($error, $sql=null) {
00127         $this->error = $error;
00128         $this->sql   = $sql;
00129         $errorinfo   = $error."\n".$sql;
00130         parent::__construct('ddlexecuteerror', NULL, $errorinfo);
00131     }
00132 }
00133 
00138 class ddl_dependency_exception extends ddl_exception {
00139 
00140     function __construct($targettype, $targetname, $offendingtype, $offendingname, $debuginfo=null) {
00141         $a = new stdClass();
00142         $a->targettype = $targettype;
00143         $a->targetname = $targetname;
00144         $a->offendingtype = $offendingtype;
00145         $a->offendingname = $offendingname;
00146 
00147         parent::__construct('ddldependencyerror', $a, $debuginfo);
00148     }
00149 }
 All Data Structures Namespaces Files Functions Variables Enumerations