Re: PEAR DB_DataObject

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pete,

I don't use PEAR / DB_DataObject, but it seems to me that that is a logical behavior, since 
all it seems that you passed to the class/object is the name of a table.  Is there a way of 
specifying columns, and selection criterion by passing those values into the class/object??
?

JUST GUESSING at Syntax here, but something like:

$record = DB_DataObject::factory( 'mytable', 'column1, column2, column3', 'column1 <> 
"0" and column2 <> "" ');

You have to think along the lines of how much information you have passed TO the 
class/object and how it would construct a select statement based on what you have 
passed to it.

Larr.

--- In php-objects@xxxxxxxxxxxxxxx, Pete <cgrp@...> wrote:
>
> 
> It seems to me that the factory command in the DB_DataObject database
> abstraction layer class from PEAR, brings back all fields from the
> database to PHP.  Is that correct?
> 
> (assuming a single record table)
> $record = DB_DataObject::factory( 'mytable' );
> $record->find();
> echo $record->data1 . ' : ' . $record->data2;
> 
> Doesn't that fetch all the fields, then throw away the ones that aren't
> needed?  It sounds like SELECT * FROM mytable, which we are always told
> is a Bad Thing.
> 
> -- 
> Pete Clark
>




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux