zend-db

How to print exact sql query in zend framework ?

眉间皱痕 提交于 2019-12-17 17:28:34
问题 I have the following piece of code which i taken from model, ... $select = $this->_db->select() ->from($this->_name) ->where('shipping=?',$type) ->where('customer_id=?',$userid); echo $select; exit; // which gives exact mysql query. ..... When i use update query in zend like , $up_value = array('billing'=> '0'); $this->update($up_value,'customer_id ='.$userid.' and address_id <> '.$data['address_Id']); Here i want to know the exact mysql query. Is there any possible way to print the mysql

Can I set a query timeout when using Zend_Db_Adapter_Pdo_Mssql?

人盡茶涼 提交于 2019-12-13 14:51:37
问题 We have a PHP application (hosted on Linux) which uses Zend Framework components to query a Microsoft SQL Server 2008 database. The PHP application is hosted in a datacenter with reliable internet connection, but the SQL Server database is at the far end of a VPN connection that drops out regularly. The issue we have is that VPN drop outs occasionally occur while queries against the SQL server are in progress. When this occurs our application can wait up to 2 hours before finally raising the

Executing multiple join with expressions on Zend Framework 2

你离开我真会死。 提交于 2019-12-13 12:05:43
问题 Actually I'm working on a project and I'm looking on how Zend Framework 2 handle complex queries (expecially on how to join n:m tables and how to use GROUP_CONCAT and other functions). Do you know the best practice to execute this query: SELECT o. * , x.group_one, x.group_two FROM table_one AS o LEFT JOIN ( SELECT r.fk1, GROUP_CONCAT( t.field_one ) AS group_one, GROUP_CONCAT( t.field_two ) AS group_two FROM table_three AS r INNER JOIN table_two AS t ON r.fk2 = t.id GROUP BY r.fk1 ) AS x ON o

Zend Framework 2 - Doctrine 2 - How to use GeoPointFields

瘦欲@ 提交于 2019-12-13 06:02:58
问题 I need to implement a GeoPointField with Doctrine2. It seems that Zend and Doctrine don't support it natively... Is there a best practice for validating such an input? In the database I'd use a simple string field, right? 回答1: /^(\-?\d+(?:\.\d+)?),?\s*(\-?\d+(?:\.\d+)?)$/ This regexp validates and captures GEO input: Latitude, Longitude Latitude Longitude Coords copied directly from GoogleMaps 来源: https://stackoverflow.com/questions/14067212/zend-framework-2-doctrine-2-how-to-use

Zend_DB whats the right strategy to export large amounts of data to csv? – chunks – fetchAll – fetchRow [duplicate]

我只是一个虾纸丫 提交于 2019-12-13 04:44:40
问题 This question already has answers here : Closed 7 years ago . I have to export a huge amount of data. Also I have to transform every record a little bit through php. Whats the right strategy to export large amounts of data? Do I split Zend_Db requests in multiple chunked queries with limit(1000,x)? Do I use fetchAll or fetchRow? Which fetchrow or fetchall is performing better considering high performance? I cannot use SQL OUTFILE since I have to interpret the xml/html coming from one column.

Insert php boolean into mysql bit column with Zend_Db

房东的猫 提交于 2019-12-13 04:33:26
问题 I'm using Zend Framework 1.11.4 and also Zend_Db. The problem is, I have a column for sex which has the value 0 or 1(BIT(1)), when I put false the insertion is fine, but when I put true the following error appears: 'Data too long for column 'sex' at row 1 ' I already debugged and verified it's a boolean! With false(0) no error, but with true the error happens (Class Application_Model_UserNodeMapper): public function save(Application_Model_UserNode $user){ $sex = $user->getSex(); if($sex == 'm

How can disable quote join Zend db

不问归期 提交于 2019-12-13 04:01:01
问题 I've sql query select * from table1 left join (values (4),(1800),(103500)) AS "filter (id) on table1.id=filter.id By default Zend_Db_Select table quoted. For example: $result = '(values (4),(1800),(103500)) AS filter (id)'; $select->joinInner($result, "table1.id = filter.id", ''); result: SELECT * FROM "table1" INNER JOIN "(values (4),(1800),(103500)) filter (id)" ON table1.id=filter.id Me need SELECT * FROM "table1" INNER JOIN (values (4),(1800),(103500)) filter (id) ON table1.id=filter.id

How can I join tables in Zend while using a class that inherits from Zend_Db_Table_Row_Abstract?

空扰寡人 提交于 2019-12-12 17:19:28
问题 I have a class that extends Zend_Db_Table lets call it 'Users' that uses the class 'User' (inheriting from Zend_Db_Table_Row_Abstract) as its rowClass. I need it this way because User has additional methods that I use. As far as I know it is not possible to join tables inside my Users class so I use: $query = $db->select(); $query->from(...); $query->joinInner(...); instead of $this->select(); ... But then of course the rows I get are not of the User class. So I would like to know how can I

Zend_Validate_Db_RecordExists with Doctrine 2?

China☆狼群 提交于 2019-12-12 09:42:35
问题 I'm using Doctrine 2 in a Zend Framework application and require functionality similar to Zend_Validate_Db_RecordExists and Zend_Validate_Db_NoRecordExists. For example, when a user enters a new item, I need to validate that a duplicate entry doesn't already exist. This is easy to accomplish with Zend_Db by adding the Db_NoRecordExists validator on my forms. I tried implementing the custom-validator solution proposed here, but I can't figure out how they are communicating with Doctrine to

PHP implode array to generate mysql IN criteria

ε祈祈猫儿з 提交于 2019-12-12 08:14:40
问题 I have a function like the following: public function foo ($cities = array('anaheim', 'baker', 'colfax') ) { $db = global instance of Zend_Db_Adapter_Pdo_Mysql... $query = 'SELECT name FROM user WHERE city IN ('.implode(',',$cities).')'; $result = $db->fetchAll( $query ); } This works out fine until someone passes $cities as an empty array. To prevent this error I have been logic-breaking the query like so: $query = 'SELECT name FROM user'; if (!empty($cities)) { $query .= ' WHERE city IN ('