[!!!][TASK] Doctrine: Remove ext:dbal
[Packages/TYPO3.CMS.git] / typo3 / sysext / adodb / adodb / drivers / adodb-vfp.inc.php
1 <?php
2 /*
3 @version v5.20.3 01-Jan-2016
4 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
5 @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
6 Released under both BSD license and Lesser GPL library license.
7 Whenever there is any discrepancy between the two licenses,
8 the BSD license will take precedence.
9 Set tabs to 4 for best viewing.
10
11 Latest version is available at http://adodb.sourceforge.net
12
13 Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows.
14 */
15
16 // security - hide paths
17 if (!defined('ADODB_DIR')) die();
18
19 if (!defined('_ADODB_ODBC_LAYER')) {
20 include(ADODB_DIR."/drivers/adodb-odbc.inc.php");
21 }
22 if (!defined('ADODB_VFP')){
23 define('ADODB_VFP',1);
24 class ADODB_vfp extends ADODB_odbc {
25 var $databaseType = "vfp";
26 var $fmtDate = "{^Y-m-d}";
27 var $fmtTimeStamp = "{^Y-m-d, h:i:sA}";
28 var $replaceQuote = "'+chr(39)+'" ;
29 var $true = '.T.';
30 var $false = '.F.';
31 var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE
32 var $_bindInputArray = false; // strangely enough, setting to true does not work reliably
33 var $sysTimeStamp = 'datetime()';
34 var $sysDate = 'date()';
35 var $ansiOuter = true;
36 var $hasTransactions = false;
37 var $curmode = false ; // See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L
38
39 function Time()
40 {
41 return time();
42 }
43
44 function BeginTrans() { return false;}
45
46 // quote string to be sent back to database
47 function qstr($s,$nofixquotes=false)
48 {
49 if (!$nofixquotes) return "'".str_replace("\r\n","'+chr(13)+'",str_replace("'",$this->replaceQuote,$s))."'";
50 return "'".$s."'";
51 }
52
53
54 // TOP requires ORDER BY for VFP
55 function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
56 {
57 $this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false;
58 $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
59 return $ret;
60 }
61
62
63
64 };
65
66
67 class ADORecordSet_vfp extends ADORecordSet_odbc {
68
69 var $databaseType = "vfp";
70
71
72 function __construct($id,$mode=false)
73 {
74 return parent::__construct($id,$mode);
75 }
76
77 function MetaType($t, $len = -1, $fieldobj = false)
78 {
79 if (is_object($t)) {
80 $fieldobj = $t;
81 $t = $fieldobj->type;
82 $len = $fieldobj->max_length;
83 }
84 switch (strtoupper($t)) {
85 case 'C':
86 if ($len <= $this->blobSize) return 'C';
87 case 'M':
88 return 'X';
89
90 case 'D': return 'D';
91
92 case 'T': return 'T';
93
94 case 'L': return 'L';
95
96 case 'I': return 'I';
97
98 default: return 'N';
99 }
100 }
101 }
102
103 } //define