Questions tagged [zend-db]

Database access component for the Zend Framework.

for PHP 5 includes a database access component, referred to as Zend\Db.

The Zend\Db component includes features such as:

  • Database connection factory class.
  • Adapter for multiple brands of database, closely matching the interface, and also supporting other non-PDO database interfaces such as mysqli and oci.
  • Simple query builder for generic SELECT syntax.
  • statement profiler and logger.
  • Table Data Gateway and Row Data Gateway classes. Together these are similar to the popular Active Record pattern.

Resources:

  1. Github repository
1092 questions
0
votes
3 answers

Zend DB multiple joins don't work

I have the following code, this way it does not work. $query = $this->select() ->from(array('c' => 'contrato'), array('*')) ->setIntegrityCheck(false) ->join(array('ch' => 'contrato_host'),'ch.id_host …
0
votes
1 answer

Zend Db Results escaped and html url encoded

When I use Zend DB (PDO Mysql Adapter), I'm getting back results that are not only escaped, but also HTML url-encoded. I'm inserting the rows into the database as is, not escaped or html encoded. I'm curious to know: How I can get back results that…
somejkuser
  • 8,856
  • 20
  • 64
  • 130
0
votes
1 answer

ZendFramework2 AbstractTableGateway getSql

I got a ZF2 project with 2 Models PosTable/TopTable which extend AbstractTableGateway. I want to Paginate results from those Tables so i have a Pagination function in both of them. this is what the PosTable Model looks like: ... class PosTable…
0
votes
1 answer

Whats the most efficient way to do updates with Zend_Db and MySQL

I have a method which loops over an array of objects and commits an update statement per object (a total of 15 objects with 5 fields each). This may have to be performed hundreds or even thousands of times a second, depending on the level of traffic…
codecowboy
  • 9,835
  • 18
  • 79
  • 134
0
votes
1 answer

Zend Framework 2 - Doctrine 2 - How to use GeoPointFields

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?
Ron
  • 22,128
  • 31
  • 108
  • 206
0
votes
1 answer

prevent sql injection plus using regexp in zend

I want to prevent sql injection as well as want to use REGEXP to get similar results in the same query. I know I prevent sql injection like this $this->getAdapter()->fetchAlll("SELECT * FROM $this->_table WHERE email = ? ", array($email)); Now I…
Awais Qarni
  • 17,492
  • 24
  • 75
  • 137
0
votes
2 answers

Zend_Db_Select with 'FOR XML PATH' for SQL Server

I'm trying to code the following query using Zend_Db_Select: SELECT p1.SKU, ( SELECT ',' + Status FROM "Products" "p2" WHERE p2.SKU = p1.SKU ORDER BY "Status" FOR XML PATH ('') ) AS "Statuses" FROM "Products" p1 GROUP BY SKU This is what I…
Brad303
  • 1,161
  • 8
  • 10
0
votes
2 answers

Zend Framework DB table fetch array

is it possible to fetch array from db, taking one column as array key and other column as array value? My current code: $table = new Zend_Db_Table('translations'); $where = $table->getAdapter()->quoteInto('lang = ?', $locale); $result =…
Bounce
  • 2,066
  • 6
  • 34
  • 65
0
votes
1 answer

Zend $db->quote not encoding special characters

I'm trying to use Zend's insert with the following string: Almoço Whether or not I use zend's quoteInto function, the string is inserted into the database as: Almoço How do I fix it so that the string I write/read to/from the database is the same…
Gil Birman
  • 35,242
  • 14
  • 75
  • 119
0
votes
1 answer

How to call a function of db table row class from a controller in zend framework?

I am trying to call a function exists in my dbtable row class ie Test.php.and I want to call it from my controller. My dbtable class is Tests. $obj=new Model_Test(); $obj->testFunction(); but it's not working and giving the below error. Notice:…
ehp
  • 2,495
  • 6
  • 29
  • 43
0
votes
2 answers

Select left in zend

How to do something like this in zend: SELECT LEFT(log_browser, LOCATE(' ', log_browser)) AS browser, COUNT(*) AS amount FROM logs GROUP BY LEFT(log_browser, LOCATE(' ', log_browser))
0
votes
1 answer

Using table aliasing with zend_db_table objects

Suppose I have a table: $someTable = new Zend_Db_Table ('sometable'); I know I can build a query using the table's literal name. $sel = $someTable -> select () -> from ('sometable', array ('col_foo', 'col_bar')) …
GordonM
  • 31,179
  • 15
  • 87
  • 129
0
votes
1 answer

ZEND search with MySQL Match and Union

I have to confess that I cannot work out how to complete this. I can get the query working in MySql, and I can get simple table-or-view queries in Zend Framework, but this is beyond me! Here's the query I'm trying to run: SELECT * from ( SELECT…
Andrew
  • 25
  • 6
0
votes
1 answer

How to call a Oracle Stored Function/Procedure with a list of numbers by PHP and Zend DB

This short description shows how: to connect a Oracle database with PHP Zend DB to call a Stored Procedure/Stored Function with Zend DB to pass a real array or a collection of integers as input parameter to a Stored Procedure/Function (I will not…
gfjr
  • 1,308
  • 2
  • 13
  • 17
0
votes
1 answer

zend framework 2 no catch PDO exceptions using Db Adapter

I am using the Zend\Db\Adapter\Adapter to launch queries with PDO_Mysql driver. I want to catch the primary key violation with PDOException class. The following code catches correctly the exception and shows the first message. It's based on a query…
josepmra
  • 617
  • 9
  • 25