|
发表于 2008-5-21 09:10:47
|
显示全部楼层
基本上我是全部copy database/drivers下的odbc到access
但稍微做了一点改变access_driver.php中
配置了链接,不过是hard code进去的
晚上回家把整个database文件传上来,需要的对比下源码,具体改了啥忘记了
反正当时debug了整整两天才搞定
PHP复制代码
class CI_DB_access_driver extends CI_DB {
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
* used for the count_all() and count_all_results() functions.
*/
var $_count_string = "SELECT COUNT(*) AS ";
var $_random_keyword;
var $_insert_id;
function CI_DB_access_driver ()
{
//FIXME 不知道access随机数
$this->_random_keyword = ' RND('.time().')'; // database specific random keyword
}
/**
* Non-persistent database connection
*
* @access private called by the base class
* @return resource
*/
function db_connect ()
{
$mdbPath = "php.mdb";
$dao = new COM ("ADODB.Connection");
$dsn="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=".realpath($mdbPath);
$dao->open($dsn);
#echo "<br >------ accesssaccessaccess dao created -----<br>";
#$rs = new COM("ADODB.RecordSet");
#$rs->Open("select * from name",$dao,1,1);
#while(! $rs->eof) {
#$f = $rs->Fields("name");
#$f = $rs->Fields(0);
#echo $f->value.'<br>';
#$rs->MoveNext();
#}
#echo $dao;
return $dao;
#return @access_connect($this->hostname, $this->username, $this->password);
}
// --------------------------------------------------------------------
/**
* Persistent database connection
*
* @access private called by the base class
* @return resource
*/
function db_pconnect ()
{
return db_connect ();
#return @access_pconnect($this->hostname, $this->username, $this->password);
}
//omit....
}
复制代码 |
评分
-
查看全部评分
|