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
3
votes
3 answers

How can I get Zend Db to return a rowset rather an array when performing a UNION query?

I have a result set that is the result of a MySQL UNION query. The code I am using to fetch the data is: $union_select = $PagesTable->getAdapter()->select() ->union(array('(' . $legal_resources_select . ')', '(' . $pages_select .…
Treffynnon
  • 21,365
  • 6
  • 65
  • 98
3
votes
1 answer

zend adapter beginTransaction() and commit() fails

I am facing a strange issue The Zend_DB_Adapter's beginTrasaction() and commit() methods don't seem to be working as expected. I have INSERT statements (in a FOR LOOP) enclosed in beginTrasaction() and commit() methods. But even when error occurs…
krishna
  • 3,547
  • 5
  • 27
  • 29
3
votes
1 answer

Zend DB Table: All Values are Strings

I am using Zend DB Table and DB Table Row. When I get a row object for any of my tables, I see that the types have all been changed to strings, even the auto-incrementing primary key. Is that normal? Do I need to explicitly define the schema to get…
DatsunBing
  • 8,684
  • 17
  • 87
  • 172
3
votes
3 answers

Using a Zend_Db Database connection

I'm trying to teach myself the Zend Framework. I have some extensive experience using custom-frameworks but have never used Zend. It's like trying to use a knife and fork with mittens on. I've got a system up and running. A database connection is…
Alex C
  • 16,624
  • 18
  • 66
  • 98
3
votes
1 answer

Zend_Db_Expr NOW() doesn't work?

I am trying the simple insert: $data = array ( 'whatever' => 'nevermind', 'etc' => 'more data', 'updated_on' => new Zend_Db_Expr('NOW()') ); $this->getDbTable()->insert( $data ); Everything gets inserted correctly, but updated_on is null. Am I…
Sejanus
  • 3,253
  • 8
  • 39
  • 52
3
votes
1 answer

zend expressive - zend db

I'm trying to use zend expressive and looking at how to do database stuff now. I was looking at this, but it's not clear. I used composer to install zend-db and it mentioned to add a line in dependencies.global.php and then use container in the…
sparkmix
  • 2,157
  • 3
  • 25
  • 33
3
votes
4 answers

Zend Framework, pdo_mysql and problems with memory limit - Why?

I have the following set-up: Zend Framework 1.10.8 database adapter: pdo_mysql memory limit: 128MB table type: myisam table size: 4 MB number of records: 22.000 number of columns: aprox. 70 I want to select everything from the table, which should…
herrjeh42
  • 2,782
  • 4
  • 35
  • 47
3
votes
1 answer

How to print exact sql query before execute in Zend Framework 2

I am working on an application using Zend framework 2. I'm using TableGateway to select, insert, update and delete query. 1. My question is how to print exact sql query before executing INSERT, UPDATE and DELETE statement? For SELECT statement here…
Katty
  • 489
  • 6
  • 28
3
votes
1 answer

When to use which Zend_Db class? Zend_Db_Select vs. Zend_Db_Table_Abstract

I think it's possible to write select queries with either Zend_Db_Select or Zend_Db_Table_Abstract, but I don't understand when to use which of the two. Is one more optimized for something than the other? Are joins "easier" with one or the…
Niels Bom
  • 8,728
  • 11
  • 46
  • 62
3
votes
2 answers

Dynamic Database Connections with Zend

The result I'm trying to achieve involves having an application with a database with minimal tables that store data regarding users on the system, this database would be used to verify user's login details when they login to the application. What I…
machinemessiah
  • 424
  • 1
  • 5
  • 14
3
votes
2 answers

Where should I implement cache within Zend_Db?

I'm looking to implement a cache within Zend_Db, there isn't any native method to provide a cache to Zend_Db, so I'm wondering where should I do it. I took a look to the Zend_Db_Table_Abstract (I'm extending it in a custom…
John
  • 119
  • 5
3
votes
1 answer

Mixing Zend_Db with ORM Classes

Zend has Zend_Db but it's not a full ORM. I already have sections of an app written in a way that uses Zend_Db. I do however want to integrate a full ORM into the application to use it for more complex database operations, but I don't want to have…
jblue
  • 4,390
  • 4
  • 46
  • 79
3
votes
2 answers

How to define relationships in Zend Framework

I have two simple tables: Projects and SubProjects which I'd like to print every subproject with the respective project in a table. So I wrote this: class Admin_Model_Projects extends Zend_Db_Table_Abstract { protected $_name = 'main_projects'; …
Rodrigo Souza
  • 7,162
  • 12
  • 41
  • 72
3
votes
1 answer

How to fetch results in an array with ZF2

I am trying to get some distinct values from DB with ZF2 using Tablegateway. $select = $this->sql->select($tableGateway->getTable()); $select->columns(array('city')); $select->quantifier('DISTINCT'); $stm =…
Franck
  • 31
  • 2
3
votes
3 answers

zend newbie question - "No adapter found for "

Working through a zend tutorial & get this message, & not sure where to look. thanks, An error occurred Application error Exception information: Message: No adapter found for Model_DbTable_Books Stack trace: #0…
roger rover
  • 601
  • 4
  • 10
  • 16