48require_once 
'MDB2/Driver/Reverse/Common.php';
 
   66        MYSQLI_NOT_NULL_FLAG        => 
'not_null',
 
   67        MYSQLI_PRI_KEY_FLAG         => 
'primary_key',
 
   68        MYSQLI_UNIQUE_KEY_FLAG      => 
'unique_key',
 
   69        MYSQLI_MULTIPLE_KEY_FLAG    => 
'multiple_key',
 
   70        MYSQLI_BLOB_FLAG            => 
'blob',
 
   71        MYSQLI_UNSIGNED_FLAG        => 
'unsigned',
 
   72        MYSQLI_ZEROFILL_FLAG        => 
'zerofill',
 
   73        MYSQLI_AUTO_INCREMENT_FLAG  => 
'auto_increment',
 
   74        MYSQLI_TIMESTAMP_FLAG       => 
'timestamp',
 
   75        MYSQLI_SET_FLAG             => 
'set',
 
   78        MYSQLI_GROUP_FLAG           => 
'group_by' 
   87        MYSQLI_TYPE_DECIMAL     => 
'decimal',
 
   89        MYSQLI_TYPE_TINY        => 
'tinyint',
 
   90        MYSQLI_TYPE_SHORT       => 
'int',
 
   91        MYSQLI_TYPE_LONG        => 
'int',
 
   92        MYSQLI_TYPE_FLOAT       => 
'float',
 
   93        MYSQLI_TYPE_DOUBLE      => 
'double',
 
   95        MYSQLI_TYPE_TIMESTAMP   => 
'timestamp',
 
   96        MYSQLI_TYPE_LONGLONG    => 
'bigint',
 
   97        MYSQLI_TYPE_INT24       => 
'mediumint',
 
   98        MYSQLI_TYPE_DATE        => 
'date',
 
   99        MYSQLI_TYPE_TIME        => 
'time',
 
  100        MYSQLI_TYPE_DATETIME    => 
'datetime',
 
  101        MYSQLI_TYPE_YEAR        => 
'year',
 
  102        MYSQLI_TYPE_NEWDATE     => 
'date',
 
  103        MYSQLI_TYPE_ENUM        => 
'enum',
 
  104        MYSQLI_TYPE_SET         => 
'set',
 
  105        MYSQLI_TYPE_TINY_BLOB   => 
'tinyblob',
 
  106        MYSQLI_TYPE_MEDIUM_BLOB => 
'mediumblob',
 
  107        MYSQLI_TYPE_LONG_BLOB   => 
'longblob',
 
  108        MYSQLI_TYPE_BLOB        => 
'blob',
 
  109        MYSQLI_TYPE_VAR_STRING  => 
'varchar',
 
  110        MYSQLI_TYPE_STRING      => 
'char',
 
  111        MYSQLI_TYPE_GEOMETRY    => 
'geometry',
 
  131        $result = $db->loadModule(
'Datatype', 
null, 
true);
 
  136        $query = 
