RE: [PHP-DB] odbc_exec vs. odbc prepare, odbc_execute (was: Anyone used Merant Data Direct?)
| From: | Andrew Hill | Date: | Wed, 05 Jul 2000 12:27:54 +0000 |
| Subject: | RE: [PHP-DB] odbc_exec vs. odbc prepare, odbc_execute (was: Anyone used Merant Data Direct?) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-859@lists.php.net to get a copy of this message | ||
Thanks David,
One thing to be aware of as well, that most folks using PHP/ODBC don't seem
to take into account.
While using an explicit odbc_prepare and odbc_execute does take an extra
line or so of coding the first time you wish to run a statement, it is
_much_ faster than using a directly executed call such as odbc_do or
odbc_exec. The best way to use it is to prepare a query with a variable, or
a 'parameter bound' query, and then pass the parameter in each time you want
to execute. You will find it to be significantly faster, since the
statement is in effect 'compiled' on the database side after a prepare, so
it executes faster, plus you have fewer RPC calls if you need to call the
statement multiple times.
Best regards,
Andrew
----------------------------------------------------
Andrew Hill
Professional Services
OpenLink Software
http://www.openlinksw.com
Universal Database Connectivity Technology Providers
-----Original Message-----
From: David Osborne [mailto:David.Osborne@nottingham.ac.uk]
Sent: Tuesday, July 04, 2000 8:51 AM
To: Andrew Hill
Subject: RE: [PHP-DB] Anyone used Merant Data Direct?
Andrew
Thanks for the suggested workaround using odbc_prepare/odbc_execute, which
is working fine. I'll open a bug report and try to get an ODBC trace, as
you requested.
regards
David
On Fri, 30 Jun 2000, Andrew Hill wrote:
AH> I've seen some problems with odbc_do and odbc_exec. These are both
AH> 'Directly Executing' statements, without preparing them first. One
AH> workaround for the time being is to use odbc_prepare with odbc_execute,
AH> which works fine. I am looking into how PHP changed the odbc handling
from
AH> 3 to 4, as this seems to be what changed.
--
David Osborne david.osborne@nottingham.ac.uk
Academic Computing Services phone/voicemail: +44 (0)115 951 3397
The University of Nottingham fax: +44 (0)115 951 3358
Nottingham NG7 2RD, UK http://www.nottingham.ac.uk/~cczdao/