adodb-access.inc.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /*
  3. V4.60 24 Jan 2005 (c) 2000-2005 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. See License.txt.
  7. Set tabs to 4 for best viewing.
  8. Latest version is available at http://adodb.sourceforge.net
  9. Microsoft Access data driver. Requires ODBC. Works only on MS Windows.
  10. */
  11. if (!defined('_ADODB_ODBC_LAYER')) {
  12. if (!defined('ADODB_DIR')) die();
  13. include(ADODB_DIR."/drivers/adodb-odbc.inc.php");
  14. }
  15. if (!defined('_ADODB_ACCESS')) {
  16. define('_ADODB_ACCESS',1);
  17. class ADODB_access extends ADODB_odbc {
  18. var $databaseType = 'access';
  19. var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE
  20. var $fmtDate = "#Y-m-d#";
  21. var $fmtTimeStamp = "#Y-m-d h:i:sA#"; // note not comma
  22. var $_bindInputArray = false; // strangely enough, setting to true does not work reliably
  23. var $sysDate = "FORMAT(NOW,'yyyy-mm-dd')";
  24. var $sysTimeStamp = 'NOW';
  25. var $hasTransactions = false;
  26. function ADODB_access()
  27. {
  28. global $ADODB_EXTENSION;
  29. $ADODB_EXTENSION = false;
  30. $this->ADODB_odbc();
  31. }
  32. function Time()
  33. {
  34. return time();
  35. }
  36. function BeginTrans() { return false;}
  37. function IfNull( $field, $ifNull )
  38. {
  39. return " IIF(IsNull($field), $ifNull, $field) "; // if Access
  40. }
  41. /*
  42. function &MetaTables()
  43. {
  44. global $ADODB_FETCH_MODE;
  45. $savem = $ADODB_FETCH_MODE;
  46. $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
  47. $qid = odbc_tables($this->_connectionID);
  48. $rs = new ADORecordSet_odbc($qid);
  49. $ADODB_FETCH_MODE = $savem;
  50. if (!$rs) return false;
  51. $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
  52. $arr = &$rs->GetArray();
  53. //print_pre($arr);
  54. $arr2 = array();
  55. for ($i=0; $i < sizeof($arr); $i++) {
  56. if ($arr[$i][2] && $arr[$i][3] != 'SYSTEM TABLE')
  57. $arr2[] = $arr[$i][2];
  58. }
  59. return $arr2;
  60. }*/
  61. }
  62. class ADORecordSet_access extends ADORecordSet_odbc {
  63. var $databaseType = "access";
  64. function ADORecordSet_access($id,$mode=false)
  65. {
  66. return $this->ADORecordSet_odbc($id,$mode);
  67. }
  68. }// class
  69. }
  70. ?>