ZF-1868: Add a unit test to fetch a LOB column

Issue Type: Unit Tests: Improvement Created: 2007-08-20T19:18:07.000+0000 Last Updated: 2010-02-19T14:37:55.000+0000 Status: Resolved Fix version(s): - 1.10.2 (24/Feb/10)

Reporter: Salvador Ledezma (ledezma) Assignee: Mickael Perraud (mikaelkael) Tags: - Zend_Db

Related issues: - ZF-5146

Attachments: - Common.php


As a first step to creating more test coverage for the Zend_Db component, I have created a simple unit test that fetches LOBs. It retrieves both a BLOB and a CLOB column, then does a string comparison.

The test is called testAdapterFetchLob() and is placed in the file:


This requires some DDL that creates a table with LOB columns and also populates the table with 1 row. This is provided in:


This may have to be changed because different databases may define LOBs differently. For example, MySQL uses TEXT, not CLOB.

Also, I made a DB2-specific modification to allow a string to be inserted as a BLOB in the file:


Please review the unit test and change as appropriate. If you also have some suggestions on what other type of LOB tests could be useful, I can add them as time permits.


Posted by Salvador Ledezma (ledezma) on 2007-08-20T19:19:04.000+0000

testAdapterFetchLob() is defined here

Posted by Salvador Ledezma (ledezma) on 2007-08-20T19:19:48.000+0000

DDL and population of LOB table

Posted by Salvador Ledezma (ledezma) on 2007-08-20T19:20:31.000+0000

DB2-specific change to convert a string to a BLOB.

Posted by Bill Karwin (bkarwin) on 2007-08-24T17:49:55.000+0000

Assign to Bill Karwin.

Posted by Salvador Ledezma (ledezma) on 2007-08-30T15:25:05.000+0000

I expanded the original test to now include 4 asserts:

  1. Number of rows returned (should now be 3)
  2. Select LOB column that contains data
  3. Select LOB column that contains null (NEW)
  4. Select LOB column that contains a zero-length string ('') (NEW)

Updated files now include:

tests/Zend/Db/TestUtil/Common.php -- contains DDL and data for table tests/Zend/Db/TestUtil/Db2.php -- DB2 specific data for a BLOB column tests/Zend/Db/Adapter/TestCommon.php -- testAdapterFetchLob() with 2 new asserts

Posted by Darby Felton (darby) on 2007-11-13T14:18:02.000+0000

Assigning to [~ledezma]

Posted by Thomas Weidner (thomas) on 2008-03-12T14:44:46.000+0000

Hy Salvador,

if you are not able to commit this patch, you should un-assign this issue so anyone with commit-rights will do this.

Otherwise please commit your changes and close this issue. ;-)

Posted by Salvador Ledezma (ledezma) on 2008-03-12T17:59:37.000+0000

I had submitted these patches for review by someone with commit authority.

Please use as you see fit.

Posted by Wil Sinclair (wil) on 2008-03-25T22:02:49.000+0000

Resetting 'fix version priority' and 'fix version' to be re-evaluated for next release.

Posted by Mickael Perraud (mikaelkael) on 2010-02-19T13:33:02.000+0000

Tests added with correction of ZF-5146 (r13071)

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.