Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1470#discussion_r174292065
  
    --- Diff: core/sql/sqlci/SqlCmd.cpp ---
    @@ -440,25 +461,50 @@ void handleLocalError(ComDiagsArea &diags, SqlciEnv 
*sqlci_env)
       // when HandleCLIError() is called with a error after a CLI call.
       // Soln :10-021203-3433
     
    -  if (diags.getNumber(DgSqlCode::ERROR_)) {
    +  if (diags->getNumber(DgSqlCode::ERROR_)) {
          worstcode = SQL_Error;
       }
    -  else if (diags.getNumber(DgSqlCode::WARNING_)) {
    +  else if (diags->getNumber(DgSqlCode::WARNING_)) {
         worstcode = SQL_Warning;
       }
     
       if (!lastLineWasABlank) log->WriteAllWithoutEOL("");
       lastLineWasABlank = TRUE;
     
       ostringstream errMsg;
    -  NADumpDiags(errMsg, &diags, TRUE/*newline*/, 0, NULL, log->isVerbose(),
    +  NADumpDiags(errMsg, diags, TRUE/*newline*/, 0, NULL, log->isVerbose(),
                   sqlci_env->getTerminalCharset());
     
       errMsg << ends;
     
       log->WriteAllWithoutEOL(errMsg.str().c_str());
     }
     
    +Int64 getRowsAffected(SQLSTMT_ID *stmt)
    +{
    +   Int32 rc;
    +   rc = SQL_EXEC_GetDiagnosticsStmtInfo2(stmt,
    +                           SQLDIAG_ROW_COUNT, &rowsAffected,
    +                           NULL, 0, NULL);
    +   if (rc == 0)
    +      return rowsAffected; 
    +   else
    +      return -1;
    +}
    +
    +Int64 getDiagsCondCount(SQLSTMT_ID *stmt)
    +{
    +   Int32 rc;
    +   Int64 diagsCondCount;
    +   rc = SQL_EXEC_GetDiagnosticsStmtInfo2(stmt,
    +                           SQLDIAG_NUMBER, &diagsCondCount,
    +                           NULL, 0, NULL);
    +   if (rc == 0)
    +      return 0; 
    +   else
    +      return diagsCondCount;
    --- End diff --
    
    I believe the return value is context()->diags()->mainSQLCode()  which 
would be 100 from the previous CLI call.   Yes. It is bizarre.  This change was 
done to get the warnings when some regressions failed.  


---

Reply via email to