php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #79579 odbc_exec does not prepare the SQL statement
Submitted: 2020-05-10 09:01 UTC Modified: 2020-05-11 07:40 UTC
From: ondrej dot popelka at keboola dot com Assigned: cmb (profile)
Status: Closed Package: ODBC related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
9 - 9 = ?
Subscribe to this entry?

 
 [2020-05-10 09:01 UTC] ondrej dot popelka at keboola dot com
Description:
------------
The documentation for odbc_exec states that it does "Prepare and execute an SQL statement". From the behavior and source code https://github.com/php/php-src/blob/a07e75aa65e6658e8180e261a4ee29bc5caa4f56/ext/odbc/php_odbc.c#L1357 it looks that it only executes the provided statement. 

I understand that there may be some dispute in what "prepare" means. From the ODBC Spec http://www.simba.com/wp-content/uploads/2016/03/ODBC_specification.pdf
Page 81-82) abbreviated:

"When SQLExecDirect is called, the driver:
- Modifies the SQL statement to use the data source's SQL grammar.
- Retrieves the current parameter values.
- Sends the statement to the data source for execution.
- Returns any errors."

"When SQLPrepare is called, the driver:
- Modifies the SQL statement to use the data source's SQL grammar.
- Sends the statement to the data source for preparation.
- Stores the returned access plan identifier for later execution"

The odbc_exec function does not call SQLPrepare and it does not send the statement to the data source for preparation. Neither it returns the access plan. Therefore it does not fulfill the operations of SQLPrepare.

Expected result:
----------------
The documentation for odbc_exec states that it does: 

Directly execute an SQL statement (using SQLExecDirect as specified in ODBC 1.0 Standard)



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-11 07:40 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=1098a2f35d41a1bb3bbab63a02e671d9d7a8e4ee
Log: Fix #79579: odbc_exec does not prepare the SQL statement
 [2020-05-11 07:40 UTC] phpdocbot@php.net
-Status: Open +Status: Closed
 [2020-05-11 07:40 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-05-11 07:40 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-05-11 14:45 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=6353ac1448e6ff9c7a5e96134fae3939f5492e83
Log: Fix #79579: odbc_exec does not prepare the SQL statement
 [2020-12-30 11:59 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=9eb4a262eab9a32195c7c466c9058e6bd747275e
Log: Fix #79579: odbc_exec does not prepare the SQL statement
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 13:01:30 2024 UTC