freebcp patch for charset

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Does this patch seems resonable ??

Index: freetds83/src/apps/freebcp.c
===================================================================
--- freetds83.orig/src/apps/freebcp.c   2009-07-20 11:39:07.500572628 +0200
+++ freetds83/src/apps/freebcp.c        2009-07-20 11:41:14.216542571 +0200
@@ -192,7 +192,7 @@
         * Get the rest of the arguments
         */
        optind = 4; /* start processing options after table,
direction, & filename */
-       while ((ch = getopt(argc, argv,
"m:f:e:F:L:b:t:r:U:P:I:S:h:T:A:O:0:ncEdvV")) != -1) {
+       while ((ch = getopt(argc, argv,
"m:f:e:F:L:b:t:r:U:P:I:S:h:T:A:O:0:C:ncEdvV")) != -1) {
                switch (ch) {
                case 'v':
                case 'V':
@@ -287,6 +287,9 @@
                        pdata->Aflag++;
                        pdata->packetsize = atoi(optarg);
                        break;
+               case 'C':
+                       pdata->charset = strdup(optarg);
+                       break;
                case '?':
                default:
                        pusage();
@@ -361,6 +364,8 @@
        DBSETLUSER(login, pdata->user);
        DBSETLPWD(login, pdata->pass);
        DBSETLAPP(login, "FreeBCP");
+       if (pdata->charset)
+               DBSETLCHARSET(login, pdata->charset);

        /* if packet size specified, set in login record */

@@ -373,7 +378,7 @@
        BCP_SETL(login, TRUE);

        /*
-        * ** Get a connection to the database.
+        * Get a connection to the database.
         */

        if ((*pdbproc = dbopen(login, pdata->server)) == NULL) {
Index: freetds83/src/apps/freebcp.h
===================================================================
--- freetds83.orig/src/apps/freebcp.h   2009-07-20 11:39:07.512540700 +0200
+++ freetds83/src/apps/freebcp.h        2009-07-20 11:41:14.216542571 +0200
@@ -51,6 +51,7 @@
        char *server;
        char *hint;
        char *options;
+       char *charset;
        int packetsize;
        int mflag;
        int fflag;


I don't know if proprietary library has an option for this

freddy77
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.