[PEPr] Proposal for Database::table_browser

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

[PEPr] Proposal for Database::table_browser

by Isaac Tewolde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Isaac Tewolde (http://pear.php.net/user/tewolde) proposes Database::table_browser.

You can find more detailed information here:
 http://pear.php.net/pepr/pepr-proposal-show.php?id=570

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] Comment on Database::table_browser

by Till Klampaeckel-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Till Klampaeckel (http://pear.php.net/user/till) has commented on the proposal for Database::table_browser.

Comment:

Hey,



a couple questions, ...



1) In general, how do you see this package versus DB_Table?



2) Being Mysql-only, what would it take you to e.g. port your code to a
MDB2_Table class instead? The class could serve the same purpose, but be
compatible with different DB backends, etc..



3) If you don't like the idea of MDB2_Table, I'd still vote for a way to
query different database backends (maybe through PDO). I'd also like to see
an interface to inject a DB connection into your class vs. creating one
"inside". Support for Mysqli wouldn't hurt either.



Generally, I like your idea a lot, since (at least IMHO) it's a pain to
write all those calls again and again e.g. when you are writing an frontend
to a database for administrative work.



Food for thought!



Cheers,

Till

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] Comment on Database::table_browser

by Isaac Tewolde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Isaac Tewolde (http://pear.php.net/user/tewolde) has commented on the proposal for Database::table_browser.

Comment:

Excellent suggestions, there is no reason to depend solely on mysql. I
think MDB2 is a very natural next step for this. I also like the idea of
bringing in a database connection.



Both of these are not difficult to implement, the actual mysql calls are
contained in a few methods that can be re-implemented to use MDB2.



Comparing with DB_table, there are differences both in implementation and
the goal. This library is closer to the active record model. Another
difference is that this library is further removed from the bare sql
compared with DB_Table.



The idea behind this library is the "browser" model where one can
sequentially step through and explore the data. It grew beyond this of
course, but I would like to keep the interface simple and easy to use.



Thanks,

Isaac.

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] Comment on Database::table_browser

by Philippe Jausions-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Philippe Jausions (http://pear.php.net/user/jausions) has commented on the proposal for Database::table_browser.

Comment:

Several flaws / questions:



1) Missing support for multi-column primary key and sorting

2) I'm not understanding the reason being the 2 steps: create instance
then select table. What is the benefit? I feel that being able to reuse the
same browser instance for 2 different tables will lead to confusion in user
code. A static method (factory, singleton,...) would be more appropriate.

3) As Till already pointed at, MDB2 and / or PDO would be much better,
especially the former when it comes to compatibility / portability.

4) No Iterator / IteratorAggregate implementation

5) You may want to update the examples. There are discrepancies between
comments and method calls.

6) Instead of referring to "category", using "column" sounds more generic,
and more related to an actual "table"

7) I would also reserve the term "item" when accessing by value, and "row"
when browsing.

8) No ArrayAccess implementation

9) Way far from PEAR's coding standards, but this is very minor at this
stage of proposal given the items above.

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] Comment on Database::table_browser

by Isaac Tewolde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Isaac Tewolde (http://pear.php.net/user/tewolde) has commented on the proposal for Database::table_browser.

Comment:

Several flaws / questions:



1) Missing support for multi-column primary key and sorting

-I want a simple interface so I do not want to add this support just yet.
The same effect is achieved using filters anyway so it is not a hurdle.
Multiple key sorting will be added in the next version.



2) I'm not understanding the reason being the 2 steps: create instance
then select table. What is the benefit? I feel that being able to reuse the
same browser instance for 2 different tables will lead to confusion in user
code. A static method (factory, singleton,...) would be more appropriate.

-Agreed, excellent suggestion, I will implement this in this version.



3) As Till already pointed at, MDB2 and / or PDO would be much better,
especially the former when it comes to compatibility / portability.

-Yep. The next version will use MDB2.



4) No Iterator / IteratorAggregate implementation

