Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402]

   1  <?php
   2  /**
   3   * Microsoft Visual FoxPro driver
   4   *
   5   * @deprecated
   6   *
   7   * This file is part of ADOdb, a Database Abstraction Layer library for PHP.
   8   *
   9   * @package ADOdb
  10   * @link https://adodb.org Project's web site and documentation
  11   * @link https://github.com/ADOdb/ADOdb Source code and issue tracker
  12   *
  13   * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
  14   * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
  15   * any later version. This means you can use it in proprietary products.
  16   * See the LICENSE.md file distributed with this source code for details.
  17   * @license BSD-3-Clause
  18   * @license LGPL-2.1-or-later
  19   *
  20   * @copyright 2000-2013 John Lim
  21   * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
  22   */
  23  
  24  // security - hide paths
  25  if (!defined('ADODB_DIR')) die();
  26  
  27  if (!defined('_ADODB_ODBC_LAYER')) {
  28  	 include_once(ADODB_DIR."/drivers/adodb-odbc.inc.php");
  29  }
  30  if (!defined('ADODB_VFP')){
  31  define('ADODB_VFP',1);
  32  class ADODB_vfp extends ADODB_odbc {
  33  	 var $databaseType = "vfp";
  34  	 var $fmtDate = "{^Y-m-d}";
  35  	 var $fmtTimeStamp = "{^Y-m-d, h:i:sA}";
  36  	 var $replaceQuote = "'+chr(39)+'" ;
  37  	 var $true = '.T.';
  38  	 var $false = '.F.';
  39  	 var $hasTop = 'top';	 	 // support mssql SELECT TOP 10 * FROM TABLE
  40  	 var $_bindInputArray = false; // strangely enough, setting to true does not work reliably
  41  	 var $sysTimeStamp = 'datetime()';
  42  	 var $sysDate = 'date()';
  43  	 var $ansiOuter = true;
  44  	 var $hasTransactions = false;
  45  	 var $curmode = false ; // See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L
  46  
  47  	function Time()
  48  	 {
  49  	 	 return time();
  50  	 }
  51  
  52  	function BeginTrans() { return false;}
  53  
  54  	 // quote string to be sent back to database
  55  	function qstr($s,$nofixquotes=false)
  56  	 {
  57  	 	 if (!$nofixquotes) return  "'".str_replace("\r\n","'+chr(13)+'",str_replace("'",$this->replaceQuote,$s))."'";
  58  	 	 return "'".$s."'";
  59  	 }
  60  
  61  
  62  	 // TOP requires ORDER BY for VFP
  63  	function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
  64  	 {
  65  	 	 $this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false;
  66  	 	 $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
  67  	 	 return $ret;
  68  	 }
  69  
  70  
  71  
  72  };
  73  
  74  
  75  class  ADORecordSet_vfp extends ADORecordSet_odbc {
  76  
  77  	 var $databaseType = "vfp";
  78  
  79  
  80  	function MetaType($t, $len = -1, $fieldobj = false)
  81  	 {
  82  	 	 if (is_object($t)) {
  83  	 	 	 $fieldobj = $t;
  84  	 	 	 $t = $fieldobj->type;
  85  	 	 	 $len = $fieldobj->max_length;
  86  	 	 }
  87  	 	 switch (strtoupper($t)) {
  88  	 	 case 'C':
  89  	 	 	 if ($len <= $this->blobSize) return 'C';
  90  	 	 case 'M':
  91  	 	 	 return 'X';
  92  
  93  	 	 case 'D': return 'D';
  94  
  95  	 	 case 'T': return 'T';
  96  
  97  	 	 case 'L': return 'L';
  98  
  99  	 	 case 'I': return 'I';
 100  
 101  	 	 default: return ADODB_DEFAULT_METATYPE;
 102  	 	 }
 103  	 }
 104  }
 105  
 106  } //define