Re: db abstraction: pass by reference versus return

From: Date: Fri, 12 Jul 2002 10:06:26 +0000
Subject: Re: db abstraction: pass by reference versus return
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-7683@lists.php.net to get a copy of this message
<smith@dybnet.de> wrote : >> IMO, inconsistency comes when you don't know what the method you call > will >> return. It has always been weird for me to think that a DB result > object >> could end up being a BD error object. I think 1) is more intuitive > because >> we know what the result will be and also because it is a lighter > solution >> when there are no errors. >> >> So +1 for 1) >> > > would you also say that methods that handel conversion should be handled > this way? > > For example: > $query = 'SELECT * from foo WHERE bar = '.getTextValue($bar); > > would then not work and instead something like this: > getTextValue($bar, $bar_quoted); > $query = 'SELECT * from foo WHERE bar = '.$bar_quoted; > > would be needed. Hi Lukas, No, I don't think it would make our life easier. In your example, one is supposed to know that getTextValue will return a text value (supposedly a string), not an error object or I don't know what. So I don't think this would be useful, it's not a common practice in PHP code. Anyway, thanks for asking me. I hope you will keep up with your DB_OK idea. Bertrand Mansion Mamasam

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