"SHOW COLUMNS FROM $table LIKE ".$db->quote($field_name);
 
  146                if ($db->options[
'field_case'] == CASE_LOWER) {
 
  152                $column = array_change_key_case(
$column, $db->options[
'field_case']);
 
  154            if ($field_name == 
$column[
'name']) {
 
  155                $mapped_datatype = $db->datatype->mapNativeDatatype(
$column);
 
  156                if (PEAR::IsError($mapped_datatype)) {
 
  157                    return $mapped_datatype;
 
  159                list(
$types, $length, $unsigned, $fixed) = $mapped_datatype;
 
  165                if (array_key_exists(
'default', 
$column)) {
 
  167                    if (is_null($default) && $notnull) {
 
  171                $autoincrement = 
false;
 
  172                if (!empty(
$column[
'extra']) && 
$column[
'extra'] == 
'auto_increment') {
 
  173                    $autoincrement = 
true;
 
  176                $definition[0] = array(
 
  177                    'notnull' => $notnull,
 
  178                    'nativetype' => preg_replace(
'/^([a-z]+)[^a-z].*/i', 
'\\1', 
$column[
'type'])
 
  180                if (!is_null($length)) {
 
  181                    $definition[0][
'length'] = $length;
 
  183                if (!is_null($unsigned)) {
 
  184                    $definition[0][
'unsigned'] = $unsigned;
 
  186                if (!is_null($fixed)) {
 
  187                    $definition[0][
'fixed'] = $fixed;
 
  189                if ($default !== 
false) {
 
  190                    $definition[0][
'default'] = $default;
 
  192                if ($autoincrement !== 
false) {
 
  193                    $definition[0][
'autoincrement'] = $autoincrement;
 
  196                    $definition[
$key] = $definition[0];
 
  198                        unset($definition[
$key][
'default']);
 
  208            'it was not specified an existing table column', __FUNCTION__);
 
  230        $query = 
"SHOW INDEX FROM $table /*!50002 WHERE Key_name = %s */";
 
  231        $index_name_mdb2 = $db->getIndexName($index_name);
 
  236            $index_name = $index_name_mdb2;
 
  243        $definition = array();
 
  245            $row = array_change_key_case(
$row, CASE_LOWER);
 
  246            $key_name = 
$row[
'key_name'];
 
  248                if ($db->options[
'field_case'] == CASE_LOWER) {
 
  249                    $key_name = strtolower($key_name);
 
  251                    $key_name = strtoupper($key_name);
 
  254            if ($index_name == $key_name) {
 
  255                if (!
$row[
'non_unique']) {
 
  257                        'it was not specified an existing table index', __FUNCTION__);
 
  259                $column_name = 
$row[
'column_name'];
 
  261                    if ($db->options[
'field_case'] == CASE_LOWER) {
 
  262                        $column_name = strtolower($column_name);
 
  264                        $column_name = strtoupper($column_name);
 
  267                $definition[
'fields'][$column_name] = array(
 
  268                    'position' => $colpos++
 
  270                if (!empty(
$row[
'collation'])) {
 
  271                    $definition[
'fields'][$column_name][
'sorting'] = (
$row[
'collation'] == 
'A' 
  272                        ? 
'ascending' : 
'descending');
 
  277        if (empty($definition[
'fields'])) {
 
  279                'it was not specified an existing table index', __FUNCTION__);
 
  303        $query = 
"SHOW INDEX FROM $table /*!50002 WHERE Key_name = %s */";
 
  304        if (strtolower($constraint_name) != 
'primary') {
 
  305            $constraint_name_mdb2 = $db->getIndexName($constraint_name);
 
  310                $constraint_name = $constraint_name_mdb2;
 
  318        $definition = array();
 
  320            $row = array_change_key_case(
$row, CASE_LOWER);
 
  321            $key_name = 
$row[
'key_name'];
 
  323                if ($db->options[
'field_case'] == CASE_LOWER) {
 
  324                    $key_name = strtolower($key_name);
 
  326                    $key_name = strtoupper($key_name);
 
  329            if ($constraint_name == $key_name) {
 
  330                if (
$row[
'non_unique']) {
 
  332                        $constraint_name . 
' is not an existing table constraint', __FUNCTION__);
 
  334                if (
$row[
'key_name'] == 
'PRIMARY') {
 
  335                    $definition[
'primary'] = 
true;
 
  337                    $definition[
'unique'] = 
true;
 
  339                $column_name = 
$row[
'column_name'];
 
  341                    if ($db->options[
'field_case'] == CASE_LOWER) {
 
  342                        $column_name = strtolower($column_name);
 
  344                        $column_name = strtoupper($column_name);
 
  347                $definition[
'fields'][$column_name] = array(
 
  348                    'position' => $colpos++
 
  350                if (!empty(
$row[
'collation'])) {
 
  351                    $definition[
'fields'][$column_name][
'sorting'] = (
$row[
'collation'] == 
'A' 
  352                        ? 
'ascending' : 
'descending');
 
  357        if (empty($definition[
'fields'])) {
 
  359                $constraint_name . 
' is not an existing table constraint', __FUNCTION__);
 
  386        $query = 
'SELECT trigger_name, 
  387                         event_object_table AS table_name, 
  388                         action_statement AS trigger_body, 
  389                         action_timing AS trigger_type, 
  390                         event_manipulation AS trigger_event 
  391                    FROM information_schema.triggers 
  392                   WHERE trigger_name = '. $db->quote($trigger, 
'text');
 
  394            'trigger_name'    => 
'text',
 
  395            'table_name'      => 
'text',
 
  396            'trigger_body'    => 
'text',
 
  397            'trigger_type'    => 
'text',
 
  398            'trigger_event'   => 
'text',
 
  404        $def[
'trigger_comment'] = 
'';
 
  405        $def[
'trigger_enabled'] = 
true;
 
  430           return parent::tableInfo(
$result, $mode);
 
  439        if (!is_object($resource)) {
 
  441                'Could not generate result resource', __FUNCTION__);
 
  445            if ($db->options[
'field_case'] == CASE_LOWER) {
 
  446                $case_func = 
'strtolower';
 
  448                $case_func = 
'strtoupper';
 
  451            $case_func = 
'strval';
 
  454        $count = @mysqli_num_fields($resource);
 
  457            $res[
'num_fields'] = $count;
 
  460        $db->loadModule(
'Datatype', 
null, 
true);
 
  461        for (
$i = 0; 
$i < $count; 
$i++) {
 
  462            $tmp = @mysqli_fetch_field($resource);
 
  465            foreach ($this->flags as $const => $means) {
 
  466                if ($tmp->flags & $const) {
 
  471                $flags.= 
'default_' . rawurlencode($tmp->def);
 
  476                'table'  => $case_func($tmp->table),
 
  477                'name'   => $case_func($tmp->name),
 
  478                'type'   => isset($this->types[$tmp->type])
 
  479                    ? $this->types[$tmp->type] : 
'unknown',
 
  481                'length' => $tmp->length,
 
  484            $mdb2type_info = $db->datatype->mapNativeDatatype(
$res[
$i]);
 
  486               return $mdb2type_info;
 
  488            $res[
$i][
'mdb2type'] = $mdb2type_info[0][0];
 
sprintf('%.4f', $callTime)
const MDB2_PORTABILITY_FIX_CASE
Portability: convert names of tables and fields to case defined in the "field_case" option when using...
const MDB2_ERROR_NOT_FOUND
const MDB2_ERROR_NEED_MORE_DATA
const MDB2_FETCHMODE_ASSOC
Column data indexed by column names.
const MDB2_TABLEINFO_ORDERTABLE
const MDB2_TABLEINFO_ORDER
These are constants for the tableInfo-function they are bitwised or'ed.
An exception for terminatinating execution or to throw for unit testing.
getTableConstraintDefinition($table, $constraint_name)
Get the structure of a constraint into an array.
getTableIndexDefinition($table, $index_name)
Get the structure of an index into an array.
getTableFieldDefinition($table, $field_name)
Get the structure of a field into an array.
tableInfo($result, $mode=null)
Returns information about a table or a result set.
getTriggerDefinition($trigger)
Get the structure of a trigger into an array.
& getDBInstance()
Get the instance of MDB2 associated with the module instance.
isResultCommon($value)
Tell whether a value is a MDB2 result implementing the common interface.
isError($data, $code=null)
Tell whether a value is a PEAR error.
if(empty($password)) $table
foreach($_POST as $key=> $value) $res