You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by li...@apache.org on 2018/08/23 10:11:42 UTC
[1/3] trafodion git commit: first check in, must switch to other task
Repository: trafodion
Updated Branches:
refs/heads/master bd3facc68 -> 31cab907a
first check in, must switch to other task
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/cadd9e90
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/cadd9e90
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/cadd9e90
Branch: refs/heads/master
Commit: cadd9e90526a5b857912805894d17d2bb1f5e8de
Parents: 5e8bfc7
Author: Liu Ming <ov...@sina.com>
Authored: Sun Aug 19 08:49:07 2018 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Sun Aug 19 08:49:07 2018 +0000
----------------------------------------------------------------------
core/sql/exp/exp_clause_derived.h | 8 ++++++++
core/sql/exp/exp_like.cpp | 12 +++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafodion/blob/cadd9e90/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 f478cd7..ee6afc3 100644
--- a/core/sql/exp/exp_clause_derived.h
+++ b/core/sql/exp/exp_clause_derived.h
@@ -41,9 +41,12 @@
#ifndef EXP_CLAUSE_DERIVED_H
#define EXP_CLAUSE_DERIVED_H
+#include <sys/types.h>
+#include <regex.h>
#include "exp_clause.h"
#include "exp_like.h"
#include <byteswap.h>
+#include "NAStringDef.h"
#define instrAndText(a) a, #a
@@ -2546,6 +2549,7 @@ public:
// Construction
//
ExRegexpClauseChar() {};
+ ~ExRegexpClauseChar() { };
ExRegexpClauseChar(OperatorTypeEnum oper_type,
short num_operands,
Attributes ** attr,
@@ -2584,6 +2588,10 @@ public:
virtual short getClassSize() { return (short)sizeof(*this); }
// ---------------------------------------------------------------------
+ regex_t reg;
+
+ NAString rpattern_;
+
private:
// ---------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafodion/blob/cadd9e90/core/sql/exp/exp_like.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_like.cpp b/core/sql/exp/exp_like.cpp
index 4cd365f..d235be8 100644
--- a/core/sql/exp/exp_like.cpp
+++ b/core/sql/exp/exp_like.cpp
@@ -498,11 +498,10 @@ ex_expr::exp_return_type ExRegexpClauseChar::eval(char *op_data[],
NABoolean matchFlag = true;
Lng32 len1 = getOperand(1)->getLength(op_data[-MAX_OPERANDS+1]);
Lng32 len2 = getOperand(2)->getLength(op_data[-MAX_OPERANDS+2]);
- regex_t reg;
+ char * pattern;
regmatch_t pm[1];
const size_t nmatch = 1;
Lng32 cflags, z;
- char * pattern;
char *srcStr= new (exHeap) char[len1+1];
char ebuf[128];
@@ -513,8 +512,12 @@ ex_expr::exp_return_type ExRegexpClauseChar::eval(char *op_data[],
str_cpy_all(pattern, op_data[2], len2);
str_cpy_all(srcStr, op_data[1], len1);
-
- z = regcomp(®, pattern, cflags);
+ if(rpattern_ != pattern)
+ {
+ if(rpattern_ != "") regfree(®);
+ rpattern_ = pattern;
+ z = regcomp(®, pattern, cflags);
+ }
if (z != 0){
//ERROR
@@ -538,7 +541,6 @@ ex_expr::exp_return_type ExRegexpClauseChar::eval(char *op_data[],
*(Lng32 *)op_data[0] = (Lng32)matchFlag;
- regfree(®);
NADELETEBASIC(pattern, exHeap);
NADELETEBASIC(srcStr, exHeap);
[3/3] trafodion git commit: merge [TRAFODION-2404]
Posted by li...@apache.org.
merge [TRAFODION-2404]
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/31cab907
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/31cab907
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/31cab907
Branch: refs/heads/master
Commit: 31cab907a8ce8af6b046cfc58236daef0af78423
Parents: bd3facc c41d24b
Author: Liu Ming <ov...@sina.com>
Authored: Thu Aug 23 10:11:26 2018 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Thu Aug 23 10:11:26 2018 +0000
----------------------------------------------------------------------
core/sql/exp/exp_clause_derived.h | 10 +++++++++-
core/sql/exp/exp_like.cpp | 15 +++++++++------
2 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
[2/3] trafodion git commit: enhance by adding comments and adding
error check
Posted by li...@apache.org.
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 <ov...@sina.com>
Authored: Sun Aug 19 10:13:04 2018 +0000
Committer: Liu Ming <ov...@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(®); };
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);