Re: tds_connect does too much
"ZIGLIO, Frediano, VF-IT" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
>
> 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
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
smime.p7s
(application/x-pkcs7-signature, 3.1 KB) - not displayed