Documentation TYPO3 par Ameos |
00001 <?php 00002 /* 00003 V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved. 00004 Released under both BSD license and Lesser GPL library license. 00005 Whenever there is any discrepancy between the two licenses, 00006 the BSD license will take precedence. 00007 Set tabs to 4 for best viewing. 00008 00009 Latest version is available at http://adodb.sourceforge.net 00010 00011 Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows. 00012 */ 00013 00014 // security - hide paths 00015 if (!defined('ADODB_DIR')) die(); 00016 00017 if (!defined('_ADODB_ODBC_LAYER')) { 00018 include(ADODB_DIR."/drivers/adodb-odbc.inc.php"); 00019 } 00020 if (!defined('ADODB_VFP')){ 00021 define('ADODB_VFP',1); 00022 class ADODB_vfp extends ADODB_odbc { 00023 var $databaseType = "vfp"; 00024 var $fmtDate = "{^Y-m-d}"; 00025 var $fmtTimeStamp = "{^Y-m-d, h:i:sA}"; 00026 var $replaceQuote = "'+chr(39)+'" ; 00027 var $true = '.T.'; 00028 var $false = '.F.'; 00029 var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE 00030 var $_bindInputArray = false; // strangely enough, setting to true does not work reliably 00031 var $sysTimeStamp = 'datetime()'; 00032 var $sysDate = 'date()'; 00033 var $ansiOuter = true; 00034 var $hasTransactions = false; 00035 var $curmode = false ; // See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L 00036 00037 function ADODB_vfp() 00038 { 00039 $this->ADODB_odbc(); 00040 } 00041 00042 function Time() 00043 { 00044 return time(); 00045 } 00046 00047 function BeginTrans() { return false;} 00048 00049 // quote string to be sent back to database 00050 function qstr($s,$nofixquotes=false) 00051 { 00052 if (!$nofixquotes) return "'".str_replace("\r\n","'+chr(13)+'",str_replace("'",$this->replaceQuote,$s))."'"; 00053 return "'".$s."'"; 00054 } 00055 00056 00057 // TOP requires ORDER BY for VFP 00058 function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0) 00059 { 00060 $this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false; 00061 $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); 00062 return $ret; 00063 } 00064 00065 00066 00067 }; 00068 00069 00070 class ADORecordSet_vfp extends ADORecordSet_odbc { 00071 00072 var $databaseType = "vfp"; 00073 00074 00075 function ADORecordSet_vfp($id,$mode=false) 00076 { 00077 return $this->ADORecordSet_odbc($id,$mode); 00078 } 00079 00080 function MetaType($t,$len=-1) 00081 { 00082 if (is_object($t)) { 00083 $fieldobj = $t; 00084 $t = $fieldobj->type; 00085 $len = $fieldobj->max_length; 00086 } 00087 switch (strtoupper($t)) { 00088 case 'C': 00089 if ($len <= $this->blobSize) return 'C'; 00090 case 'M': 00091 return 'X'; 00092 00093 case 'D': return 'D'; 00094 00095 case 'T': return 'T'; 00096 00097 case 'L': return 'L'; 00098 00099 case 'I': return 'I'; 00100 00101 default: return 'N'; 00102 } 00103 } 00104 } 00105 00106 } //define 00107 ?>