zend-db

Terrible performance in Zend Db PDO_sqlite insert and update queries

不羁的心 提交于 2019-12-25 08:58:13
问题 I'm having some major issues with my sqlite database performance. I'm using it for storing small amount of data, which should be really fast, but somehow takes way too long. First of all, I create Zend_Db object with factory static method: $this->db = Zend_Db::factory('PDO_SQLITE', $params); Afterwards I run some simple query: $this->db->query($q) And here goes time from logs: 2012-04-26 13:08:06.752855 : UPDATE session SET value ='542M', timeStamp ='1335438486' , type='999', ip ='62.21.30.77

Zend\Db: Select from subquery

心不动则不痛 提交于 2019-12-25 06:01:15
问题 I'm porting an application from ZF1 to ZF2 and as part of that I have to rewrite our database mappers. I'm struggling with this SQL statement: SELECT full_name, GROUP_CONCAT(value) FROM ( SELECT full_name, value FROM my_table ORDER BY id DESC ) as subtable GROUP BY full_name ORDER BY full_name DESC; The underlying problem I'm trying to solve is that I need to order the results of the sub query before running GROUP_CONCAT and I need it to work for both MySQL and Sqlite. In MySQL I could simply

In Zend_Auth, can I get a domain-model User object instead of stdClass?

喜欢而已 提交于 2019-12-25 04:35:10
问题 While working on the login part of an application, I find myself running into an issue: My model is based on Active Record, by extending Zend_Db_Table_Row objects. Whenever I have to deal with a user, I'd want to do this through the User object (being an extended table row). However, Zend_Auth_Adapter_DbTable::getResultRowObject() returns a stdClass and I can not find a way to tell Zend_Auth_Adapter_DbTable to use a specific Db_Table. My three options that I've found so far: Write a custom

Simple Display Results from Database

自古美人都是妖i 提交于 2019-12-25 02:01:12
问题 I have set up correctly the parameters for Zend_Db::factory and then I am querying like: $select = $db->select() ->from('imdb') ->limit(10); $stmt = $db->query($select); $result = $stmt->fetchAll(); Question: Why I do not see anything displayed? I continue and I am trying to display results by creating a new object $moviesTBL = new Application_Model_DbTable_Imdb(); $this->view->albums = $moviesTBL->fetchAll(); If I combine it with a view it works fine BUT fetches all rows!!! How to make it

Connect to mysql server through ssl in Zend Framework

寵の児 提交于 2019-12-24 17:48:47
问题 Single DB connection (resource configuration) from application.ini : resources.db.adapter = "pdo_mysql" resources.db.params.host = "mysql1" resources.db.params.username = "dbuser" resources.db.params.password = "dbpass" resources.db.params.dbname = "dbname" ;resources.db.??? Multiple DB connection (resource configuration) from application.ini : resources.multidb.mysql1.adapter = "pdo_mysql" resources.multidb.mysql1.host = "mysql1" resources.multidb.mysql1.username = "dbuser" resources.multidb

Zend Framwork 2 - mysqli connection configuration and testing example

断了今生、忘了曾经 提交于 2019-12-24 16:12:23
问题 I am trying learn Zend Framework 2 via the skeleton application given, however I don't have any kind of previous experience in Zend. I do know about MVC from other frameworks e.g. yii, symfony. My skeleton app seems to be loading fine, then the next step is to configure a MySQL db connection into the application. So I tried following question's answer: Zend Frameworkd 2 Database connection But that didnt work for me, so I am wondering why. My code is: In the config/autoload/ folder I created

Zend_db update better error reporting

岁酱吖の 提交于 2019-12-24 01:54:40
问题 When I update a record, I'm using the result from 'update' to determine if it worked correctly. $a = $this->db->insert(self::TABLE, $saveData); $a = 1 means that it updated one record. $a = 0 means that it didn't update anything. I can get a 0 if there was nothing changed in the form. But I also assume I can get a 0 if there was an error. I'd like to be able to tell the user that the information was not updated because they didn't change anything or that there was an actual error of some sort

using Zend_Db zf2 module outside of zf2 mvc

六眼飞鱼酱① 提交于 2019-12-22 10:43:50
问题 I'm writing a PHP application that is not based on zf2 mvc. I do want to use only the Zend_Db zf2 module. how can I configure my application to know how to find the Zend_Db releveant PHP file where required ? I have zf2 Zend_db module download with phyrus and installed at the location vendor/zf2/php . I tried adding the module to the include path with the following command: set_include_path("../vendor/zf2/php".PATH_SEPARATOR.get_include_path()); I created Model class files relevant to each

How Zend DB Manage Database Connections

半世苍凉 提交于 2019-12-22 06:41:02
问题 I am using Zend Framework for my PHP developments and here is a small function I used to execute a query. This is not about an error. The code and everything works fine. But I want to know some concept behind this. /** * Get dataset by executing sql statement * * @param string $sql - SQL Statement to be executed * * @return bool */ public function executeQuery($sql) { $this->sqlStatement = $sql; if ($this->isDebug) { echo $sql; exit; } $objSQL = $this->objDB->getAdapter()->prepare($sql); try

Zend_Validate_Db_RecordExists against 2 fields

為{幸葍}努か 提交于 2019-12-22 05:41:22
问题 I usualy use Zend_Validate_Db_RecordExists to update or insert a record. This works fine with one field to check against. How to do it if you have two fields to check? $validator = new Zend_Validate_Db_RecordExists( array( 'table' => $this->_name, 'field' => 'id_sector,day_of_week' ) ); if ($validator->isValid($fields_values['id_sector'],$fields_values['day_of_week'])){ //true } I tried it with an array and comma separated list, nothing works... Any help is welcome. Regards Andrea 回答1: To do