You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2018/02/07 17:38:40 UTC

[1/2] trafodion git commit: fix trafodion-2955

Repository: trafodion
Updated Branches:
  refs/heads/master 84bb7c03c -> 449572de3


fix trafodion-2955


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/7eecb50b
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/7eecb50b
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/7eecb50b

Branch: refs/heads/master
Commit: 7eecb50b7cac562b26fe1bd48ff64ee7f21a6349
Parents: 622e67b
Author: SuJinpei <87...@qq.com>
Authored: Tue Feb 6 11:18:22 2018 +0800
Committer: SuJinpei <87...@qq.com>
Committed: Tue Feb 6 11:18:22 2018 +0800

----------------------------------------------------------------------
 core/conn/odb/src/odb.c | 43 ++++++++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/7eecb50b/core/conn/odb/src/odb.c
----------------------------------------------------------------------
diff --git a/core/conn/odb/src/odb.c b/core/conn/odb/src/odb.c
index 5f8db45..4ba4bcc 100755
--- a/core/conn/odb/src/odb.c
+++ b/core/conn/odb/src/odb.c
@@ -13417,27 +13417,36 @@ static int runsql(int tid, int eid, int ten, char *script)
                     line = l ;
                 }
                 strmcpy ( line, (char *)Ocmd, j );
-                if ( !strmicmp(line, "odb ", 4) ) {
-                    snprintf((char *)Ocmd, bs, "%s -u %s -p %s %s%s %s%s %s",
-                        odbcmd, (char *)Ouser, (char *)Opwd, Odsn[0] ? "-d " : "", Odsn[0] ? (char *)Odsn : "",
-                        clca ? "-ca" : "", clca ? clca : "", line + 4 );
+                // eliminate left spaces
+                unsigned int alphaIndex = 0;
+                while (alphaIndex < j && (line[alphaIndex] == ' ' || line[alphaIndex] == '\t')) ++alphaIndex;
+
+                if (alphaIndex != j) { // skip blank line
+                    if (!strmicmp(line, "odb ", 4)) {
+                        snprintf((char *)Ocmd, bs, "%s -u %s -p %s %s%s %s%s %s",
+                            odbcmd, (char *)Ouser, (char *)Opwd, Odsn[0] ? "-d " : "", Odsn[0] ? (char *)Odsn : "",
+                            clca ? "-ca" : "", clca ? clca : "", line + 4);
 #ifdef _WIN32
-                    _spawnlp(_P_WAIT, "cmd.exe", "cmd.exe", "/c", var_exp((char *)Ocmd, &bs, &thps[tid].tva), NULL);
+                        _spawnlp(_P_WAIT, "cmd.exe", "cmd.exe", "/c", var_exp((char *)Ocmd, &bs, &thps[tid].tva), NULL);
 #else
-                    if ( system((const char *)var_exp((char *)Ocmd, &bs, &thps[tid].tva)) < 0 )
-                        fprintf(stderr, "odb [runsql(%d)] - Error running %s\n", __LINE__, &Ocmd[1]);
+                        if (system((const char *)var_exp((char *)Ocmd, &bs, &thps[tid].tva)) < 0)
+                            fprintf(stderr, "odb [runsql(%d)] - Error running %s\n", __LINE__, &Ocmd[1]);
 #endif
-                    j = 0;
-                } else {
-                    nrag = tokenize ( line, j, rag );
-                    if ( nrag && !strmicmp(rag[0], "set", 0) ) {
-                        setan ( eid, tid, nrag, rag, ql );
-                        j = 0;
-                    } else if ( !strmicmp(rag[0], "print", 0 ) ) {
-                        var_exp (nrag ? rag[1] : "", 0, &thps[0].tva);
                         j = 0;
-                    } else {
-                        Ocmd[j++] = (SQLCHAR)ch;
+                    }
+                    else {
+                        nrag = tokenize(line, j, rag);
+                        if (nrag && !strmicmp(rag[0], "set", 0)) {
+                            setan(eid, tid, nrag, rag, ql);
+                            j = 0;
+                        }
+                        else if (!strmicmp(rag[0], "print", 0)) {
+                            var_exp(nrag ? rag[1] : "", 0, &thps[0].tva);
+                            j = 0;
+                        }
+                        else {
+                            Ocmd[j++] = (SQLCHAR)ch;
+                        }
                     }
                 }
             }


[2/2] trafodion git commit: Merge [TRAFODION-2955] PR 1442 Fix odb crash when input file has blank line

Posted by db...@apache.org.
Merge [TRAFODION-2955] PR 1442 Fix odb crash when input file has blank line


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/449572de
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/449572de
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/449572de

Branch: refs/heads/master
Commit: 449572de37917401979d93e2fcc7d6ccdc481aa4
Parents: 84bb7c0 7eecb50
Author: Dave Birdsall <db...@apache.org>
Authored: Wed Feb 7 17:37:55 2018 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Wed Feb 7 17:37:55 2018 +0000

----------------------------------------------------------------------
 core/conn/odb/src/odb.c | 43 ++++++++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/449572de/core/conn/odb/src/odb.c
----------------------------------------------------------------------