Repository: trafodion
Updated Branches:
  refs/heads/master a6cfd65d3 -> 3629e8d78


fix the logic Critical error checked by TScanCode


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/f897fff4
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/f897fff4
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/f897fff4

Branch: refs/heads/master
Commit: f897fff4194b18b637d37c82296dc60f743250ea
Parents: 8e332e5
Author: Kenny <xiaozhong.w...@esgyn.cn>
Authored: Tue Jan 9 08:20:40 2018 +0000
Committer: Kenny <xiaozhong.w...@esgyn.cn>
Committed: Tue Jan 9 08:20:40 2018 +0000

----------------------------------------------------------------------
 .../odbc/src/odbc/Common/ODBCMXTraceMsgs.cpp    |  6 ++---
 .../odbc/src/odbc/nsksrvrcore/srvrothers.cpp    | 12 +++++-----
 .../odbc/odbcclient/unixcli/cli/ctosqlconv.cpp  |  6 ++---
 core/sqf/src/seabed/src/sqstatepi.cpp           | 25 +++++++++++++-------
 core/sql/langman/Measure.cpp                    |  2 +-
 core/sql/optimizer/MJVIndexBuilder.cpp          |  4 ++--
 win-odbc64/odbcclient/drvr35/cdesc.cpp          |  3 ++-
 win-odbc64/odbcclient/drvr35/ctosqlconv.cpp     |  6 ++---
 8 files changed, 37 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/f897fff4/core/conn/odbc/src/odbc/Common/ODBCMXTraceMsgs.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/Common/ODBCMXTraceMsgs.cpp 
