TYPO3 CMS  TYPO3_6-2
adodb-vfp.inc.php
Go to the documentation of this file.
1 <?php
2 /*
3 V5.19 23-Apr-2014 (c) 2000-2014 John Lim (jlim#natsoft.com). All rights reserved.
4  Released under both BSD license and Lesser GPL library license.
5  Whenever there is any discrepancy between the two licenses,
6  the BSD license will take precedence.
7 Set tabs to 4 for best viewing.
8 
9  Latest version is available at http://adodb.sourceforge.net
10 
11  Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows.
12 */
13 
14 // security - hide paths
15 if (!defined('ADODB_DIR')) die();
16 
17 if (!defined('_ADODB_ODBC_LAYER')) {
18  include(ADODB_DIR."/drivers/adodb-odbc.inc.php");
19 }
20 if (!defined('ADODB_VFP')){
21 define('ADODB_VFP',1);
22 class ADODB_vfp extends ADODB_odbc {
23  var $databaseType = "vfp";
24  var $fmtDate = "{^Y-m-d}";
25  var $fmtTimeStamp = "{^Y-m-d, h:i:sA}";
26  var $replaceQuote = "'+chr(39)+'" ;
27  var $true = '.T.';
28  var $false = '.F.';
29  var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE
30  var $_bindInputArray = false; // strangely enough, setting to true does not work reliably
31  var $sysTimeStamp = 'datetime()';
32  var $sysDate = 'date()';
33  var $ansiOuter = true;
34  var $hasTransactions = false;
35  var $curmode = false ; // See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L
36 
37  function ADODB_vfp()
38  {
39  $this->ADODB_odbc();
40  }
41 
42  function Time()
43  {
44  return time();
45  }
46 
47  function BeginTrans() { return false;}
48 
49  // quote string to be sent back to database
50  function qstr($s,$nofixquotes=false)
51  {
52  if (!$nofixquotes) return "'".str_replace("\r\n","'+chr(13)+'",str_replace("'",$this->replaceQuote,$s))."'";
53  return "'".$s."'";
54  }
55 
56 
57  // TOP requires ORDER BY for VFP
58  function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
59  {
60  $this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false;
61  $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
62  return $ret;
63  }
64 
65 
66 
67 };
68 
69 
70 class ADORecordSet_vfp extends ADORecordSet_odbc {
71 
72  var $databaseType = "vfp";
73 
74 
75  function ADORecordSet_vfp($id,$mode=false)
76  {
77  return $this->ADORecordSet_odbc($id,$mode);
78  }
79 
80  function MetaType($t,$len=-1)
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 'N';
102  }
103  }
104 }
105 
106 } //define
$sql
Definition: server.php:82
die
Definition: index.php:6