[prev] [thread] [next] [Date index for 2005/07/07]
Hi I'm developing an app running both under MySQL+Windows and under GNU/Linux+Postgres, and I'd appreciate some clarification of create() and= its ilk. (1) The docs state: -----><8----- create =09my $obj =3D Class->create(\%data); This is a constructor to create a new object and store it in the database. -----><8----- It seems to me 'create a new object' is true and 'store it in the database'= is false, in that with {AutoCommit =3D 0} the default under Postgres, then the= store simply does not take place. Ie the docs are wrong, or at least incomplete. Further, if I tried =09my $obj =3D Class->create(\%data); =09$obj -> update(); under {AutoCommit =3D 0} and Postgres, the store still does not take place. However, now the logic is wrong, because the update() has no effect. I need to do: =09$obj -> dbi_commit(); Right? (2) The docs state: -----><8----- update =09$obj->update; If /autoupdate is not enabled then changes you make to your object are not reflected in the database until you call update(). It is harmless to call update() if there are no changes to be saved. (If autoupdate is on there'll= never be anything to save.) Note: If you have transactions turned on for your database (but see "TRANSACTIONS" below) you will also need to call dbi_commit(), as update() merely issues the UPDATE to the database). -----><8----- (a) It seems to me 'changes you make to your object are not reflected in the= database until you call update()' is unclear because: o The sentence is in the negative, after 'autoupdate is not enabled' is= used o The concept of autoupdate is presented in 3 different ways: =09- sub autoupdate(N), ie code =09- Database handle attribute {AutoCommit =3D> N} ie code =09- Transactions turned on, ie English Hmm, what to do... (b) To a database guru the meaning of 'update() merely issues the UPDATE to= the database' is clear, but to a beginner, no. Far from it. Perhaps it means: Warning: If you have transactions turned on (AutoCommit off) (but etc...)= then update() does not actually store the data into the database. For that, you= will (also) need: =09$obj -> dbi_commit(). In this case the docs are unclear. What's lacking in the docs (for the benefit of beginners) is the point of= having an update() sub which doesn't update the way a beginner would expect...:-). Right? If I knew what I was talking about, I'd feel comfortable to offer a doc= patch... -- Cheers Ron Savage, ron@xxxxxx.xxx.xx on 7/07/2005 http://savage.net.au/index.html Let the record show: Microsoft is not an Australian company
create() 'v' the docs
|
Re: create() 'v' the docs
|
Generated at 16:36 on 28 Jul 2005 by mariachi v0.52