-My objective was to use a browser model, where one creates a browser
object to see successive snapshots of data. I want to give the user the
ability to get these snapshots and not get in the way of what they do with
the results. The object is the browser, the results are transient.



5) You may want to update the examples. There are discrepancies between
comments and method calls.

-Will do, thanks.



6) Instead of referring to "category", using "column" sounds more generic,
and more related to an actual "table"

7) I would also reserve the term "item" when accessing by value, and "row"
when browsing.

-Terminology is a devilish problem. Agreed I will fix this issue on this
version.



8) No ArrayAccess implementation

-I am not sure I understand this...is this similar to your 4th point?



9) Way far from PEAR's coding standards, but this is very minor at this
stage of proposal given the items above.

-I will be adding more documentation, what would you say is the most
glaring difference(s)?

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PEPr] Comment on Database::table_browser

by tfk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Aug 28, 2008 at 8:25 PM, Isaac Tewolde <isaac@...> wrote:
>
> Isaac Tewolde (http://pear.php.net/user/tewolde) has commented on the proposal for Database::table_browser.
>
> Comment:

Thanks for replying. Looking forward to all that then. :)

Till

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PEPr] Comment on Database::table_browser

by Christian Weiske :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Isaac,


> confusion in user code. A static method (factory, singleton,...)
> would be more appropriate. -Agreed, excellent suggestion, I will
> implement this in this version.
Factory please, no singleton.

> 4) No Iterator / IteratorAggregate implementation
> -My objective was to use a browser model, where one creates a browser
> object to see successive snapshots of data. I want to give the user
> the ability to get these snapshots and not get in the way of what
> they do with the results. The object is the browser, the results are
> transient.
Implementing an Iterator interface means that you can
 foreach ($tablebrowser as $row) {
      ...
 }

> 8) No ArrayAccess implementation
> -I am not sure I understand this...is this similar to your 4th point?
Same as 4, but with []

> 9) Way far from PEAR's coding standards, but this is very minor at
> this stage of proposal given the items above.
> -I will be adding more documentation, what would you say is the most
> glaring difference(s)?

Try to run php codesniffer on your code.

--
Regards/Mit freundlichen Grüßen
Christian Weiske

-= Geeking around in the name of science since 1982 =-


signature.asc (204 bytes) Download Attachment

[PEPr] Changes in proposal for Database::table_browser

by Isaac Tewolde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Isaac Tewolde (http://pear.php.net/user/tewolde) has edited the proposal for Database::table_browser.

Change comment:

-Created a factory class to deal with the creation of new table_browser
objects

-Re-wrote the example.php to reflect new changes

-table_browser can also be created without a factory method, but in that
case it requires a mysql resource as a paramater

-Some of the terminology has been changed to be more clear



Please review the proposal:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] Comment on Database::table_browser

by David Coallier-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


David Coallier (http://pear.php.net/user/davidc) has commented on the proposal for Database::table_browser.

Comment:

- Static SQL (Portability problems)

- Use MDB2 instead of your own db layer

- Of course the CS are far from PEAR's standard but as mentioned before,
it's rather unimportant at this point (Even though it'd probably encourage
people to review the proposal if it was a bit clearer)

- With previous point, of course you'll have to rename and restructure a
lot of your code

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] Changes in proposal for Database::table_browser

by Isaac Tewolde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Isaac Tewolde (http://pear.php.net/user/tewolde) has edited the proposal for Database::table_browser.

Change comment:

-Class now used mdb2 instead of the mysql methods.

-New examples added for insertRow & updateRow methods

-Renamed methods and class properties to be closer to pear cs



Please review the proposal:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] Call for votes on Database::MDB2_TableBrowser

by Isaac Tewolde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Isaac Tewolde (http://pear.php.net/user/tewolde) has initiated the call for votes on Database::MDB2_TableBrowser.

Please review the proposal and give your vote here:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] +1 for Database::MDB2_TableBrowser

