Repository: trafodion Updated Branches: refs/heads/master 7aa5eec47 -> 7bd498cb3
[TRAFODION-3109] comment can not transfer single quote normally in comment string Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/ffb9416d Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/ffb9416d Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/ffb9416d Branch: refs/heads/master Commit: ffb9416dba18beceeae2ff40cc09e63d052395b7 Parents: 1ee3de7 Author: zlei929 <[email protected]> Authored: Fri Jun 15 17:30:56 2018 +0800 Committer: zlei929 <[email protected]> Committed: Fri Jun 15 17:30:58 2018 +0800 ---------------------------------------------------------------------- core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/ffb9416d/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp index cc4b00e..411560d 100644 --- a/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp +++ b/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp @@ -354,16 +354,21 @@ void CmpSeabaseDDL::doSeabaseCommentOn(StmtDDLCommentOn *commentOnNode, if (comment.length() > 0) { + + //'removeConsecutiveQuotes' was done at the beginning of lexical analysis. + // so we should recovery it("'" ==> "''") in there to make insert successfully. + NAString quotedComment; + ToQuotedString(quotedComment, comment, FALSE); + //add or modify comment char query[2048]; - str_sprintf(query, "insert into %s.\"%s\".%s values (%ld, %d, %d, %d, 0, '%s') ; ", getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_TEXT, objUID, textType, subID, 0, - comment.data()); + quotedComment.data()); cliRC = cliInterface.executeImmediate(query); if (cliRC < 0)
