3 V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). 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.
9 Latest version is available at http://php.weblogs.com/
11 Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows.
14 if (!defined('_ADODB_ODBC_LAYER')) {
15 include(ADODB_DIR . "/drivers/adodb-odbc.inc.php");
17 if (!defined('ADODB_VFP')) {
18 define('ADODB_VFP', 1);
19 class ADODB_vfp extends ADODB_odbc
21 var $databaseType = "vfp";
22 var $fmtDate = "{^Y-m-d}";
23 var $fmtTimeStamp = "{^Y-m-d, h:i:sA}";
24 var $replaceQuote = "'+chr(39)+'";
27 var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE
28 var $upperCase = 'upper';
29 var $_bindInputArray = false; // strangely enough, setting to true does not work reliably
30 var $sysTimeStamp = 'datetime()';
31 var $sysDate = 'date()';
32 var $ansiOuter = true;
33 var $hasTransactions = false;
34 var $curmode = SQL_CUR_USE_ODBC; // See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L
51 // quote string to be sent back to database
52 function qstr($s, $nofixquotes = false)
54 if (!$nofixquotes) return "'" . str_replace("\r\n", "'+chr(13)+'", str_replace("'", $this->replaceQuote, $s)) . "'";
55 return "'" . $s . "'";
58 // TOP requires ORDER BY for VFP
59 function &SelectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $secs2cache = 0)
61 $this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is', $sql) ? 'top' : false;
62 return ADOConnection::SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
69 class ADORecordSet_vfp extends ADORecordSet_odbc
72 var $databaseType = "vfp";
74 function ADORecordSet_vfp($id, $mode = false)
76 return $this->ADORecordSet_odbc($id, $mode);
79 function MetaType($t, $len = -1)
84 $len = $fieldobj->max_length;
86 switch (strtoupper($t)) {
88 if ($len <= $this->blobSize) return 'C';