Skip to Content.
Sympa Menu

freetds - Re: [freetds] tds_connect does too much

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] tds_connect does too much
  • Date: Fri, 11 Jul 2008 08:53:45 +0200

>
> ZIGLIO, Frediano, VF-IT wrote:
> >
> > Mmm... tds_send_login is not that fine, perhaps it's better
> to rename
> > tds_login structure to _tds_login (cause we only use
> TDSLOGIN) and add
> > a tds_login.
>
> Good observation. s/tds_login/tds_login_t/g perhaps?
>

Good.

>
> > auto as protocol version, now tds_connect connect and disconnect
> > as it wants...
>
> Does the server disconnect if the login fails? If not, we can keep
> re-trying login packets on the same connection.
>
> Otherwise, I imagine this (simplified):
>
>
> if ((conn = tds_connect()) == NULL)
> return tdserror();
> else
> tds_login();
>

can be

> and in tds_login():
>
> if (tdsver == 0) {
> for( i=0; i < maxver; i++ ) {
> tdsver = versions[i];
> int fOK = tds_login(tdsver);
> if( fOK )
> return fOK;
>
> if ((conn = tds_connect()) == NULL)
> return tdserror();
> }
> }
> if (i == maxver)
> return tdserror();
>
> /* call tdsX_send/do_login function ... */
>

I don't like this that much... connect on second but not for first...
I never liked that name resolution is in config.c, I thing that should be in
net.c. Also I
think it would be better to put name resolution during connection. To detect
problems
related to tcp/ip connect in tsql we could test for TDSSOCKET->s, is valid
only if there is
a connection (connection is closed before tdserror, but perhaps is closed
also on login
errors)...

About naming convention we have

tds_submit/put_XXX send packets (query.c) there is also a mix of
submit/put/send... any
difference ??
tds_process_XXX read and process packets (token.c)

There is also a tds8_do_login

freddy77

Attachment: smime.p7s
Description: S/MIME cryptographic signature




Archive powered by MHonArc 2.6.24.

Top of Page