Zend Db SQLITE Setup

im trying to configure sqlite as an optional adapter and ran into a problem.

I get the following message:

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

My code for the table:

 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'; 

}

If I changed $ _schema to empty, then it tries to use my main mysql database.

My application:

 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" 

Does anyone know what is going on?

thanks

I turned on Profiling, but as far as I can tell, nothing is being requested, since the error occurs when I run:

 $reports = new Table_Reports(); $reportRow = $reports->createRow(); 
+4
source share
2 answers

I managed to deal with this problem.

The adapter used mysql username and password to try connecting to sqlite, so I had to force the adapter to change as follows:

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

This is in the class Table_Reports

0
source

Try using APPLICATION_PATH and relative path instead of ROOT. You may have an open_basedir restriction or authorization problem.

+2
source

Source: https://habr.com/ru/post/1343336/


All Articles