RE: [PEAR-DEV] Proposal - HTML_DataGrid - Again

From: Date: Mon, 09 Feb 2004 14:59:04 +0000
Subject: RE: [PEAR-DEV] Proposal - HTML_DataGrid - Again
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-25558@lists.php.net to get a copy of this message
> -----Original Message----- > From: Markus Wolff [mailto:wolff@21st.de] > > well, relying on LIMIT is a bad idea, because not all databases support > it like MySQL does. Microsoft SQL Server, for example, only allows > specifying how many records you want to retrieve from the *beginning* of > the result set, but you can't define an offset value from where to start > - so it's practically worthless. > Well, there are hacks around this, but they are hacks! i.e.: SELECT TOP 20 * FROM users WHERE user_id NOT IN (SELECT TOP 10 user_id FROM users ORDER BY last_name) ORDER BY last_name > Therefore, having an adaptor class that can deal with the differences > between the possible datasources and that simply implements an iterator > interface (possibly even compatible to PHP5's new iterators, so it can > be used directly with foreach() and stuff) is the most flexible > solution. And one small extra class ain't *that* much overhead, the > benefits by far outweigh the drawbacks. > > It's just a cleaner approach, IMHO. I agree it is cleaner, but still not sure necessary. If there is no way for you to limit your data, or limiting slows down your query too much, then you have to load all of your records right? And since the datagrid handles the paging, then personally I would prefer converting my result set into an array with a C function like mysql_fetch_array or if im using db_dataobject, then using the toArray method to bind my data to the grid. > And as an application developer, I don't really want to care about what > I give to the DataGrid. If the data needs to be paged, the DataGrid will > know how to do it. Having an adaptor class for the datasource will make > adding a paging feature easy, and it can be implemented differently for > each type of datasource. > It seems that the data should be massaged with DB or DB_DataObjects. Im not sure implementing a DataManager is best because I feel that I would end up porting something like DB_DataObject into the DataGrid, which is what I don't want to do. Let me ponder this more Thanks again, your comments are very helpful! Andrew

« previous php.pear.dev (#25558) next »