Re: Re: Placeholder queries

From: Date: Thu, 10 Apr 2003 14:15:24 +0000
Subject: Re: Re: Placeholder queries
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-15098@lists.php.net to get a copy of this message
It's ok to have placeholders just for a selection of types isn't it? Or is that bad practice? I could see that for MDB a placeholder for LOBs would be very useful, because the LOB will then be created behind the scenes and the user does not need to worry about it.
I've been looking at this recently also. I think it's just confusing to have different symbols for different datatypes. I think a better solution is the MDB/JDBC-like solution where you have different functions that substitute the params. $BlobObject = new Blob(); $BlobObject->fromFile($file_path); $stmt = $conn->prepareStatement('INSERT INTO files (name, size, contents) VALUES (?, ?, ?)'); $stmt->setString(1, basename($file_path)); $stmt->setInteger(2, filesize($file_path)); $stmt->setBlob(3, $BlobObject); $stmt->executeUpdate(); This isn't exactly like MDB works currently -- it's more like JDBC. I think, however, that if type is important -- and granted that it is -- this is a pretty easy way to address the issue. Seems that ? is generally a more compatible wildcard -- and won't have to be substituted for something else when the underlying engine actually supports prepared queries. 'Course oracle uses the :name type syntax .... so maybe there should be an option to choose wildcard syntax (making it more optimized for one db or another)... Hans

Attachment: [application/x-pkcs7-signature] S/MIME Cryptographic Signature smime.p7s
« previous php.pear.dev (#15098) next »