I'm not really a PHP guy, but I do have a couple of thoughts on this.  First an explanation of what some of these things are might be in order.  PDO is a PHP library (like mysqli or db2) it's definitely a php specific thing and sits on top of the database driver.  ODBC is not Windows specific it's a common api for working with various data base servers and has drivers for all the common SQL servers (MSSQL, MySQL, Postgres, Oracle...).  ODBC being an abstraction layer means you miss out on some database specific features.  I'm not familiar with the LOB aspect of PDO, but based on what you listed above it sounds like that serves as a bonus for PHP rather than the database.  Any common RDBMS will have support for data types larger than 4K (binary data is the db is pretty common), but you generally don't want to load the whole object in memory on the application  side (in PHP).  I've not used the PHP streams api either, but streams are a concept that exists in most web programming languages and the concept is almost always around loading objects a piece at a time and sending it on.

So what you're left with:

- PDO is a PHP class for database abstractions
- PDO is supposedly the preferred library for accessing your DB in PHP
- PDO::PARAM_LOB provides and interface for streaming large amounts of data out of your DB without eating all your server's memory

Hope that helps.


On Fri, Apr 4, 2014 at 2:07 PM, keith smith <klsmith2020@yahoo.com> wrote:
Hi,

I have a question about PDO.  I've written a class that I have tried to fashion after the Active Record design pattern.

I'm hung up on one thing - Large Objects (LOBs).  http://www.php.net/manual/en/pdo.lobs.php

The documentation says :

At some point in your application, you might find that you need to store "large" data in your database. Large typically means "around 4kb or more", although some databases can happily handle up to 32kb before data becomes "large". Large objects can be either textual or binary in nature. PDO allows you to work with this large data type by using the PDO::PARAM_LOB type code in your PDOStatement::bindParam() or PDOStatement::bindColumn() calls. PDO::PARAM_LOB tells PDO to map the data as a stream, so that you can manipulate it using the PHP Streams API.

The examples all use ODBC which is Windows.  I'm using MySql.  The manual does not say this limitation is limited to Windows though.

I would like to use PDO with a couple of applications I am creating and the data will be larger than 4kb.

Is this a driver thing?

Is it a PHP thing?

I know it is not a MySql limitation because I can define fields larger than 4kb.

I'm lost at what this means to me and how to apply this to my DB class.

Any help is much appreciated!!

Keith


---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss



--
Paul Mooring
Operations Engineer
Chef