trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lium...@apache.org
Subject [2/3] trafodion git commit: enhance by adding comments and adding error check
Date Thu, 23 Aug 2018 10:11:43 GMT
enhance by adding comments and adding error check


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

Branch: refs/heads/master
Commit: c41d24b8c73cc583c13e978e76ffb3ac2391d9a1
Parents: cadd9e9
Author: Liu Ming <ovis_poly@sina.com>
Authored: Sun Aug 19 10:13:04 2018 +0000
Committer: Liu Ming <ovis_poly@sina.com>
Committed: Sun Aug 19 10:13:04 2018 +0000

----------------------------------------------------------------------
 core/sql/exp/exp_clause_derived.h | 6 +++---
 core/sql/exp/exp_like.cpp         | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/c41d24b8/core/sql/exp/exp_clause_derived.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_clause_derived.h b/core/sql/exp/exp_clause_derived.h
index ee6afc3..17d1f1d 100644
--- a/core/sql/exp/exp_clause_derived.h
+++ b/core/sql/exp/exp_clause_derived.h
@@ -2548,8 +2548,8 @@ class  ExRegexpClauseChar : public ExRegexpClauseBase {
 public:
   // Construction
   //
-  ExRegexpClauseChar() {};
-  ~ExRegexpClauseChar() {  };
+  ExRegexpClauseChar() { rpattern_ = ""; };
+  ~ExRegexpClauseChar() { if(rpattern_ != "") regfree(&reg); };
   ExRegexpClauseChar(OperatorTypeEnum oper_type, 
 			    short num_operands,
 			    Attributes ** attr,
@@ -2590,7 +2590,7 @@ public:
 
   regex_t reg;
 
-  NAString rpattern_;
+  NAString rpattern_; //previous pattern
 
 private:
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/c41d24b8/core/sql/exp/exp_like.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_like.cpp b/core/sql/exp/exp_like.cpp
index d235be8..f432efd 100644
--- a/core/sql/exp/exp_like.cpp
+++ b/core/sql/exp/exp_like.cpp
@@ -501,7 +501,7 @@ ex_expr::exp_return_type ExRegexpClauseChar::eval(char *op_data[],
   char * pattern;
   regmatch_t pm[1];
   const size_t nmatch = 1;
-  Lng32 cflags, z;
+  Lng32 cflags, z = 0;
   char *srcStr= new (exHeap) char[len1+1];
   char ebuf[128];
 
@@ -521,6 +521,7 @@ ex_expr::exp_return_type ExRegexpClauseChar::eval(char *op_data[],
 
   if (z != 0){
     //ERROR
+    memset(ebuf, 0, sizeof(ebuf));
     regerror(z, &reg,ebuf, sizeof(ebuf));
     ExRaiseSqlError(exHeap, diagsArea, (ExeErrorCode)8452);
     **diagsArea << DgString0(ebuf);


Mime
View raw message