[freetds] tds_connect does too much
ZIGLIO, Frediano, VF-IT
Frediano.Ziglio at vodafone.com
Fri Jul 11 02:53:45 EDT 2008
>
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3129 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20080711/a4382974/attachment.bin
More information about the FreeTDS
mailing list