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 3de75b6 [TRAFODION-3329] Code cleanup in Type 2 driver new 582d81a Merge pull request #1860 from selvaganesang/t2_driver_cleanup_1 3de75b6 is described below commit 3de75b6fb1796f679519f3089c44ee82c9bd5780 Author: selvaganesang <se...@apache.org> AuthorDate: Thu Oct 3 22:01:56 2019 +0000 [TRAFODION-3329] Code cleanup in Type 2 driver Removed nowait and mploc related code in T2 driver. Both of these concepts are not valid anymore. --- core/conn/jdbc_type2/native/CSrvrStmt.cpp | 28 -- core/conn/jdbc_type2/native/CSrvrStmt.h | 2 - core/conn/jdbc_type2/native/CoreCommon.h | 6 - core/conn/jdbc_type2/native/GlobalInformation.h | 10 - core/conn/jdbc_type2/native/SQLMXConnection.cpp | 114 +------- core/conn/jdbc_type2/native/SQLMXDriver.cpp | 70 +---- core/conn/jdbc_type2/native/SqlInterface.cpp | 315 +-------------------- core/conn/jdbc_type2/native/SrvrCommon.cpp | 28 -- core/conn/jdbc_type2/native/pThreadsSync.h | 9 - .../apache/trafodion/jdbc/t2/SQLMXConnection.java | 11 +- .../org/apache/trafodion/jdbc/t2/T2Driver.java | 5 +- .../org/apache/trafodion/jdbc/t2/T2Properties.java | 53 ---- 12 files changed, 15 insertions(+), 636 deletions(-) diff --git a/core/conn/jdbc_type2/native/CSrvrStmt.cpp b/core/conn/jdbc_type2/native/CSrvrStmt.cpp index 8d1b6e0..1262f33 100644 --- a/core/conn/jdbc_type2/native/CSrvrStmt.cpp +++ b/core/conn/jdbc_type2/native/CSrvrStmt.cpp @@ -103,7 +103,6 @@ SRVR_STMT_HDL::SRVR_STMT_HDL(long inDialogueId) IRD = NULL; useDefaultDesc = FALSE; dialogueId = inDialogueId; - nowaitRetcode = SQL_SUCCESS; holdability = CLOSE_CURSORS_AT_COMMIT; fetchQuadEntries = 0; fetchRowsetSize = 0; @@ -113,7 +112,6 @@ SRVR_STMT_HDL::SRVR_STMT_HDL(long inDialogueId) batchQuadField = NULL; inputDescParamOffset = 0; batchMaxRowsetSize = 0; - stmtInitForNowait = FALSE; // +++ T2_REPO bLowCost = false; // May not need this m_need_21036_end_msg = false; @@ -148,9 +146,6 @@ SRVR_STMT_HDL::~SRVR_STMT_HDL() int retcode; cleanupAll(); inState = STMTSTAT_NONE; -#ifndef DISABLE_NOWAIT - if (stmtInitForNowait) mutexCondDestroy(&cond, &mutex); -#endif FUNCTION_RETURN_VOID((NULL)); } @@ -542,13 +537,6 @@ void SRVR_STMT_HDL::processThreadReturnCode(void) // (-104) error. threadReturnCode = SQL_RETRY_COMPILE_AGAIN; break; - case NOWAIT_ERROR: - // Allocate Error Desc - kdsCreateSQLErrorException(&sqlError, 1); - kdsCopySQLErrorException(&sqlError, SQLSVC_EXCEPTION_NOWAIT_ERROR, nowaitRetcode, - "HY000"); - threadReturnCode = SQL_ERROR; - break; } FUNCTION_RETURN_VOID((NULL)); } @@ -582,14 +570,6 @@ SQLRETURN SRVR_STMT_HDL::allocSqlmxHdls(const char *inStmtName, const char *inMo sqlStmtType = inSqlStmtType; useDefaultDesc = inUseDefaultDesc; rc = ALLOCSQLMXHDLS(this); - -#ifndef DISABLE_NOWAIT - if (rc >= 0) - rc = initStmtForNowait(&cond, &mutex); - if (rc == 0) - stmtInitForNowait = TRUE; -#endif - CLI_DEBUG_RETURN_SQL(rc); } @@ -638,14 +618,6 @@ SQLRETURN SRVR_STMT_HDL::allocSqlmxHdls_spjrs(SQLSTMT_ID *callpStmt, const char isSPJRS = true; rc = ALLOCSQLMXHDLS_SPJRS(this, callpStmt, RSstmtName); - -#ifndef DISABLE_NOWAIT - if (rc >= 0) - rc = initStmtForNowait(&cond, &mutex); - if (rc == 0) - stmtInitForNowait = TRUE; -#endif - CLI_DEBUG_RETURN_SQL(rc); } diff --git a/core/conn/jdbc_type2/native/CSrvrStmt.h b/core/conn/jdbc_type2/native/CSrvrStmt.h index f0aa3eb..93685fa 100644 --- a/core/conn/jdbc_type2/native/CSrvrStmt.h +++ b/core/conn/jdbc_type2/native/CSrvrStmt.h @@ -111,7 +111,6 @@ public: SRVR_DESC_HDL *IRD; BOOL useDefaultDesc; long dialogueId; - long nowaitRetcode; short holdability; long fetchQuadEntries; long fetchRowsetSize; @@ -175,7 +174,6 @@ public: // T2_REPO bool isISUD; - BOOL stmtInitForNowait; inline void setSqlQueryStatementType (int Type) { SqlQueryStatementType = Type; }; diff --git a/core/conn/jdbc_type2/native/CoreCommon.h b/core/conn/jdbc_type2/native/CoreCommon.h index 7fb166c..992dbad 100644 --- a/core/conn/jdbc_type2/native/CoreCommon.h +++ b/core/conn/jdbc_type2/native/CoreCommon.h @@ -279,7 +279,6 @@ typedef enum _STOP_TYPE #define SQLSVC_EXCEPTION_BUFFER_ALLOC_FAILED "Buffer Allocation Failed" #define SQLSVC_EXCEPTION_INVALID_HANDLE "Error while allocating Handles in SQL/MX" #define SQLSVC_EXCEPTION_PREPARE_FAILED "Error while preparing the query" -#define SQLSVC_EXCEPTION_NOWAIT_ERROR "Error in thread synchronizing functions - Vendor code is FS Error" #define SQLSVC_EXCEPTION_INVALID_SCHEMA_VERSION "Invalid Schema version" // Used for Metadata schemaVersion setup @@ -300,7 +299,6 @@ typedef enum _STOP_TYPE #define SQL_RETRY_COMPILE_AGAIN -104 #define SQL_QUERY_CANCELLED -105 #define CANCEL_NOT_POSSIBLE -106 -#define NOWAIT_ERROR -107 #define SQL_RS_DOES_NOT_EXIST -108 #define TYPE_UNKNOWN 0x0000 @@ -382,8 +380,6 @@ typedef struct _SRVR_GLOBAL_Def char CurrentCatalog[129]; // Added for MFC char CurrentSchema[129]; // Added for MFC bool jdbcProcess; // This flag is used to determine the query for SQLTables - short nowaitOn; - short nowaitFilenum; char SystemCatalog[129]; // MX system catalog name short boolFlgforInitialization; // Flag intorduced for Connect/disconnect imp. @@ -457,8 +453,6 @@ typedef struct tagTIME_TYPE #define SQLCLI_ODBC_MODULE_VERSION 1 -#define NOWAIT_PENDING -8002 - // Errors returned from SQL_EXEC_AllocStmtForRS() #define STMT_ALREADY_EXISTS -8802 #define STMT_DOES_NOT_EXIST -8804 diff --git a/core/conn/jdbc_type2/native/GlobalInformation.h b/core/conn/jdbc_type2/native/GlobalInformation.h index 61d5997..528ec5f 100644 --- a/core/conn/jdbc_type2/native/GlobalInformation.h +++ b/core/conn/jdbc_type2/native/GlobalInformation.h @@ -38,7 +38,6 @@ class GlobalInformation { // static jboolean useDefaultEncoding; // Allows a "default" value for the encoding // static int totalCharsets; // static jint defaultCharset; -// static short nowaitFilenum; // static char NskSystemCatalogName[MAX_NSKCATALOGNAME_LEN+1]; // MP system catalog name // static char DefaultCatalog[MAX_CHAR_SET_STRING_LENGTH + 1]; // static char DefaultSchema[MAX_CHAR_SET_STRING_LENGTH + 1]; @@ -83,15 +82,6 @@ public: static char *getDefaultSchemaName () { return (DefaultSchema); } - - inline static void setNoWaitFileNumber (short fileNum) { - nowaitFilenum = fileNum; - return; - } - - inline static short int getNoWaitFileNumber () { - return (nowaitFilenum); - } */ }; diff --git a/core/conn/jdbc_type2/native/SQLMXConnection.cpp b/core/conn/jdbc_type2/native/SQLMXConnection.cpp index c564658..595e449 100644 --- a/core/conn/jdbc_type2/native/SQLMXConnection.cpp +++ b/core/conn/jdbc_type2/native/SQLMXConnection.cpp @@ -380,7 +380,7 @@ JNIEXPORT jint JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_beginTr JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connectInit (JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId, jstring catalog, - jstring schema, jstring mploc, jboolean isReadOnly, jboolean autoCommit, jint transactionIsolation, + jstring schema, jboolean isReadOnly, jboolean autoCommit, jint transactionIsolation, jint loginTimeout, jint queryTimeout, jboolean blnDoomUsrTxn, jint statisticsIntervalTime, jint statisticsLimitTime, jstring statisticsType, jstring programStatisticsEnabled, jstring statisticsSqlPlanEnabled) { @@ -394,8 +394,6 @@ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connect DebugJString(jenv,catalog))); DEBUG_OUT(DEBUG_LEVEL_ENTRY,(" schema=%s", DebugJString(jenv,schema))); - DEBUG_OUT(DEBUG_LEVEL_ENTRY,(" mploc=%s", - DebugJString(jenv,mploc))); DEBUG_OUT(DEBUG_LEVEL_ENTRY,(" isReadOnly=%d, transactionIsolation=%ld", isReadOnly, transactionIsolation)); @@ -412,7 +410,6 @@ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connect const char *nCatalog; const char *nSchema; - const char *nMploc; jthrowable exception; // PUBLISHING @@ -449,8 +446,6 @@ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connect nCatalog = JNI_GetStringUTFChars(jenv,catalog, NULL); if (schema) nSchema = JNI_GetStringUTFChars(jenv,schema, NULL); - if (mploc) - nMploc = JNI_GetStringUTFChars(jenv,mploc, NULL); odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL, &setConnectException, @@ -485,70 +480,6 @@ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connect // new code end #endif /* NOT NEEDED with improvements to Native Expressions code */ - if (srvrGlobal->nowaitOn == 2) - { - odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL, - &setConnectException, - dialogueId, - SET_OLT_QUERY_OPT, - 0, - NULL, - &sqlWarning); - if (setConnectException.exception_nr != CEE_SUCCESS) - { - throwSetConnectionException(jenv, &setConnectException); - FUNCTION_RETURN_VOID(("SET_OLT_QUERY_OPT - setConnectException.exception_nr(%s) is not CEE_SUCCESS", - CliDebugSqlError(setConnectException.exception_nr))); - } - } - - if (mploc) - { - //Solution 10-120315-2068 --- start - /* - The SET NAMETYPE statement sets the NAMETYPE attribute value for the current - SQL session. - The SET NAMETYPE statement sets the NAMETYPE attribute for all dynamic - statements within the control flow scope of an embedded SQL program for the current - SQL session. - SET NAMETYPE is an SQL/MX extension. - ANSI | NSK - specifies whether the system assumes logical names (ANSI) or physical Guardian - names (NSK) are used to reference SQL/MP database objects in SQL statements - */ - odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL, - &setConnectException, - dialogueId, - SET_NAMETYPE, - 0, - "NSK", - &sqlWarning); - if (setConnectException.exception_nr != CEE_SUCCESS) - { - throwSetConnectionException(jenv, &setConnectException); - FUNCTION_RETURN_VOID(("SET_MPLOC - setConnectException.exception_nr(%s) is not CEE_SUCCESS", - CliDebugSqlError(setConnectException.exception_nr))); - } - - //Solution 10-120315-2068 --- end - - odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL, - &setConnectException, - dialogueId, - SET_MPLOC, - 0, - (char *)nMploc, - &sqlWarning); - JNI_ReleaseStringUTFChars(jenv,mploc, nMploc); - - if (setConnectException.exception_nr != CEE_SUCCESS) - { - throwSetConnectionException(jenv, &setConnectException); - FUNCTION_RETURN_VOID(("SET_MPLOC - setConnectException.exception_nr(%s) is not CEE_SUCCESS", - CliDebugSqlError(setConnectException.exception_nr))); - } - } - if (catalog) { odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL, @@ -776,7 +707,7 @@ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connect JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connectReuse (JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId, jint conReuseBitMap, jstring catalog, - jstring schema, jstring mploc, jint transactionIsolation) + jstring schema, jint transactionIsolation) { FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connectReuse",("...")); DEBUG_OUT(DEBUG_LEVEL_ENTRY,(" jenv=0x%08x, server=%s, dialogueId=0x%08x", @@ -789,14 +720,11 @@ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connect DebugJString(jenv,catalog))); DEBUG_OUT(DEBUG_LEVEL_ENTRY,(" schema=%s", DebugJString(jenv,schema))); - DEBUG_OUT(DEBUG_LEVEL_ENTRY,(" mploc=%s", - DebugJString(jenv,mploc))); DEBUG_OUT(DEBUG_LEVEL_ENTRY,(" transactionIsolation=%ld", transactionIsolation)); const char *nCatalog; const char *nSchema; - const char *nMploc; jthrowable exception; jclass jcls = JNI_GetObjectClass(jenv,jobj); @@ -808,8 +736,6 @@ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connect nCatalog = JNI_GetStringUTFChars(jenv,catalog, NULL); if (schema) nSchema = JNI_GetStringUTFChars(jenv,schema, NULL); - if (mploc) - nMploc = JNI_GetStringUTFChars(jenv,mploc, NULL); // Need to reset all if any CONTROL cmds were issued if (conReuseBitMap & org_apache_trafodion_jdbc_t2_SQLMXConnection_SQL_CONTROL_FLAG) @@ -859,42 +785,6 @@ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_SQLMXConnection_connect } // new code end - if (srvrGlobal->nowaitOn == 2) - { - odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL, - &setConnectException, - dialogueId, - SET_OLT_QUERY_OPT, - 0, - NULL, - &sqlWarning); - if (setConnectException.exception_nr != CEE_SUCCESS) - { - throwSetConnectionException(jenv, &setConnectException); - FUNCTION_RETURN_VOID(("SET_OLT_QUERY_OPT - setConnectException.exception_nr(%s) is not CEE_SUCCESS", - CliDebugSqlError(setConnectException.exception_nr))); - } - } - - if (mploc) - { - odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL, - &setConnectException, - dialogueId, - SET_MPLOC, - 0, - (char *)nMploc, - &sqlWarning); - JNI_ReleaseStringUTFChars(jenv,mploc, nMploc); - - if (setConnectException.exception_nr != CEE_SUCCESS) - { - throwSetConnectionException(jenv, &setConnectException); - FUNCTION_RETURN_VOID(("SET_MPLOC - setConnectException.exception_nr(%s) is not CEE_SUCCESS", - CliDebugSqlError(setConnectException.exception_nr))); - } - } - if (catalog) { odbc_SQLSvc_SetConnectionOption_sme_(NULL, NULL, diff --git a/core/conn/jdbc_type2/native/SQLMXDriver.cpp b/core/conn/jdbc_type2/native/SQLMXDriver.cpp index e7a0fba..09d4949 100644 --- a/core/conn/jdbc_type2/native/SQLMXDriver.cpp +++ b/core/conn/jdbc_type2/native/SQLMXDriver.cpp @@ -76,11 +76,10 @@ JNIEXPORT jint JNICALL Java_org_apache_trafodion_jdbc_t2_T2Driver_getPid (JNIEnv * Signature: (Ljava/lang/String;I)V */ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_T2Driver_SQLMXInitialize(JNIEnv *jenv, jclass cls, - jstring language, jint nowaitOn) + jstring language) { - FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_T2Driver_SQLMXInitialize",("language=%s, nowaitOn=%ld", - DebugJString(jenv,language), - nowaitOn)); + FUNCTION_ENTRY("Java_org_apache_trafodion_jdbc_t2_T2Driver_SQLMXInitialize",("language=%s, + DebugJString(jenv,language))); const char *nLanguage; // static GlobalInformation *globalInfo = new GlobalInformation(); @@ -105,71 +104,8 @@ JNIEXPORT void JNICALL Java_org_apache_trafodion_jdbc_t2_T2Driver_SQLMXInitializ if (! cacheJNIObjects(jenv)) FUNCTION_RETURN_VOID(("cacheJNIObjects() failed")); -#ifdef NSK_PLATFORM // Linux port - if (language) - { - nLanguage = JNI_GetStringUTFChars(jenv,language, NULL); - if (strcmp(nLanguage, "ja") == 0) - { - srvrGlobal->clientLCID = MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), SORT_DEFAULT); - srvrGlobal->clientErrorLCID = srvrGlobal->clientLCID; - } - else - if (strcmp(nLanguage, "en") == 0) - { - srvrGlobal->clientLCID = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), SORT_DEFAULT); - srvrGlobal->clientErrorLCID = srvrGlobal->clientLCID; - } - else - { - srvrGlobal->clientLCID = LANG_NEUTRAL; - srvrGlobal->clientErrorLCID = LANG_NEUTRAL; - } - JNI_ReleaseStringUTFChars(jenv,language, nLanguage); - } - else - { - srvrGlobal->clientLCID = LANG_NEUTRAL; - srvrGlobal->clientErrorLCID = LANG_NEUTRAL; - } -#endif - srvrGlobal->dialogueId = 0; // DialogueId is set to zero now - // Linux port - Nowait support is set to OFF for now. - // nowaitOn = 0; // Should come command line or JDBC properties - - switch (nowaitOn) - { - case 0: - srvrGlobal->nowaitOn = 0; - break; - case 1: - srvrGlobal->nowaitOn = 1; - break; - case 2: - srvrGlobal->nowaitOn = 2; - break; - default: - srvrGlobal->nowaitOn = 0; - break; - } - -#ifdef NSK_PLATFORM // Linux port - // setup MP system catalog name - if (envGetSystemCatalogName (&srvrGlobal->NskSystemCatalogName[0]) != TRUE) - { - throwSQLException(jenv, SYSTEM_CATALOG_ERROR, NULL, "HY000", 0); - FUNCTION_RETURN_VOID(("envGetSystemCatalogName() failed")); - } - - // setup MX system catalog name - if (envGetMXSystemCatalogName (&srvrGlobal->SystemCatalog[0]) != TRUE) - { - throwSQLException(jenv, SYSTEM_CATALOG_ERROR, NULL, "HY000", 0); - FUNCTION_RETURN_VOID(("envGetMXSystemCatalogName() failed")); - } -#endif srvrGlobal->boolFlgforInitialization = 1; FUNCTION_RETURN_VOID((NULL)); } diff --git a/core/conn/jdbc_type2/native/SqlInterface.cpp b/core/conn/jdbc_type2/native/SqlInterface.cpp index 49da3fd..861cdec 100644 --- a/core/conn/jdbc_type2/native/SqlInterface.cpp +++ b/core/conn/jdbc_type2/native/SqlInterface.cpp @@ -1155,55 +1155,8 @@ SQLRETURN EXECUTE(SRVR_STMT_HDL* pSrvrStmt) } // End of stmt type switch } // End of VER20 check -#ifndef DISABLE_NOWAIT - if (retcode == NOWAIT_PENDING) - { - rtn = WaitForCompletion(pSrvrStmt, &pSrvrStmt->cond, &pSrvrStmt->mutex); - DEBUG_OUT(DEBUG_LEVEL_CLI,("WaitForCompletion() returned %d",rtn)); - - if (rtn == 0) - { - SQLRETURN rc = pSrvrStmt->switchContext(); - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->switchContext() returned %ld", rc)); - if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO)) THREAD_RETURN(pSrvrStmt,rc); - - switch (pSrvrStmt->nowaitRetcode) - { - case 0: // Wait Success - // If not closed, try closing and clear out diag's - if(!pSrvrStmt->isClosed) - { - retcode = CLI_CloseStmt(pStmt); - pSrvrStmt->isClosed = TRUE; - if (retcode != 0) CLI_ClearDiagnostics(pStmt); - } - retcode = 0; - break; - case 9999: // Wait error - pSrvrStmt->isClosed = TRUE; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - default: // All other errors - pSrvrStmt->isClosed = TRUE; - retcode = GETSQLCODE(pSrvrStmt); - break; - } - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->nowaitRetcode=%ld, retcode=%s", - pSrvrStmt->nowaitRetcode, - CliDebugSqlError(retcode))); - } - else - { - // If waitForCompletion() was not successful (rtn != 0) - pSrvrStmt->isClosed = TRUE; - pSrvrStmt->nowaitRetcode = rtn; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - } - } - else -#endif - { - if (retcode!=SQL_SUCCESS) pSrvrStmt->isClosed = TRUE; - } + if (retcode != SQL_SUCCESS) + pSrvrStmt->isClosed = TRUE; // Process the SQL CLI return code if (retcode != 0){ // SQL success if (retcode == 100) { // No Data Found @@ -1470,39 +1423,6 @@ SQLRETURN PREPARE(SRVR_STMT_HDL* pSrvrStmt) int rtn; -#ifndef DISABLE_NOWAIT - if (retcode == NOWAIT_PENDING){ - rtn = WaitForCompletion(pSrvrStmt, &pSrvrStmt->cond, &pSrvrStmt->mutex); - DEBUG_OUT(DEBUG_LEVEL_CLI,("WaitForCompletion() returned %d",rtn)); - - if (rtn == 0){ - rc = pSrvrStmt->switchContext(); - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->switchContext() returned %ld", rc)); - if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO)) THREAD_RETURN(pSrvrStmt,rc); - - switch (pSrvrStmt->nowaitRetcode) - { - case 0: - retcode = 0; - break; - case 9999: - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - default: - retcode = GETSQLCODE(pSrvrStmt); - break; - } - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->nowaitRetcode=%ld, retcode=%s", - pSrvrStmt->nowaitRetcode, - CliDebugSqlError(retcode))); - } - else - { - pSrvrStmt->nowaitRetcode = rtn; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - } - } -#endif - HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt); pSrvrStmt->estimatedCost = -1; @@ -1658,59 +1578,6 @@ SQLRETURN FETCH(SRVR_STMT_HDL *pSrvrStmt) retcode = CLI_Fetch(&pSrvrStmt->stmt, pDesc, 0); int rtn; - -#ifndef DISABLE_NOWAIT - if (retcode == NOWAIT_PENDING){ - rtn = WaitForCompletion(pSrvrStmt, &pSrvrStmt->cond, &pSrvrStmt->mutex); - DEBUG_OUT(DEBUG_LEVEL_ENTRY,("WaitForCompletion() returned %d",rtn)); - - if (rtn == 0){ - SQLRETURN rc = pSrvrStmt->switchContext(); - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->switchContext() returned %ld", rc)); - if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO)) THREAD_RETURN(pSrvrStmt,rc); - - switch (pSrvrStmt->nowaitRetcode) - { - case 0: // nowaitRetcode is successful - retcode = 0; - break; - case 9999: - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - default: - /* Soln No: 10-070223-2784 - Desc: JDBC/MX should call stmtinfo2 instead of Diagoninfo2 CLI call for rowsets - */ - /* long row = 0; - retcode = CLI_GetDiagnosticsStmtInfo2(&pSrvrStmt->stmt,SQLDIAG_ROW_COUNT,&row,NULL,0,NULL); - if(row == 0) - retcode = GETSQLCODE(pSrvrStmt); - */ - // Refixed 10-070223-2784 for sol.10-090613-2299 - retcode = GETSQLCODE(pSrvrStmt); - - long rows_read_fin = 0; - long retcodenew = 0; - if (pSrvrStmt->fetchRowsetSize > 0) - { - retcodenew = ReadRow(pSrvrStmt, &curRowCount, &rows_read_fin); - if (retcodenew < 0) THREAD_RETURN(pSrvrStmt,retcodenew); - if (retcodenew > 0) sqlWarning = TRUE; - - curRowNo += rows_read_fin; - } - break; - } - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->nowaitRetcode=%ld, retcode=%s", - pSrvrStmt->nowaitRetcode, - CliDebugSqlError(retcode))); - } - else { - pSrvrStmt->nowaitRetcode = rtn; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - } - } -#endif - if (retcode != 0) { //Check for a bad return code if (retcode == 100) @@ -2085,47 +1952,6 @@ SQLRETURN EXECUTESPJRS(SRVR_STMT_HDL *pSrvrStmt) HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt); pSrvrStmt->isClosed = FALSE; -#ifndef DISABLE_NOWAIT - if (retcode == NOWAIT_PENDING){ - rtn = WaitForCompletion(pSrvrStmt, &pSrvrStmt->cond, &pSrvrStmt->mutex); - DEBUG_OUT(DEBUG_LEVEL_CLI,("EXECUTESPJRS : WaitForCompletion() returned %d",rtn)); - - if (rtn == 0) - { - rc = pSrvrStmt->switchContext(); - DEBUG_OUT(DEBUG_LEVEL_CLI,("EXECUTESPJRS pSrvrStmt->switchContext() return with: %ld.", rc)); - if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO)) THREAD_RETURN(pSrvrStmt,rc); - - switch (pSrvrStmt->nowaitRetcode) - { - case 0: - retcode = 0; - break; - case 9999: - pSrvrStmt->isClosed = TRUE; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - default: - pSrvrStmt->isClosed = TRUE; - retcode = GETSQLCODE(pSrvrStmt); - break; - } - DEBUG_OUT(DEBUG_LEVEL_CLI, - ("EXECUTESPJRS : pSrvrStmt->nowaitRetcode=%ld, retcode=%s", - pSrvrStmt->nowaitRetcode, - CliDebugSqlError(retcode))); - } - else - { - pSrvrStmt->isClosed = TRUE; - pSrvrStmt->nowaitRetcode = rtn; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - } - } -#endif - - // Note this could do a return - HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt); - if (sqlWarning) THREAD_RETURN(pSrvrStmt,SQL_SUCCESS_WITH_INFO); THREAD_RETURN(pSrvrStmt,SQL_SUCCESS); } @@ -2201,21 +2027,7 @@ SQLRETURN ALLOCSQLMXHDLS(SRVR_STMT_HDL* pSrvrStmt) pStmt->identifier_len = 0; pStmt->identifier = NULL; } - - if (srvrGlobal->nowaitOn) - { -#if defined(TAG64) - tempStmtId=(int _ptr32*)malloc32(sizeof(int)); - pStmt->tag=(int)tempStmtId; - tempStmtIdMap[(long)tempStmtId]=pSrvrStmt; -#else - pStmt->tag = (long)pSrvrStmt; -#endif - } - else - { - pStmt->tag = 0; - } + pStmt->tag = 0; if (pModule->module_name == NULL) { retcode = CLI_AllocStmt(pStmt,(SQLSTMT_ID *)NULL); @@ -2304,16 +2116,6 @@ SQLRETURN ALLOCSQLMXHDLS(SRVR_STMT_HDL* pSrvrStmt) pSrvrStmt->outputDescName[pOutputDesc->identifier_len] = '\0'; } - if (srvrGlobal->nowaitOn) - { - retcode = CLI_AssocFileNumber(pStmt, srvrGlobal->nowaitFilenum); - if (retcode < 0) - { - CLI_ClearDiagnostics(NULL); - CLI_DEBUG_RETURN_SQL(retcode); - } - } - // Set the input and output Desc to be Wide Descriptors if (!pSrvrStmt->useDefaultDesc) { @@ -2399,19 +2201,7 @@ SQLRETURN ALLOCSQLMXHDLS_SPJRS(SRVR_STMT_HDL *pSrvrStmt, SQLSTMT_ID *callpStmt, DEBUG_OUT(DEBUG_LEVEL_STMT,("***pStmt->identifier_len=%ld", pStmt->identifier_len)); DEBUG_OUT(DEBUG_LEVEL_STMT,("***pStmt->identifier=%s", pStmt->identifier)); - if (srvrGlobal->nowaitOn) - { -#if defined(TAG64) - tempStmtId=(int _ptr32*)malloc32(sizeof(int)); - pStmt->tag=(int)tempStmtId; - tempStmtIdMap[(int)tempStmtId]=pSrvrStmt; - -#else - pStmt->tag = (long)pSrvrStmt; -#endif - } - else - pStmt->tag = 0; + pStmt->tag = 0; if (pModule->module_name == NULL) { DEBUG_OUT(DEBUG_LEVEL_STMT,("***pModule->module_name == NULL Call AllocStmtForRs()")); @@ -2467,16 +2257,6 @@ SQLRETURN ALLOCSQLMXHDLS_SPJRS(SRVR_STMT_HDL *pSrvrStmt, SQLSTMT_ID *callpStmt, } } - if (srvrGlobal->nowaitOn) - { - retcode = CLI_AssocFileNumber(pStmt, srvrGlobal->nowaitFilenum); - if (retcode < 0) - { - CLI_ClearDiagnostics(NULL); - CLI_DEBUG_RETURN_SQL(retcode); - } - } - // Set the output Desc to be Wide Descriptors if (pSrvrStmt->useDefaultDesc) { @@ -2548,57 +2328,11 @@ SQLRETURN EXECUTECALL(SRVR_STMT_HDL *pSrvrStmt) } DEBUG_ASSERT(pSrvrStmt->isClosed, ("Server Statement is Open before int.")); - pSrvrStmt->isClosed = FALSE; - retcode = CLI_Exec(pStmt, pDescValue, 0); DEBUG_OUT(DEBUG_LEVEL_STMT,("intCALL CLI_EXEC retcode: %ld.", retcode)); HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt); pSrvrStmt->isClosed = FALSE; -#ifndef DISABLE_NOWAIT - if (retcode == NOWAIT_PENDING){ - rtn = WaitForCompletion(pSrvrStmt, &pSrvrStmt->cond, &pSrvrStmt->mutex); - DEBUG_OUT(DEBUG_LEVEL_CLI,("WaitForCompletion() returned %d",rtn)); - - if (rtn == 0) - { - rc = pSrvrStmt->switchContext(); - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->switchContext() return with: %ld.", rc)); - if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO)) THREAD_RETURN(pSrvrStmt,rc); - - switch (pSrvrStmt->nowaitRetcode) - { - case 0: - retcode = 0; - break; - case 9999: - pSrvrStmt->isClosed = TRUE; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - default: - pSrvrStmt->isClosed = TRUE; - retcode = GETSQLCODE(pSrvrStmt); - break; - } - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->nowaitRetcode=%ld, retcode=%s", - pSrvrStmt->nowaitRetcode, - CliDebugSqlError(retcode))); - } - else - { - pSrvrStmt->isClosed = TRUE; - pSrvrStmt->nowaitRetcode = rtn; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - } - } - else -#endif - { - if (retcode!=SQL_SUCCESS) pSrvrStmt->isClosed = TRUE; - } - - // Note this could do a return - HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt); - pDesc = &pSrvrStmt->outputDesc; columnCount = pSrvrStmt->columnCount; @@ -2613,47 +2347,6 @@ SQLRETURN EXECUTECALL(SRVR_STMT_HDL *pSrvrStmt) retcode = CLI_Fetch(pStmt, pDescParam, 0); -#ifndef DISABLE_NOWAIT - if (retcode == NOWAIT_PENDING) { - rtn = WaitForCompletion(pSrvrStmt, &pSrvrStmt->cond, &pSrvrStmt->mutex); - DEBUG_OUT(DEBUG_LEVEL_CLI,("WaitForCompletion() returned %d",rtn)); - - if (rtn == 0) - { - rc = pSrvrStmt->switchContext(); - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->switchContext() return with: %ld.", rc)); - if ((rc != SQL_SUCCESS) && (rc != SQL_SUCCESS_WITH_INFO)) THREAD_RETURN(pSrvrStmt,rc); - - switch (pSrvrStmt->nowaitRetcode) - { - case 0: - retcode = 0; - break; - case 9999: - pSrvrStmt->isClosed = TRUE; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - default: - pSrvrStmt->isClosed = TRUE; - retcode = GETSQLCODE(pSrvrStmt); - break; - } - DEBUG_OUT(DEBUG_LEVEL_CLI,("pSrvrStmt->nowaitRetcode=%ld, retcode=%s", - pSrvrStmt->nowaitRetcode, - CliDebugSqlError(retcode))); - } - else - { - pSrvrStmt->isClosed = TRUE; - pSrvrStmt->nowaitRetcode = rtn; - THREAD_RETURN(pSrvrStmt,NOWAIT_ERROR); - } - } - else -#endif - { - if (retcode!=SQL_SUCCESS) pSrvrStmt->isClosed = TRUE; - } - // Return if the fetch failed HANDLE_THREAD_ERROR(retcode, sqlWarning, pSrvrStmt); diff --git a/core/conn/jdbc_type2/native/SrvrCommon.cpp b/core/conn/jdbc_type2/native/SrvrCommon.cpp index f463a0d..36b296a 100644 --- a/core/conn/jdbc_type2/native/SrvrCommon.cpp +++ b/core/conn/jdbc_type2/native/SrvrCommon.cpp @@ -231,34 +231,6 @@ int initSqlCore(int argc, char *argv[]) short error; int retcode = 0; -#ifndef DISABLE_NOWAIT - if (srvrGlobal->nowaitOn) - { - error = FILE_OPEN_(SQL_PSEUDO_FILE, // Filename - strlen(SQL_PSEUDO_FILE), // The length of file name Guardian does not understand C strings - &srvrGlobal->nowaitFilenum, // Return the file number (file descriptor) - , // Access - soecifies the desired access mode (default read-write) - , // Exclusion - specifies the desired mode (default shared) - 1); // Nowait-depth - number of outstanding I/O requests - retcode = error; - if (error != FEOK) - { - // TODO - Write to EMS log in future - srvrGlobal->nowaitOn = FALSE; - } - } - if (srvrGlobal->nowaitOn) - { - retcode = registerPseudoFileIO(srvrGlobal->nowaitFilenum); - if (retcode != TSLXE_SUCCESS) - { - // TODO - Write to EMS log in future - srvrGlobal->nowaitOn = FALSE; - } - - } -#endif - gDescItems[0].item_id = SQLDESC_TYPE; gDescItems[1].item_id = SQLDESC_OCTET_LENGTH; gDescItems[2].item_id = SQLDESC_PRECISION; diff --git a/core/conn/jdbc_type2/native/pThreadsSync.h b/core/conn/jdbc_type2/native/pThreadsSync.h index 9e4ec20..a6a8a44 100644 --- a/core/conn/jdbc_type2/native/pThreadsSync.h +++ b/core/conn/jdbc_type2/native/pThreadsSync.h @@ -34,15 +34,6 @@ #include <csrvrstmt.h> - -extern int registerPseudoFileIO(short fileNum); - -extern int initStmtForNowait(_TSLX_cond_t *cond, _TSLX_mutex_t *mutex); - -extern int WaitForCompletion(SRVR_STMT_HDL *pSrvrStmt, _TSLX_cond_t *cond, _TSLX_mutex_t *mutex); - - - extern int mutexCondDestroy(_TSLX_cond_t *cond, _TSLX_mutex_t *mutex); extern short abortTransaction (void); diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXConnection.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXConnection.java index 62739ef..35686fc 100644 --- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXConnection.java +++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXConnection.java @@ -1719,7 +1719,7 @@ private int mapTxnIsolation(int level) { || System.getProperty("cqdDoomUserTxn", "OFF") .equalsIgnoreCase("ON"); connectInit(server_, getDialogueId(), catalog_, schema_, - mploc_, isReadOnly_, autoCommit_, + isReadOnly_, autoCommit_, mapTxnIsolation(transactionIsolation_), loginTimeout_, queryTimeout_, blnCQD, statisticsIntervalTime_, statisticsLimitTime_, statisticsType_, programStatisticsEnabled_, statisticsSqlPlanEnabled_ @@ -1965,7 +1965,7 @@ private int mapTxnIsolation(int level) { try { if (connReuseBitMap_ != 0) { connectReuse(server_, getDialogueId(), connReuseBitMap_, - dsCatalog_, dsSchema_, mploc_, + dsCatalog_, dsSchema_, TRANSACTION_READ_COMMITTED); // Reset all connection attribute values catalog_ = dsCatalog_; @@ -2124,7 +2124,6 @@ private void initSetDefaults() throws SQLException { // catalog_ = T2Driver.catalog_; // schema_ = T2Driver.schema_; // locale_ = T2Driver.locale_; -// mploc_ = T2Driver.mploc_; // batchBindingSize_ = T2Driver.batchBindingSize_; // // connectionTimeout_ = 60; @@ -2351,13 +2350,13 @@ private native void setIsSpjRSFlag(long dialogueId, boolean isSpjrsOn); // private native void setReadOnly(String server, int dialogueId, boolean // readOnly); private native void connectInit(String server, long dialogueId, - String catalog, String schema, String mploc, boolean isReadOnly, boolean autoCommit, + String catalog, String schema, boolean isReadOnly, boolean autoCommit, int transactionIsolation, int loginTimeout, int queryTimeout, boolean blnDoomUsrTxn, int statisticsIntervalTime_, int statisticsLimitTime_, String statisticsType_, String programStatisticsEnabled_, String statisticsSqlPlanEnabled_) throws SQLException; private native void connectReuse(String server, long dialogueId, - int conResetValue, String catalog, String schema, String mploc, + int conResetValue, String catalog, String schema, int transactionIsolation) throws SQLException; private native long connect(String server, String uid, String pwd); @@ -2443,7 +2442,6 @@ public void initConnectionProps(T2Properties info) { else locale_ = Locale.getDefault(); } - mploc_ = info.getMploc(); batchBindingSize_ = info.getBatchBinding(); connectionTimeout_ = 60; loginTimeout_ = info.getLoginTimeout(); @@ -2559,7 +2557,6 @@ public static final int SQL_SET_TRANSACTION_FLAG = 0x0001; //ThreadLocal<Integer> txIDPerThread; Map<String, Class<?>> userMap_; Locale locale_; - String mploc_; ReferenceQueue<SQLMXStatement> refQ_; HashMap<WeakReference, Long> refToStmt_; boolean connectInitialized_; diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Driver.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Driver.java index 3f77c58..cf20ee1 100644 --- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Driver.java +++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Driver.java @@ -118,7 +118,6 @@ public class T2Driver extends T2Properties implements java.sql.Driver { // unique key is created // RFE: Batch update improvements key = getLanguage() + delimiter + getCatalog() + delimiter + getSchema() - + delimiter + getMploc() + delimiter + getSqlmx_nowait() + delimiter + getBatchBinding() + delimiter + getMaxPoolSize() + delimiter + getMinPoolSize() + delimiter + getMaxStatements() + delimiter + getTraceFlag() + delimiter @@ -288,7 +287,7 @@ public class T2Driver extends T2Properties implements java.sql.Driver { // Native methods static native int getPid(); - native static void SQLMXInitialize(String language, int nowaitOn); + native static void SQLMXInitialize(String language); native static void setDefaultEncoding(String encoding); @@ -367,7 +366,7 @@ public class T2Driver extends T2Properties implements java.sql.Driver { checkLibraryVersion(DriverInfo.driverVproc); // Initialize Java objects, methods references into gJNICache - SQLMXInitialize(locale_.getLanguage(), 1); + SQLMXInitialize(locale_.getLanguage()); // Get the major and minor database version numbers that // were setup in SQLMXInitialize() diff --git a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Properties.java b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Properties.java index ccc6a67..f2f08a6 100644 --- a/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Properties.java +++ b/core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/T2Properties.java @@ -43,9 +43,7 @@ public class T2Properties { private String catalog_; private String schema_; - private String mploc_; private int batchBindingSize_; - private int sql_nowait; private int traceFlag_; private String traceFile_; private int inlineLobChunkSize_; @@ -163,20 +161,6 @@ public class T2Properties { } /** - * @return the mploc_ - */ - public String getMploc() { - return mploc_; - } - - /** - * @param mploc_ the mploc_ to set - */ - public void setMploc(String mploc_) { - this.mploc_ = mploc_; - } - - /** * @return the batchBindingSize_ */ public int getBatchBinding() { @@ -216,31 +200,6 @@ public class T2Properties { } - - /** - * @return the sql_nowait - */ - public int getSqlmx_nowait() { - return sql_nowait; - } - - /** - * @param sql_nowait the sql_nowait to set - */ - public void setSqlmx_nowait(String nowaitFlag) { - if (nowaitFlag == null) - this.sql_nowait = 1; - else { - if (nowaitFlag.equalsIgnoreCase("off") || nowaitFlag.equals("0")) //when setSqlmx_nowait called with zero - this.sql_nowait = 0; - else if (nowaitFlag.equalsIgnoreCase("on_olt_off")|| nowaitFlag.equals("2")) - this.sql_nowait = 2; - else - this.sql_nowait = 1; - } -// this.sql_nowait = sql_nowait; - } - /** * @return the traceFlag_ */ @@ -983,8 +942,6 @@ public class T2Properties { setSchema(getProperty("schema")); setBatchBinding(getProperty("batchBinding")); setLanguage(getProperty("language")); - setMploc(getProperty("mploc")); - setSqlmx_nowait(getProperty("sql_nowait")); setSpjrs(getProperty("Spjrs")); setStmtatomicity(getProperty("stmtatomicity")); // setStmtatomicityval(getProperty("")); @@ -1030,10 +987,6 @@ public class T2Properties { props.setProperty("schema", schema_); props.setProperty("batchBinding", String.valueOf(batchBindingSize_)); - if (getMploc() != null) - props.setProperty("mploc", mploc_); - - props.setProperty("sql_nowait", String.valueOf(sql_nowait)); if (getSpjrs() != null) props.setProperty("Spjrs", Spjrs_); @@ -1103,11 +1056,6 @@ public class T2Properties { propertyInfo[i].description = "Specifies that statements are batched together in the executeBatch() operation."; propertyInfo[i++].choices = null; - propertyInfo[i] = new java.sql.DriverPropertyInfo("mploc", - mploc_); - propertyInfo[i].description = "Specifies the Guardian location in which SQL tables are created."; - propertyInfo[i++].choices = null; - propertyInfo[i] = new java.sql.DriverPropertyInfo( "maxPoolSize", Integer.toString(maxPoolSize_)); propertyInfo[i].description = "Sets the maximum number of physical connections that the pool can contain."; @@ -1238,7 +1186,6 @@ public class T2Properties { ref.add(new StringRefAddr("catalog", getCatalog())); ref.add(new StringRefAddr("schema", getSchema())); ref.add(new StringRefAddr("language", getLanguage())); - ref.add(new StringRefAddr("mploc", getMploc())); /* Description: Adding the reference to ISO88591 encoding */ ref.add(new StringRefAddr("ISO88591", getIso88591EncodingOverride())); ref.add(new StringRefAddr("batchBinding", Integer