by Igor Feghali-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Igor Feghali (http://pear.php.net/user/ifeghali) has voted +1 on the proposal for Database::MDB2_TableBrowser.

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570
Vote information:
http://pear.php.net/pepr/pepr-vote-show.php?id=570&handle=ifeghali

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] +1 for Database::MDB2_TableBrowser

by Till Klampaeckel-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Till Klampaeckel (http://pear.php.net/user/till) has voted +1 on the proposal for Database::MDB2_TableBrowser.

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570
Vote information:
http://pear.php.net/pepr/pepr-vote-show.php?id=570&handle=till

This vote is conditional. The condition is:

Hey there,



first off, thanks for improving the class and implementing it with MDB2.



Here is my (quick) feedback which makes this vote conditional:



1) Even though you spent a lot of time documenting inline, there's room for improvement (see "8").



2) Fix the package.xml (and use "pear package" to create a release, also, your first version should not be 1.0 and also not stable. ;)) Also add dependencies, such as MDB2 etc. to that file.



3) When you add a limit to the query, please explore MDB2's setLimit() to make your code portable.



4) The Exception class should extend PEAR_Exception, and should also go in its own File.



5) Follow the naming convention, in your repository you want:

MDB2/

MDB2/TableBrowser.php

MDB2/TableBrowser/DBException.php



The above assumes your classes are called:

MDB2_TableBrowser

MDB2_TableBrowser_DBException



6) This is a minor, but I believe when you wrote "Santize" (e.g. dbSantizeIdentifier(...)), you meant "Sanitize".



7) In your exception class, I like how you pass in the PEAR_Error (well, essentially MDB2_Error), what I'd like to see is that you extend and take more information then the "getMessage()" into the exception - e.g. the error code, maybe getDebugInfo() etc..



With no offense (to MDB2 or anyone working on it :)), but some MDB2 error messages are pretty plain and I found e.g. getDebugInfo() to be way more helpful in most situations. IMHO it would be less useful for the developer if that information is lost when you transfer the MDB2_Error to your exception.



8) Run "phpcs" (http://pear.php.net/package/PHP_CodeSniffer) on your code, this will help you to get your code up to PEAR coding standards and also let you know where and how to improve your documentation.



9) Since (I think) you always check the table definition, maybe add support for auto discovery of the PK (in case none is supplied). :)



10) Try to exit early (with return), vs. having huge if/else statements in your code:



For example:

function foo()

{

  if ($whatever) {

    return;

  }

  return false;

}



11) Instead of dbDoSelect(), maybe you want to look into the MDB2 shortcuts getAll(), getRow(), getOne() etc. - wherever they make sense.



12) Last but not least, make sure to change a license for the code. Many people swear by BSD, MIT or LGPL licenses. :)





One final question, difference of your factory vs. ctr - the ctr allows me to use my own MDB2 connection, correct?



I liked the example a lot (though I did not run it). MDB2_TableBrowser looks pretty easy to work with, and I look forward to it.



Hope I didn't oversee anything. Didn't have too much time.

If you have questions, or whatever, feel free to get in touch.



Cheers,

Till

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] +1 for Database::MDB2_TableBrowser

by Brett Bieber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Brett Bieber (http://pear.php.net/user/saltybeagle) has voted +1 on the proposal for Database::MDB2_TableBrowser.

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570
Vote information:
http://pear.php.net/pepr/pepr-vote-show.php?id=570&handle=saltybeagle

This vote is conditional. The condition is:

Meet Till's conditions and I'm +1.

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] +1 for Database::MDB2_TableBrowser

by Ali Fazelzade :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ali Fazelzadeh (http://pear.php.net/user/afz) has voted +1 on the proposal for Database::MDB2_TableBrowser.

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570
Vote information:
http://pear.php.net/pepr/pepr-vote-show.php?id=570&handle=afz

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PEPr] +1 for Database::MDB2_TableBrowser

