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
4
votes
1 answer

use zend db with whare and orwhere when orwhere are in ()

hi i want create this sql in zend framework dbclass selec * from table where type = 2 AND (name LIKE '%4%' OR name LIKE '%5%') how i can do this with zend where and orwhere? using normal mode will generate this sql …
Silverboy.ir
  • 187
  • 2
  • 11
4
votes
3 answers

Zend DB select only 1 table with multiple joins

I'm using Zend DB to generate a query using the following code: $table->select() ->setIntegrityCheck(false) //required for multi-table join ->from('modules') ->joinInner( 'basket_modules', 'modules.id…
Hayley
  • 2,977
  • 3
  • 18
  • 16
4
votes
5 answers

zf2 make a join between two different databases

I am trying to make a join between two tables placed in different databases with Zend Framework 2. The first table is called users and is stored in the database admin The second table is called hierarchy and is stored in the database customer I load…
ivan.garcia
  • 41
  • 1
  • 2
4
votes
2 answers

Insert into .. select from .. using zend db

I have the following raw query which moves items from a shopping cart to an order table: insert into webshop_order_item ( order_id, product_id, count ) select 1, product_id, count from webshop_cart I am using the Zend…
sroes
  • 14,663
  • 1
  • 53
  • 72
4
votes
2 answers

zend relationships with select

I am new to zend. I have been asked to redevelop a website that was once written in plain PHP and put it into the zend framework. I am having a lot of trouble with database relationships, I cant seem to get my head round defining and querying…
user138095
4
votes
2 answers

Character missing when saving a row?

$userTb = new My_Tb_User(); //Child of Zend_Db_Table_Abstract $row = $userTb->find(9)->current(); $row->name = 'STÖVER'; $row->save(); Inside user table at row 9 for name column value ST gets stored instead of STÖVER ? Ö is a german character…
4
votes
1 answer

MasterSlaveFeature How-To

I currently have my Db Models using AbstractTableGateway and all my select/insert/update/delete queries are working just fine. But now I would like to add the MasterSlaveFeature and I'm a bit confused on how to do this. The documentation doesn't…
Diemuzi
  • 3,507
  • 7
  • 36
  • 61
4
votes
1 answer

MySQL Query - Select all posts and count comments for each one

It's 3:30 AM in my country so I need to sleep but I can't without this: I'm trying to get all posts (using Zend_Db) and count comments for each one. Schema blog_posts: +---------------+------------------+------+-----+---------+----------------+ |…
Frederick Marcoux
  • 2,195
  • 1
  • 26
  • 57
4
votes
4 answers

convert Zend Db Select query to sql query

Are there any ways to convert Zend db Select or Zend DB query to SQL query before querying the database? Any other workarounds? As I want to build a more complex SQL query that Zend DB cannot handle, without modifying my current Zend db code…
Capitaine
  • 1,923
  • 6
  • 27
  • 46
4
votes
1 answer

Issue caching Zend_Paginator with DB profiler enabled

I am having a bizarre issue when trying to cache Zend_Paginator and having the Zend_Db_Adapter profiler enabled. It creates a cache file, but each ID is different meaning that the cache hit will never happen. After disabling the profiler…
JasonDZA
  • 51
  • 3
4
votes
6 answers

Constraint violation / Duplicate key when reindexing Magento

I am using Magento CE 1.6.2 and I have a problem with my reindexer ( the url_rewrite ) php shell/indexer.php --reindex catalog_url Catalog URL Rewrites index process unknown error: exception 'PDOException' with message 'SQLSTATE[23000]: Integrity…
user1023021
  • 343
  • 4
  • 8
  • 13
4
votes
1 answer

Handeling M-N Relationship in Zend Framework 2

With beta4 and latest beta5 the DB-Feature-Implementation appears to have pretty much finished. There's a couple of tutorials out there how to handle a single Database using the TableGateway Pattern, but it appears there is none for handling…
Sam
  • 16,435
  • 6
  • 55
  • 89
4
votes
1 answer

Is it possible, that INSERTS are delayed when executed from PHP (using ZEND)?

When I have a loop like this: foreach(...) { $r1 = $zend_db->fetchRow("SELECT ... "); $zend_table->insert($data_array, $where); } ... running a few thousand times. Is it possible, that $r1 doesn't contain a record inserted in the previous…
johjoh
  • 464
  • 4
  • 18
3
votes
4 answers

Import large .sql file with php and zend framework

I have to import a (big) .sql file to MySQL with PHP and the Zend framework. The connection is open, and I have $_sql containing the whole content of the SQL file, but - of course, a simple $this->db->query($_sql); will not work. What can I do to…
Paladin
  • 1,637
  • 13
  • 28
3
votes
1 answer

Zend_Db_Profiler log to file

Is there a simple way to log to queries to a file? I have Firebug profiling working no problem with: resources.db.params.profiler.enabled = "true" resources.db.params.profiler.class = "Zend_Db_Profiler_Firebug" It would be nice to log this to a…
Michael
  • 3,568
  • 3
  • 37
  • 50