PHP 4.0 Bug #5482: ODBC Support lacks ability to pass named parameters for MS Access
| From: | bram at xspace dot com | Date: | Sun, 09 Jul 2000 16:09:54 +0000 |
| Subject: | PHP 4.0 Bug #5482: ODBC Support lacks ability to pass named parameters for MS Access | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23873@lists.php.net to get a copy of this message | ||
From: bram@xspace.com
Operating system: WIN NT 4.0 (WIN 32)
PHP version: 4.0.1pl2
PHP Bug Type: ODBC related
Bug description: ODBC Support lacks ability to pass named parameters for MS Access
Preamble:
There is a similar but slightly different bug report 2976 that describes parameter passing problems
as well.
Steps to observe behaviour:
1) In MS Access (preferably 97 or 2000) create a table named PEOPLE containing two fields
username and password of any type.
2) Populate the table with a row of test data.
3) In MS Access create the following query name verifypassword:
SELECT username
FROM people
WHERE username = InputUsername AND password = InputPass
WITH OWNERACCESS OPTION;
Since the DB is not going to be secured for any test cases, do NOT include the
WITH OWNERACCESS OPTION, as it is pointless and may not work. When in a
secured database, this query will allow verification of a username and password
combination for a user that does not have access to the PEOPLE table without
giving direct access to the password field. I provide this only for a description of
necessity.
4) Make an ODBC DSN to the DB
5) In your PHP script connect to the DSN first, save connection to $conn.
6) In your PHP script, then add:
$prep = odbc_prepare( $conn, "SELECT * FROM VERIFYPASSWORD" );
$params = array( "test", "case" );
ODBC_Execute( $prep, &$params );
7) You will get a "missing parameters" error.
Problem:
There is no appearant way to populate MS Access parameters from PHP.
Since, in this case the query must be created under a user with priviledges to
a secured table, the query cannot be generated on the fly -- access will be denied.
Ideally, I should be able to populate my $params array as:
$params = array( "InUsername" => "test", "InPassword" =>
"case" );
Synonymous behaviour in ASP:
In ASP the RECORDSET object supports named parameters.
Obviously this functionality works in ASP.