by Till Klampaeckel-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 11, 2008 at 3:25 PM, Till Klampaeckel <till@...> wrote:
>
> Till Klampaeckel (http://pear.php.net/user/till) has voted +1 on the proposal for Database::MDB2_TableBrowser.
>
> Proposal information:
> http://pear.php.net/pepr/pepr-proposal-show.php?id=570
> Vote information:
> http://pear.php.net/pepr/pepr-vote-show.php?id=570&handle=till
>
> This vote is conditional. The condition is:

Hey,

for the sake of simplicity, I also wouldn't mind if you call your
interfaces insert() and update(). Since all you do is update/insert
rows there is no confusion as of what is updated and inserted. You
might as well keep it short? But that's just a suggestion, nothing I
want to demand. :)

And speaking of which - one thing, I'd really like you to add is "delete()".

Till

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] -1 for Database::MDB2_TableBrowser

by Christian Weiske-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Christian Weiske (http://pear.php.net/user/cweiske) has voted -1 on the proposal for Database::MDB2_TableBrowser.

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570
Vote information:
http://pear.php.net/pepr/pepr-vote-show.php?id=570&handle=cweiske

Comment:

- How do I generate complex statements?

  e.g. "WHERE (name = "duck" OR name = "zebra") AND lifespan < 5"

- Is there a way to retrieve the result set? I maybe have 10000 resulting
rows that I want to display, but not load into memory at once.

- MDB2_TableBrowser.php has the wrong location

-  * @package  MDB2_TableBrowser

 * @category Database

 * @author   Lukas Smith <smith@...>

 wtf?

- do not use ini_set in your files

- properties are not documented

- "@param unknown_type" doesn't help anyone

- you are writing php5 code. no & anymore to get references ("=& new")

- use phpcs on your code

- provide an array and an iterator interface, so that I can use

   $browser[0] instead of $browser->getRow(0)

   and

   foreach ($browser as $row) instead of foreach($browser->getRows())

- "Data Reterival functions"?

- you don't escape the data directly in insertRow

- "print $insert_sql;" shouldn't be in your code, same for "print $query"

- updateRow generates its own LIMIT statement - you should use mdb2'
inbuilt function for that

- no docblocks for methods at the bottom

- what if I like db row objects? why do you force
"$result->fetchRow(MDB2_FETCHMODE_ASSOC)"?

- use quoteSmart instead of quote

- MDB2_TableBrowser_DBException: $message is not defined

- don't drop the pear error object code and user info



All in all there are too many issues to be called for votes yet. Further,
I don't see a real benefit of this class apart from saving 2 lines of code.
I don't think the 400 line class doesn't deserve a standalone package, a
helper class in mdb2 itself would suffice. The approach to generating SQL
by defining filters is way too limited, I'd like to see a more general
approach (something like Zend's DB Select shit) - but that'd require a real
well-thought interface on its own and would probably not be part of this
class. So a -1 from me.

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] -1 for Database::MDB2_TableBrowser

by Alexey Borzov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Alexey Borzov (http://pear.php.net/user/avb) has voted -1 on the proposal for Database::MDB2_TableBrowser.

Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=570
Vote information:
http://pear.php.net/pepr/pepr-vote-show.php?id=570&handle=avb

Comment:

The package depends on MDB2 which is not a E_STRICT-compatible package, so
it is against RFC 419
http://pear.php.net/pepr/pepr-proposal-show.php?id=419 to propose it. It is
also not a subpackage of MDB2, so does not qualify for an exception.



Also while the package tries to use a DB abstraction layer, it still has
MySQL-specific syntax, i.e. "INSERT ... SET foo = bar".



I suggest reworking the proposal and creating MySQL_TableBrowser instead
which will depend only on one of the available MySQL PHP extensions and be
E_STRICT-compatible.

--
Sent by PEPr, the automatic proposal system at http://pear.php.net

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PEPr] +1 for Database::MDB2_TableBrowser

by Ken Guest :: Rate this Message: