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   * Data Dictionary for Access.
   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_access extends ADODB_DataDict {
  26  
  27  	 var $databaseType = 'access';
  28  	 var $seqField = false;
  29  
  30  
  31   	function ActualType($meta)
  32  	 {
  33  	 	 $meta = strtoupper($meta);
  34  	 	 
  35  	 	 /*
  36  	 	 * Add support for custom meta types. We do this
  37  	 	 * first, that allows us to override existing types
  38  	 	 */
  39  	 	 if (isset($this->connection->customMetaTypes[$meta]))
  40  	 	 	 return $this->connection->customMetaTypes[$meta]['actual'];
  41  	 	 
  42  	 	 switch($meta) {
  43  	 	 case 'C': return 'TEXT';
  44  	 	 case 'XL':
  45  	 	 case 'X': return 'MEMO';
  46  
  47  	 	 case 'C2': return 'TEXT'; // up to 32K
  48  	 	 case 'X2': return 'MEMO';
  49  
  50  	 	 case 'B': return 'BINARY';
  51  
  52  	 	 case 'TS':
  53  	 	 case 'D': 
  54  	 	 return 'DATETIME';
  55  	 	 case 'T': return 'DATETIME';
  56  
  57  	 	 case 'L':  return 'BYTE';
  58  	 	 case 'I':  return 'INTEGER';
  59  	 	 case 'I1': return 'BYTE';
  60  	 	 case 'I2': return 'SMALLINT';
  61  	 	 case 'I4': return 'INTEGER';
  62  	 	 case 'I8': return 'INTEGER';
  63  
  64  	 	 case 'F':  return 'DOUBLE';
  65  	 	 case 'N':  return 'NUMERIC';
  66  	 	 default:
  67  	 	 	 return $meta;
  68  	 	 }
  69  	 }
  70  
  71  	 // return string must begin with space
  72  	function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
  73  	 {
  74  	 	 if ($fautoinc) {
  75  	 	 	 $ftype = 'COUNTER';
  76  	 	 	 return '';
  77  	 	 }
  78  	 	 if (substr($ftype,0,7) == 'DECIMAL') $ftype = 'DECIMAL';
  79  	 	 $suffix = '';
  80  	 	 if (strlen($fdefault)) {
  81  	 	 	 //$suffix .= " DEFAULT $fdefault";
  82  	 	 	 if ($this->debug) ADOConnection::outp("Warning: Access does not supported DEFAULT values (field $fname)");
  83  	 	 }
  84  	 	 if ($fnotnull) $suffix .= ' NOT NULL';
  85  	 	 if ($fconstraint) $suffix .= ' '.$fconstraint;
  86  	 	 return $suffix;
  87  	 }
  88  
  89  	function CreateDatabase($dbname,$options=false)
  90  	 {
  91  	 	 return array();
  92  	 }
  93  
  94  
  95  	function SetSchema($schema)
  96  	 {
  97  	 }
  98  
  99  	function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
 100  	 {
 101  	 	 if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported");
 102  	 	 return array();
 103  	 }
 104  
 105  
 106  	function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
 107  	 {
 108  	 	 if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
 109  	 	 return array();
 110  	 }
 111  
 112  }