Date: 11/14/00
- Next message: dlobron <email protected>: "[PHP-DB] MySQL support compiled in, but functions not recognized"
- Previous message: LP: "Re: [PHP-DB] store image data in SQL Tables ?"
- In reply to: LP: "[PHP-DB] Database Tables and Classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I don't know if I'd call it wisdom, but...
I'm unsure how *exactly* you'd do it in PHP (I'm new to PHP), but in Smalltalk
I created an abstract class called RowAbstract (it used to be TableAbstract
but I changed it). RowAbstract defined class methods for:
table (returns an array of the tables used to create the row)
whereClause (returns the text of a where for creating a row -- usually a join
if mutiple tables are involved)
columns (returns an array of the columns you want selected)
database (which database name the tables are from)
Each subclass of RowAbstract defined a table row with its unique parameters.
To instantiate an array of rows (which is what a table is) I use something
like:
list := ContractRow where: nil using: anExternalDBConnection
nil - since I want all rows there is no 'where' clause.
anExternalDBConnection is the connection object to the database.
After this, list is my array of ContractRow objects. I changed the name
because the result of projections from the table is not another table, but an
array of rows, each of the rows being one ContractRow (that is, a row from my
Contract table).
If you (or anyone else) wants more information I can email you the code so you
can see exactly how it works. As long as PHP doesn't have screwy rules like
Java does the translation from Smalltalk to PHP shouldn't be that
difficult--at least not in an idiomatic way.
LP wrote:
> I am considering creating a Class, for
> each of my database tables, that will perform
> all sql calls for each particular table.
>
> Does anyone have any wisdom on this thought?
>
> LP
>
> __________________________________________________
> Do You Yahoo!?
> From homework help to love advice, Yahoo! Experts has your answer.
> http://experts.yahoo.com/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
-- .tom-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: dlobron <email protected>: "[PHP-DB] MySQL support compiled in, but functions not recognized"
- Previous message: LP: "Re: [PHP-DB] store image data in SQL Tables ?"
- In reply to: LP: "[PHP-DB] Database Tables and Classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

