[freetds] support "CS_TDS_80" by "CS_SET" action in ct_con_props()

Vadym Kononenko vkononenko at atlantic-link.com.ua
Mon Sep 5 11:51:52 EDT 2005


Hi, all.
I try to write libdbi-freetds driver using ctlib API.
My alpha version works good, but I have a problem.
If I don't use freetds.conf file and try to connect to MS SQL 8.0 CLI using
7.0 version settings, not NUL-terminated string received. I tried to use "ind"  
and "datalength" received from ct_bind() but this way don't work always 
correctly.
Can anyone add the "CS_TDS_80"  support for "ct_con_props()" call?

diff -rua freetds.orig/src/ctlib/ct.c freetds/src/ctlib/ct.c
--- freetds.orig/src/ctlib/ct.c 2005-09-05 11:02:27 +0300
+++ freetds/src/ctlib/ct.c      2005-09-05 11:03:19 +0300
@@ -431,6 +431,8 @@
                                tds_set_version(tds_login, 5, 0);
                        } else if (*(int *) buffer == CS_TDS_70) {
                                tds_set_version(tds_login, 7, 0);
+                       } else if (*(int *) buffer == CS_TDS_80) {
+                               tds_set_version(tds_login, 8, 0);
                        } else {
                                return CS_FAIL;
                        }

And... Can anyone review the small patch below. I assume than "ct.c"  code 
contain an error...

diff -rua freetds.orig/src/ctlib/ct.c freetds/src/ctlib/ct.c
--- freetds.orig/src/ctlib/ct.c 2005-09-05 11:02:27 +0300
+++ freetds/src/ctlib/ct.c      2005-09-05 11:08:16 +0300
@@ -469,7 +469,7 @@
                        tds_strlcpy((char *) buffer, 
tds_dstr_cstr(&tds_login->server_name), buflen
                        break;
                case CS_LOC_PROP:
-                       buffer = (CS_VOID *) con->locale;
+                       *buffer = (CS_VOID *) con->locale;
                        break;
                case CS_USERDATA:
                        tdsdump_log(TDS_DBG_INFO2, "fetching userdata %p\n", 
con->userdata);

-- 
Best regards.
Vadym Kononenko.
Kyiv, Ukraine


More information about the FreeTDS mailing list