Skip to Content.
Sympa Menu

freetds - RE: [freetds] DBlib dbsqlexec question (chaining sql statements)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] DBlib dbsqlexec question (chaining sql statements)
  • Date: Fri, 24 Jun 2005 17:43:16 +0200

>
> thank you,
>
> one more question, is there any performance gain from
> dbsqlexec once for say
> 10 sql statements compared to 10 times for those same sql statements?
>
>
> ----- Original Message -----
> From: "Jorge Cordero" <jorge.cordero AT gmx.net>
> To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
> Sent: Thursday, June 23, 2005 6:09 PM
> Subject: RE: [freetds] DBlib dbsqlexec question (chaining sql
> statements)
>
>
>
> Yes, a white space is enough to separate to commands... but a new line
> will look nicer in the Profiler utility.
>
> But remember, dbresults must be called for each statement in the
> command batch. A loop would be practical for this.
>
> Also consider your Isolation Level and the proper Commit to end your
> transaction...
>
>
> -----Mensaje original-----
> De: freetds-bounces AT lists.ibiblio.org
> [mailto:freetds-bounces AT lists.ibiblio.org]En nombre de Patrick
> Dunnigan
> Enviado el: Thursday, June 23, 2005 04:11 PM
> Para: freetds AT lists.ibiblio.org
> Asunto: [freetds] DBlib dbsqlexec question (chaining sql statements)
>
>
> Hi,
>
> Have two (maybe more) sql statements that I'd like to run. I am
> wondering if I can execute them at the same time. Example:
>
> Now:
> int i = 1;
> int j = 3;
> dbfcmd(dbproc,"delete from sss where col1 = %d",i);
> dbsqlexec(dbproc);
> dbresults(dbproc);
> dbfcmd(dbproc,"delete from zzz where col1 = %d",j);
> dbsqlexec(dbproc);
> dbresults(dbproc);
>
> I'd like to do:
>
> dbfcmd(dbproc,"delete from sss where col1 = %d\n",i);
> dbfcmd(dbproc,"delete from zzz where col1 = %d",j);
> dbsqlexec(dbproc);
> dbresults(dbproc);
>
> Is there a command seperator that I put after the newline and / or how
> many times to I have to call dbsqlexec or dbresults? Would this save
> roundtrips to the database or is the method the way to go?
> Thanks

If round-trip is quite long building a single query can save many time.
Also less tds packet to write = less ip packet = less network bandwidth.
Keep in mind that dblib have to cache your query in memory...

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page