[egenix-users] Re: mxODBC Cursor Unicode issuewith method executedirect().

Harri Pesonen harri.pesonen at wicom.com
Fri Aug 17 11:07:01 CEST 2007


M.-A. Lemburg <mal at ...> writes:

> 
> On 2007-08-15 16:47, Cliff Xuan wrote:
> > Hi Marc-Andre,
> > 
> > Thanks very much for your answer.
> > Dose that mean I should avoid using executedirect() if I do have parameters?
> 
> You should always prefer .execute() over .executedirect().
> 
> If you do want to try .executedirect(), then please do timings checks
> and data transfer checks (like the ones you are apparently doing),
> since using .executedirect() may very well be slower for what
> you want to do, use more memory and result in unwanted recoding
> of data.

Hi, about executedirect() vs execute(). Generally executedirect() is faster
(ODBC documentation says "SQLExecDirect is the fastest way to submit an SQL
statement for one-time execution"). Execute() is faster only if the statement is
prepared first, and then executed several times. Usually it is faster and easier
to use executedirect(), because prepare+execute(N times) is harder to implement.
I guess that mxODBC executemany() does exactly the same thing as
prepare+execute(N times).

Well we have experience only with SQL Server, so different databases may behave
differently.

-- Harri




More information about the egenix-users mailing list