From ffb9416dba18beceeae2ff40cc09e63d052395b7 Mon Sep 17 00:00:00 2001 From: zlei929 Date: Fri, 15 Jun 2018 17:30:56 +0800 Subject: [PATCH] [TRAFODION-3109] comment can not transfer single quote normally in comment string --- core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp index cc4b00e843..411560d770 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)