Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

   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   	function ActualType($meta)
  32  	 {
  33  	 	 switch($meta) {
  34  	 	 case 'C': return 'VARCHAR';
  35  	 	 case 'XL':
  36  	 	 case 'X': return 'VARCHAR(250)';
  37  
  38  	 	 case 'C2': return 'VARCHAR';
  39  	 	 case 'X2': return 'VARCHAR(250)';
  40  
  41  	 	 case 'B': return 'VARCHAR';
  42  
  43  	 	 case 'D': return 'DATE';
  44  	 	 case 'TS':
  45  	 	 case 'T': return 'DATE';
  46  
  47  	 	 case 'L': return 'DECIMAL(1)';
  48  	 	 case 'I': return 'DECIMAL(10)';
  49  	 	 case 'I1': return 'DECIMAL(3)';
  50  	 	 case 'I2': return 'DECIMAL(5)';
  51  	 	 case 'I4': return 'DECIMAL(10)';
  52  	 	 case 'I8': return 'DECIMAL(20)';
  53  
  54  	 	 case 'F': return 'DECIMAL(32,8)';
  55  	 	 case 'N': return 'DECIMAL';
  56  	 	 default:
  57  	 	 	 return $meta;
  58  	 	 }
  59  	 }
  60  
  61  	function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
  62  	 {
  63  	 	 if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported");
  64  	 	 return array();
  65  	 }
  66  
  67  
  68  	function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
  69  	 {
  70  	 	 if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
  71  	 	 return array();
  72  	 }
  73  
  74  }
  75  
  76  /*
  77  //db2
  78   	 function ActualType($meta)
  79  	 {
  80  	 	 switch($meta) {
  81  	 	 case 'C': return 'VARCHAR';
  82  	 	 case 'X': return 'VARCHAR';
  83  
  84  	 	 case 'C2': return 'VARCHAR'; // up to 32K
  85  	 	 case 'X2': return 'VARCHAR';
  86  
  87  	 	 case 'B': return 'BLOB';
  88  
  89  	 	 case 'D': return 'DATE';
  90  	 	 case 'T': return 'TIMESTAMP';
  91  
  92  	 	 case 'L': return 'SMALLINT';
  93  	 	 case 'I': return 'INTEGER';
  94  	 	 case 'I1': return 'SMALLINT';
  95  	 	 case 'I2': return 'SMALLINT';
  96  	 	 case 'I4': return 'INTEGER';
  97  	 	 case 'I8': return 'BIGINT';
  98  
  99  	 	 case 'F': return 'DOUBLE';
 100  	 	 case 'N': return 'DECIMAL';
 101  	 	 default:
 102  	 	 	 return $meta;
 103  	 	 }
 104  	 }
 105  
 106  // ifx
 107  function ActualType($meta)
 108  	 {
 109  	 	 switch($meta) {
 110  	 	 case 'C': return 'VARCHAR';// 255
 111  	 	 case 'X': return 'TEXT';
 112  
 113  	 	 case 'C2': return 'NVARCHAR';
 114  	 	 case 'X2': return 'TEXT';
 115  
 116  	 	 case 'B': return 'BLOB';
 117  
 118  	 	 case 'D': return 'DATE';
 119  	 	 case 'T': return 'DATETIME';
 120  
 121  	 	 case 'L': return 'SMALLINT';
 122  	 	 case 'I': return 'INTEGER';
 123  	 	 case 'I1': return 'SMALLINT';
 124  	 	 case 'I2': return 'SMALLINT';
 125  	 	 case 'I4': return 'INTEGER';
 126  	 	 case 'I8': return 'DECIMAL(20)';
 127  
 128  	 	 case 'F': return 'FLOAT';
 129  	 	 case 'N': return 'DECIMAL';
 130  	 	 default:
 131  	 	 	 return $meta;
 132  	 	 }
 133  	 }
 134  */