Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

   1  <?php
   2  /**
   3   * Generic Data Dictionary.
   4   *
   5   * This file is part of ADOdb, a Database Abstraction Layer library for PHP.
   6   *
   7   * @package ADOdb
   8   * @link https://adodb.org Project's web site and documentation
   9   * @link https://github.com/ADOdb/ADOdb Source code and issue tracker
  10   *
  11   * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
  12   * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
  13   * any later version. This means you can use it in proprietary products.
  14   * See the LICENSE.md file distributed with this source code for details.
  15   * @license BSD-3-Clause
  16   * @license LGPL-2.1-or-later
  17   *
  18   * @copyright 2000-2013 John Lim
  19   * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
  20   */
  21  
  22  // security - hide paths
  23  if (!defined('ADODB_DIR')) die();
  24  
  25  class ADODB2_generic extends ADODB_DataDict {
  26  
  27  	 var $databaseType = 'generic';
  28  	 var $seqField = false;
  29  
  30  
  31  
  32   	function ActualType($meta)
  33  	 {
  34  	 	 
  35  	 	 $meta = strtoupper($meta);
  36  	 	 
  37  	 	 /*
  38  	 	 * Add support for custom meta types. We do this
  39  	 	 * first, that allows us to override existing types
  40  	 	 */
  41  	 	 if (isset($this->connection->customMetaTypes[$meta]))
  42  	 	 	 return $this->connection->customMetaTypes[$meta]['actual'];
  43  	 	 
  44  	 	 switch($meta) {
  45  	 	 case 'C': return 'VARCHAR';
  46  	 	 case 'XL':
  47  	 	 case 'X': return 'VARCHAR(250)';
  48  
  49  	 	 case 'C2': return 'VARCHAR';
  50  	 	 case 'X2': return 'VARCHAR(250)';
  51  
  52  	 	 case 'B': return 'VARCHAR';
  53  
  54  	 	 case 'D': return 'DATE';
  55  	 	 case 'TS':
  56  	 	 case 'T': return 'DATE';
  57  
  58  	 	 case 'L': return 'DECIMAL(1)';
  59  	 	 case 'I': return 'DECIMAL(10)';
  60  	 	 case 'I1': return 'DECIMAL(3)';
  61  	 	 case 'I2': return 'DECIMAL(5)';
  62  	 	 case 'I4': return 'DECIMAL(10)';
  63  	 	 case 'I8': return 'DECIMAL(20)';
  64  
  65  	 	 case 'F': return 'DECIMAL(32,8)';
  66  	 	 case 'N': return 'DECIMAL';
  67  	 	 default:
  68  	 	 	 return $meta;
  69  	 	 }
  70  	 }
  71  
  72  	function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
  73  	 {
  74  	 	 if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported");
  75  	 	 return array();
  76  	 }
  77  
  78  
  79  	function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
  80  	 {
  81  	 	 if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
  82  	 	 return array();
  83  	 }
  84  
  85  }
  86  
  87  /*
  88  //db2
  89   	 function ActualType($meta)
  90  	 {
  91  	 	 switch($meta) {
  92  	 	 case 'C': return 'VARCHAR';
  93  	 	 case 'X': return 'VARCHAR';
  94  
  95  	 	 case 'C2': return 'VARCHAR'; // up to 32K
  96  	 	 case 'X2': return 'VARCHAR';
  97  
  98  	 	 case 'B': return 'BLOB';
  99  
 100  	 	 case 'D': return 'DATE';
 101  	 	 case 'T': return 'TIMESTAMP';
 102  
 103  	 	 case 'L': return 'SMALLINT';
 104  	 	 case 'I': return 'INTEGER';
 105  	 	 case 'I1': return 'SMALLINT';
 106  	 	 case 'I2': return 'SMALLINT';
 107  	 	 case 'I4': return 'INTEGER';
 108  	 	 case 'I8': return 'BIGINT';
 109  
 110  	 	 case 'F': return 'DOUBLE';
 111  	 	 case 'N': return 'DECIMAL';
 112  	 	 default:
 113  	 	 	 return $meta;
 114  	 	 }
 115  	 }
 116  
 117  // ifx
 118  function ActualType($meta)
 119  	 {
 120  	 	 switch($meta) {
 121  	 	 case 'C': return 'VARCHAR';// 255
 122  	 	 case 'X': return 'TEXT';
 123  
 124  	 	 case 'C2': return 'NVARCHAR';
 125  	 	 case 'X2': return 'TEXT';
 126  
 127  	 	 case 'B': return 'BLOB';
 128  
 129  	 	 case 'D': return 'DATE';
 130  	 	 case 'T': return 'DATETIME';
 131  
 132  	 	 case 'L': return 'SMALLINT';
 133  	 	 case 'I': return 'INTEGER';
 134  	 	 case 'I1': return 'SMALLINT';
 135  	 	 case 'I2': return 'SMALLINT';
 136  	 	 case 'I4': return 'INTEGER';
 137  	 	 case 'I8': return 'DECIMAL(20)';
 138  
 139  	 	 case 'F': return 'FLOAT';
 140  	 	 case 'N': return 'DECIMAL';
 141  	 	 default:
 142  	 	 	 return $meta;
 143  	 	 }
 144  	 }
 145  */