b/core/conn/odbc/src/odbc/Common/ODBCMXTraceMsgs.cpp
index 9b5e5e0..c716998 100644
--- a/core/conn/odbc/src/odbc/Common/ODBCMXTraceMsgs.cpp
+++ b/core/conn/odbc/src/odbc/Common/ODBCMXTraceMsgs.cpp
@@ -647,7 +647,7 @@ void ODBCMXTraceMsg::TraceExecute2Exit(IDL_long returnCode,
        pBuffer += length;
        if (sqlWarningOrErrorLength > 0) pBuffer  = printHex(pBuffer, 
sqlWarningOrError, sqlWarningOrErrorLength);
 
-       tempStrlen = sprintf(temp, "RowsAffected:%d OutValues:");
+       tempStrlen = sprintf(temp, "RowsAffected:%d OutValues:", rowsAffected);
        pBuffer    = writeTraceMsg(pBuffer, temp, tempStrlen);
        if (outValuesLength > 0) pBuffer = printHex(pBuffer, outValues, 
outValuesLength);
 
@@ -1243,7 +1243,7 @@ void ODBCMXTraceMsg::TraceSrvrFetchExit( IDL_long  
returnCode,
   if (sqlWarningOrErrorLength > 0) 
     pBuffer  = printHex(pBuffer, sqlWarningOrError, sqlWarningOrErrorLength);
 
-  tempStrlen = sprintf(temp, "RowsAffected:%d OutValues:");
+  tempStrlen = sprintf(temp, "RowsAffected:%d OutValues:", rowsAffected);
   pBuffer    = writeTraceMsg(pBuffer, temp, tempStrlen);
   if (outValuesLength > 0)
      pBuffer = printHex(pBuffer, outValues, outValuesLength);
@@ -1318,7 +1318,7 @@ void ODBCMXTraceMsg::TraceFetch2Exit( IDL_long  
returnCode,
   if (sqlWarningOrErrorLength > 0) 
     pBuffer  = printHex(pBuffer, sqlWarningOrError, sqlWarningOrErrorLength);
 
-  tempStrlen = sprintf(temp, "RowsAffected:%d OutValues:");
+  tempStrlen = sprintf(temp, "RowsAffected:%d OutValues:", rowsAffected);
   pBuffer    = writeTraceMsg(pBuffer, temp, tempStrlen);
   if (outValuesLength > 0)
      pBuffer = printHex(pBuffer, outValues, outValuesLength);

http://git-wip-us.apache.org/repos/asf/trafodion/blob/f897fff4/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp 
b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
index ccbb689..645bd33 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
@@ -972,7 +972,7 @@ odbc_SQLSvc_Prepare2_sme_(
                        {
                                char *RGWarningOrError;
                                RGWarningOrError = new char[256];
-                               sprintf(b,"lf",pSrvrStmt->cost_info.totalTime);
+                               sprintf(b,"%lf",pSrvrStmt->cost_info.totalTime);
                                sprintf(RGWarningOrError, "The query's 
estimated cost: %.50s exceeded resource management attribute limit set.", b);
                                GETMXCSWARNINGORERROR(1, "01000", 
RGWarningOrError, sqlWarningOrErrorLength, sqlWarningOrError);
                                delete RGWarningOrError;
@@ -999,7 +999,7 @@ odbc_SQLSvc_Prepare2_sme_(
                        {
                                char *RGWarningOrError;
                                RGWarningOrError = new char[256];
-                               sprintf(b,"lf",pSrvrStmt->cost_info.totalTime);
+                               sprintf(b,"%lf",pSrvrStmt->cost_info.totalTime);
                                sprintf(RGWarningOrError, "The query's 
estimated cost: %.50s exceeded resource management attribute limit set.", b);
                                GETMXCSWARNINGORERROR(-1, "HY000", 
RGWarningOrError, sqlWarningOrErrorLength, sqlWarningOrError);
                                delete RGWarningOrError;
@@ -1265,7 +1265,7 @@ odbc_SQLSvc_Prepare2withRowsets_sme_(
                        {
                                char RGWarningOrError[256];
 
-                               sprintf(b,"lf",pSrvrStmt->cost_info.totalTime);
+                               sprintf(b,"%lf",pSrvrStmt->cost_info.totalTime);
                                sprintf(RGWarningOrError, "The query's 
estimated cost: %.50s exceeded resource management attribute limit set.", b);
                                GETMXCSWARNINGORERROR(1, "01000", 
RGWarningOrError, sqlWarningOrErrorLength, sqlWarningOrError);
                        }
@@ -1294,7 +1294,7 @@ odbc_SQLSvc_Prepare2withRowsets_sme_(
                        {
                                char *RGWarningOrError;
                                RGWarningOrError = new char[256];
-                               sprintf(b,"lf",pSrvrStmt->cost_info.totalTime);
+                               sprintf(b,"%lf",pSrvrStmt->cost_info.totalTime);
                                sprintf(RGWarningOrError, "The query's 
estimated cost: %.50s exceeded resource management attribute limit set.", b);
                                GETMXCSWARNINGORERROR(-1, "HY000", 
RGWarningOrError, sqlWarningOrErrorLength, sqlWarningOrError);
                                delete RGWarningOrError;
@@ -2233,7 +2233,7 @@ rePrepare2( SRVR_STMT_HDL *pSrvrStmt
                {
                        char RGWarningOrError[256];
 
-                       sprintf(b,"lf",pSrvrStmt->cost_info.totalTime);
+                       sprintf(b,"%lf",pSrvrStmt->cost_info.totalTime);
                        sprintf( RGWarningOrError
                   , "The query's estimated cost: %.50s exceeded resource 
management attribute limit set."
                   , b
@@ -2260,7 +2260,7 @@ rePrepare2( SRVR_STMT_HDL *pSrvrStmt
                        char *RGWarningOrError;
 
                        RGWarningOrError = new char[256];
-                       sprintf(b,"lf",pSrvrStmt->cost_info.totalTime);
+                       sprintf(b,"%lf",pSrvrStmt->cost_info.totalTime);
                        sprintf( RGWarningOrError
                   , "The query's estimated cost: %.50s exceeded resource 
management attribute limit set."
                   , b

http://git-wip-us.apache.org/repos/asf/trafodion/blob/f897fff4/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp 
b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
index bab28c5..c40fdd6 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
@@ -2307,7 +2307,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER      
ODBCAppVersion,
                                                                
pSQLTimestamp->hour,pSQLTimestamp->minute,pSQLTimestamp->second,
                                                                cTmpFraction);
                                else
-                                       DataLen = sprintf(cTmpBuf,"%02d",
+                                       DataLen = 
sprintf(cTmpBuf,"%02d:%02d:%02d",
                                                                
pSQLTimestamp->hour,pSQLTimestamp->minute,pSQLTimestamp->second);
                                break;
                        case SQLDTCODE_YEAR_TO_HOUR:
@@ -2861,7 +2861,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER      
ODBCAppVersion,
                                if (intervalTmp->interval_sign == SQL_TRUE)
                                        
sprintf(cTmpBuf,"-%ld",intervalTmp->intval.day_second.hour);
                                else
-                                       
sprintf(cTmpBuf,"%ld",intervalTmp->intval.day_second.hour,intervalTmp->intval.day_second.minute);
+                                       
sprintf(cTmpBuf,"%ld:%ld",intervalTmp->intval.day_second.hour,intervalTmp->intval.day_second.minute);
                                break;
                        case SQL_INTERVAL_MINUTE:
                                if (intervalTmp->interval_sign == SQL_TRUE)
@@ -2923,7 +2923,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER      
ODBCAppVersion,
                                if (intervalTmp->interval_sign == SQL_TRUE)
                                        
sprintf(cTmpBuf,"-%ld",intervalTmp->intval.day_second.hour);
                                else
-                                       
sprintf(cTmpBuf,"%ld",intervalTmp->intval.day_second.hour,intervalTmp->intval.day_second.minute);
+                                       
sprintf(cTmpBuf,"%ld:%ld",intervalTmp->intval.day_second.hour,intervalTmp->intval.day_second.minute);
                                break;
                        case SQL_INTERVAL_MINUTE:
                                if (intervalTmp->interval_sign == SQL_TRUE)

http://git-wip-us.apache.org/repos/asf/trafodion/blob/f897fff4/core/sqf/src/seabed/src/sqstatepi.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/seabed/src/sqstatepi.cpp 
b/core/sqf/src/seabed/src/sqstatepi.cpp
index 383a13a..4f1a267 100644
--- a/core/sqf/src/seabed/src/sqstatepi.cpp
+++ b/core/sqf/src/seabed/src/sqstatepi.cpp
@@ -289,18 +289,23 @@ static void 
sqstate_pi_openers_com(MS_Mon_Node_Info_Entry_Type *pp_node,
     lp_prog = basename(pp_proc->program);
 #ifdef SQ_PHANDLE_VERIFIER
     sprintf(la_title, "sb-openers for process=%s, type=%d(%s), p-id=%d/%d" 
PFVY ", prog=%s",
+            pp_proc->process_name,
+            pp_proc->type,
+            lp_proc_t,
+            pp_proc->nid,
+            pp_proc->pid,
+            pp_proc->verifier,
+            lp_prog);
 #else
     sprintf(la_title, "sb-openers for process=%s, type=%d(%s), p-id=%d/%d, 
prog=%s",
-#endif
             pp_proc->process_name,
             pp_proc->type,
             lp_proc_t,
             pp_proc->nid,
             pp_proc->pid,
-#ifdef SQ_PHANDLE_VERIFIER
-            pp_proc->verifier,
-#endif
             lp_prog);
+#endif
+
     if (pv_str)
         lp_op = "sb_ic_get_openers";
     else
@@ -339,18 +344,22 @@ static void 
sqstate_pi_opens_com(MS_Mon_Node_Info_Entry_Type *pp_node,
     lp_prog = basename(pp_proc->program);
 #ifdef SQ_PHANDLE_VERIFIER
     sprintf(la_title, "sb-opens for process=%s, type=%d(%s), p-id=%d/%d" PFVY 
", prog=%s",
+            pp_proc->process_name,
+            pp_proc->type,
+            lp_proc_t,
+            pp_proc->nid,
+            pp_proc->pid,
+            pp_proc->verifier,
+            lp_prog);
 #else
     sprintf(la_title, "sb-opens for process=%s, type=%d(%s), p-id=%d/%d, 
prog=%s",
-#endif
             pp_proc->process_name,
             pp_proc->type,
             lp_proc_t,
             pp_proc->nid,
             pp_proc->pid,
-#ifdef SQ_PHANDLE_VERIFIER
-            pp_proc->verifier,
-#endif
             lp_prog);
+#endif
     if (pv_str)
         lp_op = "sb_ic_get_opens";
     else

http://git-wip-us.apache.org/repos/asf/trafodion/blob/f897fff4/core/sql/langman/Measure.cpp
----------------------------------------------------------------------
diff --git a/core/sql/langman/Measure.cpp b/core/sql/langman/Measure.cpp
index 9dfe206..3d57f31 100644
--- a/core/sql/langman/Measure.cpp
+++ b/core/sql/langman/Measure.cpp
@@ -57,7 +57,7 @@ void Timer::openLog() {
   char fileName[256];
   char *logFileEnv = 0;
   if((logFileEnv = getenv("MEASURE_LOG_FILE")) != NULL){
-    sprintf(fileName, "%s.%d", pid);
+    sprintf(fileName, "%s.%d", logFileEnv, pid);
     logFile = fopen(fileName, "w+t");
     if(logFile == 0){
       logFile = stderr;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/f897fff4/core/sql/optimizer/MJVIndexBuilder.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/MJVIndexBuilder.cpp 
b/core/sql/optimizer/MJVIndexBuilder.cpp
index 3fe08fc..99ba778 100644
--- a/core/sql/optimizer/MJVIndexBuilder.cpp
+++ b/core/sql/optimizer/MJVIndexBuilder.cpp
@@ -534,7 +534,7 @@ NestingStack::out()         const
   for (size_t i = 0; i < size; i++) {
     at(i)->out();
     if (i < size-1) {
-      printf(" --> ", i);
+      printf(" --> ");
     }
   }
 };
@@ -853,7 +853,7 @@ MJVIndexBuilder::buildIndex(const IndexList inputList)
 void PrintColIndList (const IndexList& toPrint, char* name)
 {
   printf ("\n%s:\n",name);
-  printf ("--------------------------\n",name);
+  printf ("--------------------------\n");
   for (size_t i = 0; i < toPrint.entries(); i++) 
   {
     ColIndList currList = toPrint.at(i);       

http://git-wip-us.apache.org/repos/asf/trafodion/blob/f897fff4/win-odbc64/odbcclient/drvr35/cdesc.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/cdesc.cpp 
b/win-odbc64/odbcclient/drvr35/cdesc.cpp
index a8b2d94..73b6326 100644
--- a/win-odbc64/odbcclient/drvr35/cdesc.cpp
+++ b/win-odbc64/odbcclient/drvr35/cdesc.cpp
@@ -2299,7 +2299,8 @@ SQLRETURN CDesc::BuildValueList(CStmt *pHandle,  //AMR - 
changed this pointer ty
                                                
pHandle->setDiagRec(DRIVER_ERROR, retCode, 0, (char *)errorMsg, NULL, 
RowNumber, ParamNumber);
                                        else
                                        {
-                                               sprintf((char *)errorMsg," 
Incorrect Format or Data.", RowNumber, ParamNumber);
+                                               sprintf((char *)errorMsg," 
Incorrect Format or Data [RowNumber: %d, ParamNumber:%d].",
+                                                        RowNumber, 
ParamNumber);
                                                
pHandle->setDiagRec(DRIVER_ERROR, retCode, 0, (char *)errorMsg, NULL,
                                                                RowNumber, 
ParamNumber);
                                        }

http://git-wip-us.apache.org/repos/asf/trafodion/blob/f897fff4/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp 
b/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
index 2b1a39f..a4f53f3 100644
--- a/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
+++ b/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
@@ -2170,7 +2170,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER      
ODBCAppVersion,
                                                                
pSQLTimestamp->hour,pSQLTimestamp->minute,pSQLTimestamp->second,
                                                                cTmpFraction);
                                else
-                                       DataLen = sprintf(cTmpBuf,"%02d",
+                                       DataLen = 
sprintf(cTmpBuf,"%02d:%02d:%02d",
                                                                
pSQLTimestamp->hour,pSQLTimestamp->minute,pSQLTimestamp->second);
                                break;
                        case SQLDTCODE_YEAR_TO_HOUR:
@@ -2717,7 +2717,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER      
ODBCAppVersion,
                                if (intervalTmp->interval_sign == SQL_TRUE)
                                        
sprintf(cTmpBuf,"-%ld",intervalTmp->intval.day_second.hour);
                                else
-                                       
sprintf(cTmpBuf,"%ld",intervalTmp->intval.day_second.hour,intervalTmp->intval.day_second.minute);
+                                       sprintf(cTmpBuf,"%ld 
%ld",intervalTmp->intval.day_second.hour,intervalTmp->intval.day_second.minute);
                                break;
                        case SQL_INTERVAL_MINUTE:
                                if (intervalTmp->interval_sign == SQL_TRUE)
@@ -2779,7 +2779,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER      
ODBCAppVersion,
                                if (intervalTmp->interval_sign == SQL_TRUE)
                                        
sprintf(cTmpBuf,"-%ld",intervalTmp->intval.day_second.hour);
                                else
-                                       
sprintf(cTmpBuf,"%ld",intervalTmp->intval.day_second.hour,intervalTmp->intval.day_second.minute);
+                                       sprintf(cTmpBuf,"%ld 
%ld",intervalTmp->intval.day_second.hour,intervalTmp->intval.day_second.minute);
                                break;
                        case SQL_INTERVAL_MINUTE:
                                if (intervalTmp->interval_sign == SQL_TRUE)

Reply via email to