From commits-return-8618-archive-asf-public=cust-asf.ponee.io@trafodion.apache.org Thu Aug 23 12:11:45 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 86E5C180679 for ; Thu, 23 Aug 2018 12:11:44 +0200 (CEST) Received: (qmail 49534 invoked by uid 500); 23 Aug 2018 10:11:43 -0000 Mailing-List: contact commits-help@trafodion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: commits@trafodion.apache.org Delivered-To: mailing list commits@trafodion.apache.org Received: (qmail 49515 invoked by uid 99); 23 Aug 2018 10:11:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Aug 2018 10:11:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id ADF1DE08DE; Thu, 23 Aug 2018 10:11:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: liuming@apache.org To: commits@trafodion.apache.org Date: Thu, 23 Aug 2018 10:11:43 -0000 Message-Id: <7220bd70a9b245eab2604fa26811e40e@git.apache.org> In-Reply-To: <4540d6631c5946e68395f2bbea51dba7@git.apache.org> References: <4540d6631c5946e68395f2bbea51dba7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] trafodion git commit: enhance by adding comments and adding error check 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 Authored: Sun Aug 19 10:13:04 2018 +0000 Committer: Liu Ming 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(®); }; 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, ®,ebuf, sizeof(ebuf)); ExRaiseSqlError(exHeap, diagsArea, (ExeErrorCode)8452); **diagsArea << DgString0(ebuf);