new COMMENT-ON SQL statement: review change - error path 1. switch compile context in comment-on error path 2. correct spellings and others
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/171b9fb2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/171b9fb2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/171b9fb2 Branch: refs/heads/master Commit: 171b9fb2a6c94d3fbc09d54927d443768b63dfb9 Parents: 6af4256 Author: eedy <cqlc...@gmail.com> Authored: Tue Nov 14 14:41:41 2017 +0800 Committer: eedy <cqlc...@gmail.com> Committed: Tue Nov 14 14:41:41 2017 +0800 ---------------------------------------------------------------------- core/sql/common/ComSmallDefs.h | 2 +- core/sql/parser/StmtDDLCommentOn.h | 2 +- core/sql/parser/sqlparser.y | 7 ------- core/sql/sqlcomp/CmpDescribe.cpp | 5 +++++ core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp | 6 +++--- core/sql/sqlcomp/CmpSeabaseDDLschema.cpp | 1 + core/sql/sqlcomp/CmpSeabaseDDLview.cpp | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/171b9fb2/core/sql/common/ComSmallDefs.h ---------------------------------------------------------------------- diff --git a/core/sql/common/ComSmallDefs.h b/core/sql/common/ComSmallDefs.h index 1d5a15f..3e25a79 100644 --- a/core/sql/common/ComSmallDefs.h +++ b/core/sql/common/ComSmallDefs.h @@ -663,7 +663,7 @@ enum ComTextType {COM_VIEW_TEXT = 0, COM_HBASE_SPLIT_TEXT = 6, COM_STORED_DESC_TEXT = 7, COM_VIEW_REF_COLS_TEXT = 8, - COM_OBJET_COMMENT_TEXT = COM_TABLE_COMMENT_TEXT, + COM_OBJECT_COMMENT_TEXT = COM_TABLE_COMMENT_TEXT, COM_COLUMN_COMMENT_TEXT = 9 }; http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/171b9fb2/core/sql/parser/StmtDDLCommentOn.h ---------------------------------------------------------------------- diff --git a/core/sql/parser/StmtDDLCommentOn.h b/core/sql/parser/StmtDDLCommentOn.h index 9b31b26..adf64bb 100644 --- a/core/sql/parser/StmtDDLCommentOn.h +++ b/core/sql/parser/StmtDDLCommentOn.h @@ -57,7 +57,7 @@ class StmtDDLCommentOn : public StmtDDLNode public: enum COMMENT_ON_TYPES { - COMMENT_ON_TYPE_TABLE = 10, + COMMENT_ON_TYPE_TABLE, COMMENT_ON_TYPE_COLUMN, COMMENT_ON_TYPE_SCHEMA, COMMENT_ON_TYPE_VIEW, http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/171b9fb2/core/sql/parser/sqlparser.y ---------------------------------------------------------------------- diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y index df4cc2e..9e16c20 100755 --- a/core/sql/parser/sqlparser.y +++ b/core/sql/parser/sqlparser.y @@ -33190,12 +33190,6 @@ comment_on_statement : TOK_COMMENT TOK_ON comment_on_object_types ddl_qualified_ } | TOK_COMMENT TOK_ON TOK_SCHEMA schema_name TOK_IS QUOTED_STRING { - // EJF L4J - CQD dynamic are not allowed in Compound Statements - if (beginsWith(SQLTEXT(),"BEGIN")) { - *SqlParser_Diags << DgSqlCode(-3175); - YYERROR; - } - else { // business as usual NAString tmpSchema($4->getSchemaNameAsAnsiString()); if (! validateVolatileSchemaName(tmpSchema)) @@ -33210,7 +33204,6 @@ comment_on_statement : TOK_COMMENT TOK_ON comment_on_object_types ddl_qualified_ PARSERHEAP()); $$ = pNode; - } } | TOK_COMMENT TOK_ON TOK_COLUMN qualified_name TOK_IS QUOTED_STRING { http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/171b9fb2/core/sql/sqlcomp/CmpDescribe.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpDescribe.cpp b/core/sql/sqlcomp/CmpDescribe.cpp index b4b1d4e..28590f4 100644 --- a/core/sql/sqlcomp/CmpDescribe.cpp +++ b/core/sql/sqlcomp/CmpDescribe.cpp @@ -3074,6 +3074,7 @@ short CmpDescribeSeabaseTable ( if (cmpSBD.getSeabaseObjectComment(objectUID, COM_VIEW_OBJECT, objCommentInfo, heap)) { *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS); + cmpSBD.switchBackCompiler(); return -1; } @@ -3846,6 +3847,7 @@ short CmpDescribeSeabaseTable ( if (cmpSBD.getSeabaseObjectComment(objectUID, objType, objCommentInfo, heap)) { *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS); + cmpSBD.switchBackCompiler(); return -1; } @@ -4029,6 +4031,7 @@ short CmpDescribeSequence( if (cmpSBD.getSeabaseObjectComment(objectUID, COM_SEQUENCE_GENERATOR_OBJECT, objCommentInfo, heap)) { *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS); + cmpSBD.switchBackCompiler(); return -1; } @@ -4293,6 +4296,7 @@ char buf[1000]; if (cmpSBD.getSeabaseObjectComment(libraryUID, COM_LIBRARY_OBJECT, objCommentInfo, heap)) { *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS); + cmpSBD.switchBackCompiler(); return -1; } @@ -4838,6 +4842,7 @@ short CmpDescribeRoutine (const CorrName & cn, if (cmpSBD.getSeabaseObjectComment(routineUID, COM_USER_DEFINED_ROUTINE_OBJECT, objCommentInfo, heap)) { *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS); + cmpSBD.switchBackCompiler(); return -1; } http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/171b9fb2/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp index f9197e3..7622bd8 100644 --- a/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp +++ b/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp @@ -89,7 +89,7 @@ short CmpSeabaseDDL::getSeabaseObjectComment(Int64 object_uid, //get object comment sprintf(query, "select TEXT from %s.\"%s\".%s where TEXT_UID = %ld and TEXT_TYPE = %d and SUB_ID = %d ; ", getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_TEXT, - object_uid, COM_OBJET_COMMENT_TEXT, 0); + object_uid, COM_OBJECT_COMMENT_TEXT, 0); Queue * objQueue = NULL; cliRC = cliInterface.fetchAllRows(objQueue, query, 0, FALSE, FALSE, TRUE); @@ -119,7 +119,7 @@ short CmpSeabaseDDL::getSeabaseObjectComment(Int64 object_uid, getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_OBJECTS, getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_TEXT, getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_INDEXES, - object_uid, COM_OBJET_COMMENT_TEXT, 0); + object_uid, COM_OBJECT_COMMENT_TEXT, 0); Queue * indexQueue = NULL; cliRC = cliInterface.fetchAllRows(indexQueue, query, 0, FALSE, FALSE, TRUE); @@ -299,7 +299,7 @@ void CmpSeabaseDDL::doSeabaseCommentOn(StmtDDLCommentOn *commentOnNode, } // add, remove, change comment of object/column - enum ComTextType textType = COM_OBJET_COMMENT_TEXT; + enum ComTextType textType = COM_OBJECT_COMMENT_TEXT; Lng32 subID = 0; if (StmtDDLCommentOn::COMMENT_ON_TYPE_COLUMN == commentObjectType) http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/171b9fb2/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp b/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp index 4ff11d0..d2f0c89 100644 --- a/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp +++ b/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp @@ -459,6 +459,7 @@ Int16 status = ComUser::getAuthNameFromAuthID(objectOwner,username, if (cmpSBD.getSeabaseObjectComment(schemaUID, objectType, objCommentInfo, STMTHEAP)) { *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS); + cmpSBD.switchBackCompiler(); return -1; } http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/171b9fb2/core/sql/sqlcomp/CmpSeabaseDDLview.cpp ---------------------------------------------------------------------- diff --git a/core/sql/sqlcomp/CmpSeabaseDDLview.cpp b/core/sql/sqlcomp/CmpSeabaseDDLview.cpp index a9f353c..7178fd1 100644 --- a/core/sql/sqlcomp/CmpSeabaseDDLview.cpp +++ b/core/sql/sqlcomp/CmpSeabaseDDLview.cpp @@ -1502,7 +1502,7 @@ short CmpSeabaseDDL::createMetadataViews(ExeCliInterface * cliInterface) param_[5] = getSystemCatalog(); param_[6] = SEABASE_MD_SCHEMA; param_[7] = SEABASE_TEXT; - param_[8] = "3";//COM_OBJET_COMMENT_TEXT + param_[8] = "3";//COM_OBJECT_COMMENT_TEXT } else if (strcmp(mdi.viewName, TRAF_COLUMN_COMMENT_VIEW) == 0) {