Questions tagged [zend-db-select]

117 questions
2
votes
1 answer

change a complicated query to Zend_Db_Select object

I have a query which is a little complicated: (SELECT category_id AS id, content_title AS title, content AS detail, 'content' AS type FROM category_content WHERE $where ORDER BY id DESC) UNION (SELECT news_id AS id, news_title AS title,…
rahim asgari
  • 12,197
  • 10
  • 43
  • 53
2
votes
0 answers

How to give a prefix to all columns of a JOINed table in Zend Framework 2?

In my current Zend Framework 2 project I have a data schema like this: car id type -> ENUM('Tesla', 'AstonMartin', 'Bmw') common_attribute car_tesla car_id specific_attribute_a specific_attribute_b …
automatix
  • 14,018
  • 26
  • 105
  • 230
2
votes
1 answer

Remove "DISTINCT" from Zend_Db_Select

You can add "DISTINCT" with the distinct() method. But is there any way to remove it after it is added?
Buttle Butkus
  • 9,206
  • 13
  • 79
  • 120
2
votes
1 answer

Get table alias from Zend_Db_Table_Select

I'm working on an Active Record pattern (similar to RoR/Cake) for my Zend Framework library. My question is this: How do I figure out whether a select object is using an alias for a table or not? $select->from(array("c" =>…
typeoneerror
  • 55,990
  • 32
  • 132
  • 223
2
votes
2 answers

Zend modification. Adding MySQL FORCE INDEX hint

I am trying to extend the Zend library in order to get queries like this one: SELECT * FROM item i **force index(ix)** ORDER BY date LIMIT 100; I am working arround with this Zend forum issue solution:…
Emilio Nicolás
  • 2,554
  • 5
  • 22
  • 29
1
vote
3 answers

Counting rows from a big mysql query (zend)

I a developing in zend and have a rather large mysql query. The query works fine and i get the list I expect. I am doing this using Select->Where.... below is the query. SELECT DISTINCT `d`.* FROM `deliverable` AS `d` INNER JOIN `groups` AS `g1`…
viciouskinid
  • 59
  • 1
  • 8
1
vote
2 answers

How can I receive bytea data from PostgreSQL through Zend_Db_Select?

I wrote a website with Zend Framework + Postgres. In PostgreSQL there is this table: create table images( id serial, title TEXT DEFAULT '', thumbnail bytea NOT NULL, original …
1
vote
3 answers

Zend_Db_Select EXISTS

One part of my query is EXISTS condition: $select->where( 'EXISTS(' . 'SELECT `price_property_id` FROM `property_price` ' . 'WHERE `price_property_id` = `pu_property_id`' . ' AND `price_value` >= ' . $params['price_min'] . ' AND…
Dmitry Teplyakov
  • 2,898
  • 5
  • 26
  • 46
1
vote
4 answers

How to inspect every query going to DB from Zend Framework

I have a complex reporting application that allows clients to login and view reports for their client data. There are several sections of the application where there are database calls, using various controllers. I need to make sure that client A…
1
vote
1 answer

zend db join resultset

I used zend_db_select for joining 3 tables, and in the result set array while I was expecting to see the column names with aliases, it returns an array with keys having no aliases. $dbSelect =…
krishna
  • 3,547
  • 5
  • 27
  • 29
1
vote
1 answer

Escaping input for LIKE in Zend_Db

What is the right way to escape text that is passed to query with LIKE pattern matching? The problem is that select()->where('field LIKE ?', $input . '%'); will be incorrect with $input = '%sometext'; UPDATED: 'vulnerable to' -> 'incorrect with'
eater
  • 408
  • 3
  • 9
1
vote
1 answer

Zend\db\sql - prepareStatementForSqlObject - still need to bind or worry about sql injection?

I'm using zf 2.4 and for this example in Zend\db\sql. Do I need to worry about sql injection or do I still need to do quote() or escape anything if I already use prepareStatementForSqlObject()? The below example will do the blind variable…
sparkmix
  • 2,157
  • 3
  • 25
  • 33
1
vote
3 answers

Zend 2: SQLSRV: $prepareParams is not being set

Can somebody explain me where the ->setPrepareParams(array $prepareParams) is called in Zend\Db\Adapter\Driver\Sqlsrv\Statement.php? Specifically, when I used this: $this->tableGateway->select(array("Personalnummer = $personalnumber")); It…
1
vote
1 answer

zend framework select join error getTable()

I am trying to implement this method in my model: class Application_Model_MenuProfilesProducts extends Zend_Db_Table_Abstract { protected $_name = 'menu_profiles_products'; public function fetchProducts($profileID) { $select =…
user253530
  • 2,583
  • 13
  • 44
  • 61
1
vote
1 answer

Join with Zend_Db, without having the columns of the joined tables

I use Zend_Db_Select to perform a query with a Join. I end up with the following SQL query : SELECT `Utilisateur`.*, `Ressource`.*, `Acl_Cache`.*, `Role`.*, `UtilisateurRole`.* FROM `Utilisateur` INNER JOIN `Ressource` ON Ressource.idJointure =…
Matthieu Napoli
  • 48,448
  • 45
  • 173
  • 261