Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/dml/database_column_info.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 
00028 defined('MOODLE_INTERNAL') || die();
00029 
00034 class database_column_info {
00038     public $name;
00039 
00044     public $type;
00045 
00055     public $max_length;
00056 
00062     public $scale;
00063 
00071     public $enums;
00072 
00076     public $not_null;
00077 
00082     public $primary_key;
00083 
00088     public $auto_increment;
00089 
00093     public $binary;
00094 
00099     public $unsigned;
00100 
00104     public $has_default;
00105 
00109     public $default_value;
00110 
00114     public $unique;
00115 
00128     public $meta_type;
00129 
00134     public function __construct($data) {
00135         foreach ($data as $key=>$value) {
00136             if (property_exists($this, $key)) {
00137                 $this->$key = $value;
00138             }
00139         }
00140 
00141         switch ($this->meta_type) {
00142             case 'R': // normalise counters (usually 'id')
00143                 $this->auto_increment = true;
00144                 $this->binary         = false;
00145                 $this->has_default    = false;
00146                 $this->default_value  = null;
00147                 $this->unique         = true;
00148                 break;
00149             case 'C':
00150                 $this->auto_increment = false;
00151                 $this->binary         = false;
00152                 break;
00153         }
00154     }
00155 }
 All Data Structures Namespaces Files Functions Variables Enumerations