You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2019/02/26 17:01:41 UTC
[trafodion] branch master updated: remove unused code in mxosrvr
--first step
This is an automated email from the ASF dual-hosted git repository.
selva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafodion.git
The following commit(s) were added to refs/heads/master by this push:
new 94a433e remove unused code in mxosrvr --first step
new f4fa651 Merge pull request #1798 from CoderSong2015/deleteNoUseCodeInMXOSRVR
94a433e is described below
commit 94a433ef0586b9376d8b7c6189c605c9cbf608c2
Author: haolin.song <ha...@esgyn.cn>
AuthorDate: Thu Feb 14 06:53:57 2019 +0000
remove unused code in mxosrvr --first step
---
core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.cpp | 308 ---------------------
core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h | 48 ----
2 files changed, 356 deletions(-)
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.cpp b/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.cpp
index 2ce5496..1ed101d 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.cpp
@@ -167,73 +167,6 @@ void SRVR::formatQueryStateMsg( char *queryStateMsg
}
}
-//LCOV_EXCL_START
-Int32 SRVR::getMXCS_SCHEMAversion(
- /* In */ CEE_tag_def objtag_
- , /* In */ const CEE_handle_def *call_id_
- , /* In*/ SMD_QUERY_TABLE *queryTable
- , /* Out */ ERROR_DESC_LIST_def *sqlWarning)
-{
- const char *inputParam[10];
- CEE_status sts;
- short retCode = 0;
- char stmtLabel[MAX_STMT_LABEL_LEN+1];
- char tempStr[MAX_ANSI_NAME_LEN+1];
- IDL_long rowsAffected;
- SQLValueList_def outputValueList;
- DIALOGUE_ID_def dialogueId = 0;
- ERROR_DESC_def *error_desc_def;
- const char *tempinputParam[10];
- odbc_SQLSvc_Prepare_exc_ prepareException={0,0,0};
- odbc_SQLSvc_ExecuteN_exc_ executeException={0,0,0};
- odbc_SQLSvc_FetchN_exc_ fetchException={0,0,0};
- odbc_SQLSvc_Close_exc_ CloseException={0,0,0};
- CloseException.exception_nr=0;
- IDL_long temprowsAffected;
- SQLValueList_def tempoutputValueList;
- SQLValue_def *tempSQLValue;
-
- strcpy(stmtLabel, "SQL_MXCS_VERS_Q1"); //"SQL_MXCS_VERS_Q1", CfgMXCSVerQ1: this must be executed before any smdQueryTable labels that use DEF_SCH index
- retCode = executeAndFetchSQLQuery(objtag_, call_id_, dialogueId, queryTable, stmtLabel,
- 1, (char **)tempinputParam, &prepareException,
- &executeException, &fetchException, sqlWarning, &temprowsAffected,
- &tempoutputValueList);
- if(retCode == FETCH_EXCEPTION &&
- fetchException.exception_nr == odbc_SQLSvc_FetchN_SQLError_exn_)
- {
- error_desc_def = fetchException.u.SQLError.errorList._buffer;
- if(error_desc_def->sqlcode == -8574 || error_desc_def->sqlcode == -8551)
- {
- strcpy(stmtLabel, "SQL_MXCS_VERS_Q1");
- retCode = executeAndFetchSQLQuery(objtag_, call_id_, dialogueId, queryTable, stmtLabel,
- 1, (char **)tempinputParam, &prepareException,
- &executeException, &fetchException, sqlWarning, &temprowsAffected,
- &tempoutputValueList);
-
- if( retCode != CEE_SUCCESS )
- return 0;
- }
- else
- return 0;
- }
- else if( retCode != CEE_SUCCESS && fetchException.exception_nr != odbc_SQLSvc_FetchN_SQLNoDataFound_exn_)
- // Freestatement done inside doExecSql()
- return 0;
- else if (retCode == CEE_SUCCESS)
- {
- tempSQLValue = (SQLValue_def *)tempoutputValueList._buffer;
- if (tempSQLValue->dataInd == -1)
- return 0;
- else
- srvrGlobal->MXCS_SCHEMA_Version = *(Int32 *)(tempSQLValue->dataValue._buffer);
- }
- odbc_SQLSvc_Close_sme_(objtag_, call_id_, &CloseException, dialogueId, stmtLabel,
- SQL_CLOSE, &rowsAffected, sqlWarning);
-
- return srvrGlobal->MXCS_SCHEMA_Version;
-}
-//LCOV_EXCL_STOP
-
SRVR_STMT_HDL_LIST *SRVR::allocSrvrStmtHdlList()
{
SRVRTRACE_ENTER(FILE_COMMON+3);
@@ -803,134 +736,6 @@ void SRVR::releaseCachedObject(BOOL internalStmt, NDCS_SUBSTATE mxsrvr_substate)
return;
}
-/* Common Function to execute Catalog SQL
- * Statements
-*/
-
-short SRVR::do_ExecSql(
- /* In */ CEE_tag_def objtag_
- , /* In */ const CEE_handle_def *call_id_
- , /* Out */ odbc_SQLSvc_Prepare_exc_ *prepareException
- , /* Out */ odbc_SQLSvc_ExecuteN_exc_ *executeException
- , /* Out */ ERROR_DESC_LIST_def *sqlWarning
- , /* In */ DIALOGUE_ID_def dialogueId
- , /* In */ SMD_QUERY_TABLE *queryTable
- , /* In */ const IDL_char *stmtLabel
- , /* In */ const IDL_char *catalogNm
- , /* In */ const IDL_char *locationNm
- , /* In */ char *inputParam[]
- , /* Out */ SQLItemDescList_def *outputDesc)
-{
- SRVRTRACE_ENTER(FILE_COMMON+9);
-
- static char sqlString[8192]; // Increased it from 4096 to 8192
- SRVR_STMT_HDL *pSrvrStmt;
- IDL_long estimatedCost;
- SQLItemDescList_def inputDesc;
- IDL_long rowsAffected;
- SQLItemDesc_def *SQLItemDesc;
- SMD_QUERY_TABLE *smdQueryTable;
- IDL_unsigned_long curParamNo;
- Int32 allocLength;
- Int32 retcode;
- IDL_short sqlStmtType;
- SQLRETURN rc;
-
- if ((smdQueryTable = getSmdSelectTable (queryTable, stmtLabel, &sqlStmtType)) == NULL)
- return STMT_LABEL_NOT_FOUND;
- if (((pSrvrStmt = getSrvrStmt(stmtLabel, FALSE)) == NULL) ||
- (smdQueryTable->preparedState == FALSE)
- ||
- (smdQueryTable->catalogDependent && smdQueryTable->catalogNm != NULL &&
- strcmp(smdQueryTable->catalogNm, catalogNm) != 0)
- )
- {
- // This is the NOT the first prepare, may be different catalog or there was an error
- // in the last prepare or execute so we are trying again
- if (pSrvrStmt != NULL)
- pSrvrStmt->InternalStmtClose(SQL_DROP);
- AssembleSqlString(smdQueryTable->smdSelectTable, catalogNm, locationNm, sqlString);
- if(diagnostic_flags){
- TraceOut(TR_SQL_API,sqlString);
- }
- prepareException->exception_nr = 0;
- odbc_SQLSvc_Prepare_sme_(objtag_ , call_id_, prepareException, dialogueId,
- stmtLabel, "", INTERNAL_STMT, sqlString,
- SQL_ASYNC_ENABLE_OFF, 0, &estimatedCost, &inputDesc,
- outputDesc, sqlWarning);
-
- if ((pSrvrStmt = getSrvrStmt(stmtLabel, FALSE)) == NULL)
- {
- SendEventMsg(MSG_PROGRAMMING_ERROR, EVENTLOG_ERROR_TYPE,
- srvrGlobal->nskProcessInfo.processId, ODBCMX_SERVER, srvrGlobal->srvrObjRef,
- 1, "NULL pSrvrStmt in do_ExecSql");
- return PROGRAM_ERROR;
- }
-
- if (prepareException->exception_nr != CEE_SUCCESS)
- {
- smdQueryTable->preparedState = FALSE;
- strcpy(smdQueryTable->catalogNm, "");
- return PREPARE_EXCEPTION;
- }
- else
- {
- smdQueryTable->preparedState = TRUE;
- if (catalogNm != NULL)
- strcpy(smdQueryTable->catalogNm, catalogNm);
- }
- rc = AllocAssignValueBuffer(pSrvrStmt->bSQLValueListSet,&pSrvrStmt->inputDescList,
- &pSrvrStmt->inputValueList, pSrvrStmt->inputDescVarBufferLen, 1,
- pSrvrStmt->inputValueVarBuffer);
- if (rc != SQL_SUCCESS)
- return rc;
- }
- else
- {
- // Close the statement if it is not closed earlier and ignore any error
- // Assuming Close ignores errors and clears the diagnostics
- pSrvrStmt->InternalStmtClose(SQL_CLOSE);
- outputDesc->_length = pSrvrStmt->outputDescList._length;
- outputDesc->_buffer = pSrvrStmt->outputDescList._buffer;
- }
- for (curParamNo = 0, pSrvrStmt->inputValueList._length = 0;
- curParamNo < pSrvrStmt->inputDescList._length ; curParamNo++)
- {
- IDL_short indValue;
- SQLItemDesc = (SQLItemDesc_def *)pSrvrStmt->inputDescList._buffer + curParamNo;
- allocLength = getAllocLength(SQLItemDesc->dataType, SQLItemDesc->maxLen);
- if (inputParam[curParamNo] == NULL)
- indValue = -1;
- else
- indValue = 0;
- retcode = kdsCopyToSMDSQLValueSeq(&pSrvrStmt->inputValueList,
- SQLItemDesc->dataType, indValue, inputParam[curParamNo], allocLength, SQLItemDesc->ODBCCharset);
- if (retcode != 0)
- return ((short) retcode);
- }
- executeException->exception_nr = 0;
- // sqlStmtType has value of types like TYPE_SELECT, TYPE_DELETE etc.
- odbc_SQLSvc_ExecuteN_sme_(objtag_, call_id_, executeException, dialogueId, stmtLabel, "",
- sqlStmtType, 1, &pSrvrStmt->inputValueList, SQL_ASYNC_ENABLE_OFF, 0, &rowsAffected, sqlWarning);
- switch (executeException->exception_nr)
- {
- case CEE_SUCCESS:
- break;
- case odbc_SQLSvc_ExecuteN_SQLRetryCompile_exn_:
- // Since We want to Reprepare the statement, Drop the statement first
- // and Try preparing again
- //Easy way, change it as an EXTERNAL_STMT and do Close with SQL_DROP
- // option
- pSrvrStmt->InternalStmtClose(SQL_DROP);
- do_ExecSql(objtag_, call_id_, prepareException, executeException, sqlWarning,
- dialogueId, queryTable, stmtLabel, catalogNm, locationNm, inputParam, outputDesc);
- default:
- return EXECUTE_EXCEPTION;
- }
- SRVRTRACE_EXIT(FILE_COMMON+9);
- return 0;
-}
-
short SRVR::do_ExecSMD(
/* In */ CEE_tag_def objtag_
, /* In */ const CEE_handle_def *call_id_
@@ -1439,119 +1244,6 @@ BOOL SRVR::checkIfWildCard(const IDL_char *inName, IDL_char *outName)
// SqlWarning is ignored at present.
//
-short SRVR::executeSQLQuery( CEE_tag_def objtag_
- , const CEE_handle_def *call_id_
- , DIALOGUE_ID_def dialogueId
- , SMD_QUERY_TABLE *queryTable
- , const IDL_char *stmtLabel
- , const IDL_char *locationNm
- , char *inputParam[]
- , odbc_SQLSvc_Prepare_exc_ *prepareException
- , odbc_SQLSvc_ExecuteN_exc_ *executeException
- , ERROR_DESC_LIST_def *sqlWarning)
-{
- SRVRTRACE_ENTER(FILE_COMMON+14);
-
- short retCode =0;
- char catalogNm[MAX_SQL_IDENTIFIER_LEN+3];
- strcpy(catalogNm,srvrGlobal->SystemCatalog);
- SQLItemDescList_def outputDesc;
- prepareException->exception_nr=0;
- executeException->exception_nr=0;
- sqlWarning->_length=0;
- sqlWarning->_buffer=NULL;
-
- retCode = do_ExecSql(objtag_, call_id_, prepareException, executeException,
- sqlWarning, dialogueId, queryTable, stmtLabel, catalogNm,
- locationNm, (char **)inputParam, &outputDesc);
-
- if(retCode != CEE_SUCCESS)
- {
- SRVR_STMT_HDL *pSrvrStmt;
- char *tmpString;
- char *UTF8ErrorText = NULL;
- Int32 UTF8ErrorTextLen = 0;
- if ((pSrvrStmt = getSrvrStmt(stmtLabel, FALSE)) != NULL )
- {
- tmpString = new char[strlen(pSrvrStmt->sqlString)+25];
- sprintf (tmpString, "SQL Query \"%s\" Failed", pSrvrStmt->sqlString);
- UTF8ErrorTextLen = strlen(tmpString)*4;
- markNewOperator,UTF8ErrorText = new char[UTF8ErrorTextLen];
- translateToUTF8(srvrGlobal->isoMapping, tmpString, strlen(tmpString), UTF8ErrorText, UTF8ErrorTextLen);
- SendEventMsg(MSG_SQL_ERROR, EVENTLOG_ERROR_TYPE,
- srvrGlobal->nskProcessInfo.processId, ODBCMX_SERVER, srvrGlobal->srvrObjRef,
- 3, ODBCMX_SERVER, "See program for returned error", tmpString);
- delete [] tmpString;
- delete [] UTF8ErrorText;
- }
- }
-
- SRVRTRACE_EXIT(FILE_COMMON+14);
-
- return retCode;
-}
-
-short SRVR::executeAndFetchSQLQuery(
- /* In */ CEE_tag_def objtag_
- , /* In */ const CEE_handle_def *call_id_
- , /* In */ DIALOGUE_ID_def dialogueId
- , /* In */ SMD_QUERY_TABLE *queryTable
- , /* In */ const IDL_char *stmtLabel
- , /* In */ IDL_long maxRowCnt
- , /* In */ char *inputParam[]
- , /* Out */ odbc_SQLSvc_Prepare_exc_ *prepareException
- , /* Out */ odbc_SQLSvc_ExecuteN_exc_ *executeException
- , /* Out */ odbc_SQLSvc_FetchN_exc_ *fetchException
- , /* Out */ ERROR_DESC_LIST_def *sqlWarning
- , /* Out */ IDL_long *rowsAffected
- , /* Out */ SQLValueList_def *outputValueList)
-{
- SRVRTRACE_ENTER(FILE_COMMON+15);
-
- short retCode =0;
- prepareException->exception_nr=0;
- executeException->exception_nr=0;
- fetchException->exception_nr = 0;
- sqlWarning->_length=0;
- sqlWarning->_buffer=NULL;
-
- retCode = executeSQLQuery(objtag_, call_id_, dialogueId, queryTable, stmtLabel, NULL,
- (char **)inputParam, prepareException,
- executeException, sqlWarning);
-
- if(retCode != CEE_SUCCESS)
- return retCode;
-
-
- odbc_SQLSvc_FetchN_sme_(objtag_, call_id_, fetchException, dialogueId, stmtLabel, maxRowCnt, 0,
- SQL_ASYNC_ENABLE_OFF, 0, rowsAffected, outputValueList, sqlWarning);
-
- if (fetchException->exception_nr != CEE_SUCCESS )
- {
- SRVR_STMT_HDL *pSrvrStmt;
- char *tmpString;
- char *UTF8ErrorText = NULL;
- Int32 UTF8ErrorTextLen = 0;
- if ((pSrvrStmt = getSrvrStmt(stmtLabel, FALSE)) != NULL && fetchException->exception_nr != odbc_SQLSvc_FetchN_SQLNoDataFound_exn_)
- {
- tmpString = new char[strlen(pSrvrStmt->sqlString)+25];
- sprintf (tmpString, "SQL Query \"%s\" Failed", pSrvrStmt->sqlString);
- UTF8ErrorTextLen = strlen(tmpString)*4;
- markNewOperator,UTF8ErrorText = new char[UTF8ErrorTextLen];
- translateToUTF8(srvrGlobal->isoMapping, tmpString, strlen(tmpString), UTF8ErrorText, UTF8ErrorTextLen);
- SendEventMsg(MSG_SQL_ERROR, EVENTLOG_ERROR_TYPE,
- srvrGlobal->nskProcessInfo.processId, ODBCMX_SERVER, srvrGlobal->srvrObjRef,
- 3, ODBCMX_SERVER, "See program for returned error", tmpString);
- delete [] tmpString;
- delete [] UTF8ErrorText;
- }
- return FETCH_EXCEPTION;
- }
- SRVRTRACE_EXIT(FILE_COMMON+15);
-
- return CEE_SUCCESS;
-}
-
short SRVR::executeAndFetchSMDQuery(
/* In */ CEE_tag_def objtag_
, /* In */ const CEE_handle_def *call_id_
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h b/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h
index 77f7a49..ab344df 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/srvrcommon.h
@@ -107,15 +107,6 @@ extern void formatQueryStateMsg( char *queryStateMsg
, const char *sqlText = NULL
);
-//LCOV_EXCL_START
-extern Int32 getMXCS_SCHEMAversion(
- /* In */ CEE_tag_def objtag_
- , /* In */ const CEE_handle_def *call_id_
- , /* In */ SMD_QUERY_TABLE *queryTable
- , /* Out */ ERROR_DESC_LIST_def *sqlWarning
-);
-//LCOV_EXCL_STOP
-
extern SRVR_STMT_HDL *getSrvrStmt( const IDL_char *stmtLabel
, BOOL canAddStmt
, const char *moduleName = NULL
@@ -135,20 +126,6 @@ extern void removeSrvrStmt(SRVR_STMT_HDL *pSrvrStmt);
extern Int32 getAllocLength(Int32 DataType, Int32 Length);
extern void releaseCachedObject(BOOL internalStmt, NDCS_SUBSTATE mx_sub = NDCS_INIT);
-extern short do_ExecSql(
- /* In */ CEE_tag_def objtag_
- , /* In */ const CEE_handle_def *call_id_
- , /* Out */ odbc_SQLSvc_Prepare_exc_ *prepareException
- , /* Out */ odbc_SQLSvc_ExecuteN_exc_ *executeException
- , /* Out */ ERROR_DESC_LIST_def *sqlWarning
- , /* In */ DIALOGUE_ID_def dialogueId
- , /* In */ SMD_QUERY_TABLE *queryTable
- , /* In */ const IDL_char *stmtLabel
- , /* In */ const IDL_char *catalogNm
- , /* In */ const IDL_char *locationNm
- , /* In */ char *inputParam[]
- , /* Out */ SQLItemDescList_def *outputDesc);
-
extern void convertWildcard(UInt32 metadataId, BOOL isPV, const IDL_char *inName, IDL_char *outName, BOOL isCatalog=FALSE);
extern void convertWildcardNoEsc(UInt32 metadataId, BOOL isPV, const IDL_char *inName, IDL_char *outName, BOOL isCatalog=FALSE);
extern BOOL checkIfWildCard(const IDL_char *inName, IDL_char *outName);
@@ -162,31 +139,6 @@ extern short execDirectSQLQuery(SRVR_STMT_HDL *pSrvrStmt, char *pSqlStr,
// This is done to minimize the compilcations in project settings and also it is felt that
// each DLL may have different implementation for these functions
-extern short executeSQLQuery( CEE_tag_def objtag_
- , const CEE_handle_def *call_id_
- , DIALOGUE_ID_def dialogueId
- , SMD_QUERY_TABLE *queryTable
- , const IDL_char *stmtLabel
- , const IDL_char *locationNm
- , char *inputParam[]
- , odbc_SQLSvc_Prepare_exc_ *prepareException
- , odbc_SQLSvc_ExecuteN_exc_ *executeException
- , ERROR_DESC_LIST_def *sqlWarning);
-
-extern short executeAndFetchSQLQuery( CEE_tag_def objtag_
- , const CEE_handle_def *call_id_
- , DIALOGUE_ID_def dialogueId
- , SMD_QUERY_TABLE *queryTable
- , const IDL_char *stmtLabel
- , IDL_long maxRowCnt
- , char *inputParam[]
- , odbc_SQLSvc_Prepare_exc_ *prepareException
- , odbc_SQLSvc_ExecuteN_exc_ *executeException
- , odbc_SQLSvc_FetchN_exc_ *fetchException
- , ERROR_DESC_LIST_def *sqlWarning
- , IDL_long *rowsAffected
- , SQLValueList_def *outputValueList);
-
extern short executeAndFetchSMDQuery(CEE_tag_def objtag_
, const CEE_handle_def *call_id_
, DIALOGUE_ID_def dialogueId