![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.php archiveRe: Abstracting SQL Statements In An Object
From: Tony Marston <tony@NOSPAM.demon.co.uk>
Date: Sat Jul 16 2005 - 09:53:14 CEST
take a look at http://www.tonymarston.co.uk/php-mysql/databaseobjects.html
-- Tony Marston http://www.tonymarston.net "Scott Auge" <scott_auge@yahoo.com> wrote in message news:scott_auge-920603.10295915072005@news1.west.earthlink.net... > > I am looking for comments on something that lets me abstract database > updates in an object. > > Lemme explain what I am thinking: > > Lets say I have an object Person with... > > SetFirstName() > SetLastName() > > etc. > > (Basically the goal is for the development team to use the objects and > not try to write to the database themselves.) > > Well, what I am trying to avoid is when I call SetFirstName() and then > call SetLastName() the execution of two UPDATE statements. I would like > to combine it all into one single UPDATE or INSERT so I am not beating > up on the database. > > I am thinking I would need to store the changes into variables local to > the class and then maybe calling a SendSQL() function or something like > that to generated SQL changes of the data to the database. > > Something like: > > $DB->query("BEGIN TRANSACTION"); > > // Person fools around with $DB > $Person->SetFirstName("Something"); > $Person->SetLastName ("Something"); > $Person->SendSQL(); > > // Another object fooling around with $DB > $AnotherOBj->SomeMethod ("Foo"); > $AnotherOBj->SendSQL(); > > $DB->query ("COMMIT TRANSACTION"); > > > > Anyhow - opinions and experiences are welcome!Received on Mon Oct 17 21:08:27 2005 |