Zend Db SQLITE安装程序

时间:2011-03-11 15:14:19

标签: php zend-framework sqlite

我试图将sqlite设置为辅助适配器并遇到问题。

我收到以下消息:

Message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'reports.reports' doesn't exist

我的表格代码是:

class Table_Reports extends Zend_Db_Table_Abstract {
protected $_name = 'reports';
protected $_id = 'report_id';
protected $_rowClass = 'Model_Report';
protected $_adapter = 'dbReports';
protected $_schema = 'reports';

}

如果我将$ _schema更改为空白,那么它会尝试使用我的主mysql数据库。

我的应用配置是:

resources.multidb.db1.adapter = "PDO_MYSQL"
resources.multidb.db1.host = "localhost"
resources.multidb.db1.dbname = "test"
resources.multidb.db1.username = "root"
resources.multidb.db1.password = ""
resources.multidb.db1.isDefaultTableAdapter = true

resources.multidb.db2.adapter = "PDO_SQLITE"
resources.multidb.db2.dbname = ROOT "/data/reports.db"

任何人都知道发生了什么事?

由于

我打开了Profiling,但据我所知,当我运行时出现错误时,没有任何内容被查询:

$reports = new Table_Reports();
$reportRow = $reports->createRow();

2 个答案:

答案 0 :(得分:2)

尝试使用APPLICATION_PATH和相对路径代替ROOT。也许你有open_basedir限制或授权问题

答案 1 :(得分:0)

我设法解决了这个问题。

适配器正在使用mysql用户和密码详细信息尝试连接到sqlite,所以我不得不强制适配器转换如下:

public function __construct($config = array())
{
    $this->_setAdapter(Zend_Registry::get('dbReports'));
    parent::__construct($config);
}

这是在class Table_Reports

文件中