[freetds] tsql patch

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Thu Sep 20 10:38:12 EDT 2007


I don't know if this patch should be applied.
This patch permit empty lines in batch. Allowing empty lines keep
consistency in error results.
Consider this batch

1> select 1
2> 
3> raiserror('hello',16,1)

Without the patch error is detected at line 2 while is at line 3.

diff -u -1 -0 -r1.106 tsql.c
--- src/apps/tsql.c     17 Sep 2007 10:15:22 -0000      1.106
+++ src/apps/tsql.c     20 Sep 2007 14:25:08 -0000
@@ -715,21 +715,21 @@
                        free(go_line);
                }

                /* skip leading whitespace */
                if (s2)
                        free(s2);
                s2 = strdup(s); /* copy to mangle with strtok() */
                cmd = strtok(s2, " \t");

                if (!cmd)
-                       continue;
+                       cmd = "";

                if (!strcasecmp(cmd, "exit") || !strcasecmp(cmd, "quit")
|| !strcasecmp(cmd, "bye"))
                        break;
                if (!strcasecmp(cmd, "version")) {
                        tds_version(tds, mybuf);
                        printf("using TDS version %s\n", mybuf);
                        line = 0;
                        mybuf[0] = '\0';
                        buflen = 0;
                        continue;

freddy77



More information about the FreeTDS mailing list