Ejemplo n.º 1
0
static inline void* getSurface(JNIEnv* env, jobject view) {
  if (!env || !view) {
    return NULL;
  }

  if (!gSurfaceJavaGlue.initialized) {

    jclass surfaceViewClass = env->FindClass("android/view/SurfaceView");
    gSurfaceJavaGlue.getSurfaceHolder = env->GetMethodID(surfaceViewClass, "getHolder", "()Landroid/view/SurfaceHolder;");

    jclass surfaceHolderClass = env->FindClass("android/view/SurfaceHolder");
    gSurfaceJavaGlue.getSurface = env->GetMethodID(surfaceHolderClass, "getSurface", "()Landroid/view/Surface;");

    jclass surfaceClass = env->FindClass("android/view/Surface");
    gSurfaceJavaGlue.surfacePointer = env->GetFieldID(surfaceClass,
        "mSurfacePointer", "I");

    if (!gSurfaceJavaGlue.surfacePointer) {
      CLEAR_EXCEPTION(env);

      // It was something else in 2.2.
      gSurfaceJavaGlue.surfacePointer = env->GetFieldID(surfaceClass,
          "mSurface", "I");

      if (!gSurfaceJavaGlue.surfacePointer) {
        CLEAR_EXCEPTION(env);

        // And something else in 2.3+
        gSurfaceJavaGlue.surfacePointer = env->GetFieldID(surfaceClass,
            "mNativeSurface", "I");
        
        CLEAR_EXCEPTION(env);
      }
    }

    if (!gSurfaceJavaGlue.surfacePointer) {
      LOG("Failed to acquire surface pointer");
      return NULL;
    }

    env->DeleteLocalRef(surfaceClass);
    env->DeleteLocalRef(surfaceViewClass);
    env->DeleteLocalRef(surfaceHolderClass);

    gSurfaceJavaGlue.initialized = (gSurfaceJavaGlue.surfacePointer != NULL);
  }

  jobject holder = env->CallObjectMethod(view, gSurfaceJavaGlue.getSurfaceHolder);
  jobject surface = env->CallObjectMethod(holder, gSurfaceJavaGlue.getSurface);
  jint surfacePointer = env->GetIntField(surface, gSurfaceJavaGlue.surfacePointer);

  env->DeleteLocalRef(holder);
  env->DeleteLocalRef(surface);

  return (void*)surfacePointer;
}
Ejemplo n.º 2
0
void flush_input_on_error()
{
  flush_standard_input();
  fprintf(stderr,"#%%!& Error: %s: %s\n",theException,exception_details);
  fflush(stderr); 
  CLEAR_EXCEPTION();
}
Ejemplo n.º 3
0
/*
 * Synchronous method function prototype for
 * operation 'odbc_SQLSvc_GetSQLCatalogs'
 */
void odbc_SQLSvc_GetSQLCatalogs_sme_(
	/* In	*/ void * objtag_
  , /* In	*/ const CEE_handle_def *call_id_
  , /* Out   */ ExceptionStruct *exception_
  , /* In	*/ long dialogueId
  , /* In	*/ short APIType
  , /* In	*/ const char *catalogNm
  , /* In	*/ const char *schemaNm
  , /* In	*/ const char *tableNm
  , /* In	*/ const char *tableTypeList
  , /* In	*/ const char *columnNm
  , /* In	*/ long columnType
  , /* In	*/ long rowIdScope
  , /* In	*/ long nullable
  , /* In	*/ long uniqueness
  , /* In	*/ long accuracy
  , /* In	*/ short sqlType
  , /* In	*/ unsigned long metadataId
  , /* Out   */ char *catStmtLabel
  , /* Out   */ SQLItemDescList_def *outputDesc
  , /* Out   */ ERROR_DESC_LIST_def *sqlWarning
  , /* Out   */ long *rowsAffected
  , /* Out   */ SQLValueList_def *outputValueList
  , /* Out   */ long *stmtId
  , /* In    */ const char *fkcatalogNm
  , /* In    */ const char *fkschemaNm
  , /* In    */ const char *fktableNm)
{
	FUNCTION_ENTRY("odbc_SQLSvc_GetSQLCatalogs_sme_",(""));
	DEBUG_OUT(DEBUG_LEVEL_ENTRY,("  %#x, %#x, %#x, %#x, %d, %s, %s, %s, %s, %s, %ld, %ld, %ld, %ld, %ld, %d, %#x, %#x, %#x",
		objtag_,
		call_id_,
		exception_,
		dialogueId,
		APIType,
		catalogNm,
		schemaNm,
		tableNm,
		tableTypeList,
		columnNm,
		columnType,
		rowIdScope,
		nullable,
		uniqueness,
		accuracy,
		sqlType,
		catStmtLabel,
		outputDesc,
		sqlWarning));

	SRVRTRACE_ENTER(FILE_SME+14);

	enum CATAPI_TABLE_INDEX {
		COLUMNS = 0,
		DEFAULTS,
		INDEXES,
		KEYS,
		OBJECTS,
		OBJECTUID,
		TABLES,
		VIEWS,
		VIEWS_USAGE,
		VERSIONS
		};

	char *smdCatAPITablesList[] = {
		"COLUMNS",
		"DEFAULTS",
		"INDEXES",
		"KEYS",
		"OBJECTS",
		"OBJECTUID",
		"TABLES",
		"VIEWS",
		"VIEWS_USAGE",
		"VERSIONS"
	        };

	const char *inputParam[16];
	const char *tableParam[20];
	short retCode;
    char tmpBuf[20];
	char *odbcAppVersion = "3";
	char *translationId = "3";

	ExceptionStruct					prepareException;
	CLEAR_EXCEPTION(prepareException);

	ExceptionStruct					executeException;
	CLEAR_EXCEPTION(executeException);

	ExceptionStruct					fetchException;
	CLEAR_EXCEPTION(fetchException);

	ExceptionStruct					closeException;
	CLEAR_EXCEPTION(closeException);

	char expCatalogNm[MAX_ANSI_NAME_LEN+1];
	char expSchemaNm[MAX_ANSI_NAME_LEN+1];
	char expTableNm[MAX_ANSI_NAME_LEN+1];
	char expColumnNm[MAX_ANSI_NAME_LEN+1];
	char expProcNm[MAX_ANSI_NAME_LEN+1];

	char catalogNmNoEsc[MAX_ANSI_NAME_LEN+1];
	char schemaNmNoEsc[MAX_ANSI_NAME_LEN+1];
	char tableNmNoEsc[MAX_ANSI_NAME_LEN+1];
	char columnNmNoEsc[MAX_ANSI_NAME_LEN+1];
	char procNmNoEsc[MAX_ANSI_NAME_LEN+1];

	char tableName1[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];
	char tableName2[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];
	char tableName3[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];
	char tableName4[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];
	char tableName5[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];
	char tableName6[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];
	char tableName7[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];
	char tableName8[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];

	char SQLObjType[2];
	char inParam1[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];
	char inParam2[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3];
	char inParam3[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3]; // catalog len + '.' + schema len + '.' + table len +'\0'
	char inParam4[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3]; // catalog len + '.' + schema len + '.' + table len +'\0'

	char schemaVersion[10];					// Holds SQL schema version from SQL_SCHEMAVERSION_ANSI_Q1 module call
	char fkstmtLabel[MAX_STMT_LABEL_LEN+1];	// Used for FK methods
	long rowsMPFetched;					// # of tables to check for MP metadata
	long rowsFKFetched;					// # of rows fetched from foreign keys method query 1
	BOOL queryMP = FALSE;					// Flag whether to pull MP metadata

	SQLValueList_def tempOutputValueList;	// Intermediate and temp output value lists
	// Null out tempOutputValueList
	CLEAR_LIST(tempOutputValueList);

	long curRowNo  = 0;
	long numOfCols = 0;
	long curColNo  = 0;
	char schemaNmAct[MAX_ANSI_NAME_LEN+1];
	char tableNmAct[MAX_ANSI_NAME_LEN+1];
	char colNmAct[MAX_ANSI_NAME_LEN+1];
	char ordinalAct[10];
	char obuidAct[MAX_ANSI_NAME_LEN+1];
	char riuidAct[MAX_ANSI_NAME_LEN+1];

	short			sqlStmtType;
	SQLItemDescList_def lc_outputDesc;
	BOOL tableViewGiven = FALSE;
	BOOL systemTableGiven = FALSE;

	short namelen;

	SQLValue_def *SQLValue;
	char userCatalogNm[MAX_ANSI_NAME_LEN+1];
	char guardianNm[36]; // 8+1+8+1+8+1+8+1
	char inParam[MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+MAX_ANSI_NAME_LEN+3]; // catalog len + '.' + schema len + '.' + table len +'\0'

	char MapDataType[2] = "0";
	tmpBuf[0] = '\0';
	fkstmtLabel[0] = '\0';
	userCatalogNm[0] = '\0';

	char catStmtLabelNew[128]  = {'\0'};  // Trying to support max module name length
	
	inputParam[0] = srvrGlobal->SystemCatalog;
	if (catalogNm == NULL)
		strcpy(catalogNmNoEsc,"");
		//strcpy(catalogNmNoEsc,srvrGlobal->DefaultCatalog);		// There is an OR condition with the catalog so it can be ""
	else
		strcpy(catalogNmNoEsc, catalogNm);
	inputParam[1] = catalogNmNoEsc;
	if (schemaNm  == NULL )
		strcpy(schemaNmNoEsc,"%");
		
	else
		strcpy(schemaNmNoEsc, schemaNm);
	if (schemaNm  != NULL )
	{
		convertWildcardNoEsc(metadataId, FALSE, schemaNm, schemaNmNoEsc);
		convertWildcard(metadataId, TRUE, schemaNm, expSchemaNm);
	}
		inputParam[2] = schemaNmNoEsc;
		inputParam[3] = expSchemaNm;
	    inputParam[4] = NULL;

	sqlStmtType = TYPE_SELECT;

	DEBUG_OUT(DEBUG_LEVEL_METADATA,("SQL_SCHEMAVERSION_NEW_ANSI_Q1  tableParams= |%s|%s| inputParams= |%s|",
		tableParam[0],tableParam[1],
		inputParam[0]));

	if (APIType !=  SQL_TXN_ISOLATION)
	{
	retCode = executeAndFetchSMDQuery(objtag_, call_id_, dialogueId, APIType, "SQL_CATALOG_API",
							sqlStmtType, &tableParam[0], &inputParam[0], catalogNm, schemaNm,
							tableNm, columnNm, tableTypeList, metadataId, outputDesc, &executeException, &fetchException, sqlWarning,
							rowsAffected, outputValueList, stmtId);

	if (retCode != CEE_SUCCESS && writeServerException(retCode,exception_,&prepareException,&executeException,&fetchException) != TRUE)
	{
		odbc_SQLSvc_Close_sme_(objtag_, call_id_, &closeException, dialogueId, *stmtId,
							SQL_DROP, rowsAffected, sqlWarning);
		FUNCTION_RETURN_VOID(("executeAndFetchSMDQuery() and writeServerException() Failed"));
	}

	if (retCode == FETCH_EXCEPTION &&
		fetchException.exception_nr == odbc_SQLSvc_FetchN_SQLNoDataFound_exn_)
	{
		odbc_SQLSvc_Close_sme_(objtag_, call_id_, &closeException, dialogueId, *stmtId,
							SQL_DROP, rowsAffected, sqlWarning);
		FUNCTION_RETURN_VOID(("executeAndFetchSMDQuery() FETCH_EXCEPTION - SQLNoDataFound Expected"));
	}

	SQLValue = (SQLValue_def *)outputValueList->_buffer;
	if (SQLValue->dataInd == -1) //does not come here
	    {
			inputParam[0] = srvrGlobal->SystemCatalog;
			inputParam[2] = "SYSTEM_SCHEMA";

			memset(outputValueList, NULL, sizeof(SQLValueList_def));
			retCode = executeAndFetchSMDQuery(objtag_, call_id_, dialogueId, APIType, "SQL_SCHEMAVERSION_NEW_ANSI_Q1",
				sqlStmtType, &tableParam[0], &inputParam[0], catalogNm, schemaNm,
				tableNm, columnNm, tableTypeList, metadataId, outputDesc, &executeException, &fetchException, sqlWarning,
				rowsAffected, outputValueList, stmtId);

			if (retCode != CEE_SUCCESS && writeServerException(retCode,exception_,&prepareException,&executeException,&fetchException) != TRUE)
			{
				odbc_SQLSvc_Close_sme_(objtag_, call_id_, &closeException, dialogueId, *stmtId,
					SQL_DROP, rowsAffected, sqlWarning);
				FUNCTION_RETURN_VOID(("executeAndFetchSMDQuery() and writeServerException() Failed"));
			}

			if (retCode == FETCH_EXCEPTION &&
				fetchException.exception_nr == odbc_SQLSvc_FetchN_SQLNoDataFound_exn_)
			{
				odbc_SQLSvc_Close_sme_(objtag_, call_id_, &closeException, dialogueId, *stmtId,
					SQL_DROP, rowsAffected, sqlWarning);
				FUNCTION_RETURN_VOID(("executeAndFetchSMDQuery() and writeServerException() Failed"));
			}

			SQLValue = (SQLValue_def *)outputValueList->_buffer;

			if (SQLValue->dataInd == -1)
			{
			    exception_->exception_nr = odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_;
			    exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_INVALID_SCHEMA_VERSION;
			    FUNCTION_RETURN_VOID(("SQLValue->dataInd == -1"));
			}
	    }
	 }

	FUNCTION_RETURN_VOID((NULL));
}
JNIEXPORT void JNICALL Java_org_trafodion_jdbc_t2_SQLMXCallableStatement_prepareCall
(JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId,
 jint txid, jboolean autoCommit, jint txnMode, jstring stmtLabel, jstring sql,
 jint queryTimeout, jint holdability, jint fetchSize)
{
	FUNCTION_ENTRY("Java_org_trafodion_jdbc_t2_SQLMXCallableStatement_prepareCall",("... fetchSize=%ld",
		fetchSize));

	long					estimatedCost;
	long					inputParamOffset;
	ERROR_DESC_LIST_def			sqlWarning;
	SQLItemDescList_def			outputDesc;
	SQLItemDescList_def			inputDesc;
	jint						currentTxid = txid;
	jint						externalTxid = 0;
	jbyteArray					sqlByteArray;
	jboolean					isCopy;
	long						stmtId;
	jsize						len;
	SQLValue_def				sqlString;
	const char					*nSql = NULL;
	const char					*nStmtLabel = NULL;
	short						txn_status;

	ExceptionStruct exception_;
	CLEAR_EXCEPTION(exception_);

	sqlString.dataCharset = 0;
	sqlString.dataInd = 0;
	sqlString.dataType = SQLTYPECODE_VARCHAR;

	if (sql)
	{
		if ((sqlByteArray = (jbyteArray)jenv->CallObjectMethod(sql, gJNICache.getBytesMethodId))
			== NULL)
		{
			throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
			FUNCTION_RETURN_VOID(("CallObjectMethod() Failed"));
		}
		if ((nSql = (const char *)JNI_GetByteArrayElements(jenv,sqlByteArray, &isCopy)) == NULL)
		{
			throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
			FUNCTION_RETURN_VOID(("GetByteArrayElements() Failed"));
		}
		len = JNI_GetArrayLength(jenv,sqlByteArray);
		//Start Soln. No.: 10-091103-5969
		sqlString.dataValue._buffer = new unsigned char [len+1];
		memset(sqlString.dataValue._buffer,'\0',len+1);
		strncpy((char *)sqlString.dataValue._buffer,(const char *)nSql,len);
		//sqlString.dataValue._buffer = (unsigned char *)nSql;
		//End Soln. No.: 10-091103-5969
		sqlString.dataValue._length = len;
	}
	else
	{
		throwSQLException(jenv, INVALID_SQL_STRING_ERROR, NULL, "HY090");
		FUNCTION_RETURN_VOID(("SQL string is Null"));
	}

	if (stmtLabel)
		nStmtLabel = JNI_GetStringUTFChars(jenv,stmtLabel, NULL);
	else
	{
		throwSQLException(jenv, INVALID_STMT_LABEL_ERROR, NULL, "HY000");
		FUNCTION_RETURN_VOID(("stmtLabel is Null"));
	}

	if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1)) != 0)
	{
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwTransactionException(jenv, txn_status);
		FUNCTION_RETURN_VOID(("beginTxnControl() failed"));
	}

	odbc_SQLSvc_Prepare_sme_(NULL, NULL,
		&exception_,
		dialogueId,
		nStmtLabel,
		"",					// StmtExplainName
		EXTERNAL_STMT,
		&sqlString,
		holdability,
		TYPE_CALL,
		0,
		fetchSize,
		queryTimeout,
		&estimatedCost,
		&inputDesc,
		&outputDesc,
		&sqlWarning,
		&stmtId,
		&inputParamOffset,
		NULL, // MFC
		false);

	if (sql)
	{
		JNI_ReleaseByteArrayElements(jenv,sqlByteArray, (jbyte *)nSql, JNI_ABORT);
	}

	if (stmtLabel)
		JNI_ReleaseStringUTFChars(jenv,stmtLabel, nStmtLabel);

	if ((txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit, CEE_SUCCESS, FALSE, txnMode, externalTxid)) != 0)
	{
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwTransactionException(jenv, txn_status);
		FUNCTION_RETURN_VOID(("endTxnControl() Failed"));
	}

	switch (exception_.exception_nr)
	{
	case CEE_SUCCESS:
		outputDesc._length = 0;
		outputDesc._buffer = 0;
		setPrepareOutputs(jenv, jobj, &inputDesc, &outputDesc, currentTxid, stmtId, inputParamOffset);
		if (sqlWarning._length > 0)
			setSQLWarning(jenv, jobj, &sqlWarning);
		break;
	case odbc_SQLSvc_Prepare_SQLQueryCancelled_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, QUERY_CANCELLED_ERROR, NULL, "HY008",
			exception_.u.SQLQueryCancelled.sqlcode);
		break;
	case odbc_SQLSvc_Prepare_SQLError_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, &exception_.u.SQLError);
		break;
	case odbc_SQLSvc_Prepare_ParamError_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, PROGRAMMING_ERROR, exception_.u.ParamError.ParamDesc, "HY000");
		break;
	case odbc_SQLSvc_Prepare_SQLInvalidHandle_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, INVALID_HANDLE_ERROR, NULL, "HY000", exception_.u.SQLInvalidHandle.sqlcode);
		break;
	case odbc_SQLSvc_Prepare_InvalidConnection_exn_:
	case odbc_SQLSvc_Prepare_SQLStillExecuting_exn_:
	case odbc_SQLSvc_Prepare_TransactionError_exn_:
	default:
		// TFDS - These exceptions should not happen
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception_.exception_nr);
		break;
	}
	FUNCTION_RETURN_VOID((NULL));
}
JNIEXPORT void JNICALL Java_org_trafodion_jdbc_t2_SQLMXCallableStatement_cpqPrepareCall
(JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId,
 jint txid, jboolean autoCommit, jint txnMode,
 jstring moduleName, jint moduleVersion, jlong moduleTimestamp, jstring stmtName,
 jint queryTimeout, jint holdability, jint fetchSize)
{
	FUNCTION_ENTRY("Java_org_trafodion_jdbc_t2_SQLMXCallableStatement_cpqPrepareCall",("..."));

	long							estimatedCost;
	long							inputParamOffset;
	ERROR_DESC_LIST_def				sqlWarning;
	SQLItemDescList_def				outputDesc;
	SQLItemDescList_def				inputDesc;
	jint							currentTxid = txid;
	jint							externalTxid = 0;
	long							stmtId;
	const char						*nModuleName = NULL;
	const char						*nStmtName = NULL;
	short							txn_status;

	ExceptionStruct	exception_;
	CLEAR_EXCEPTION(exception_);

	if (moduleName)
		nModuleName = JNI_GetStringUTFChars(jenv,moduleName, NULL);
	else
	{
		throwSQLException(jenv, INVALID_MODULE_NAME_ERROR, NULL, "HY000");
		FUNCTION_RETURN_VOID(("moduleName is Null"));
	}

	if (stmtName)
		nStmtName = JNI_GetStringUTFChars(jenv,stmtName, NULL);
	else
	{
		throwSQLException(jenv, INVALID_STMT_LABEL_ERROR, NULL, "HY000");
		FUNCTION_RETURN_VOID(("stmtName is Null"));
	}

	if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1)) != 0)
	{
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwTransactionException(jenv, txn_status);
		FUNCTION_RETURN_VOID(("beginTxnControl() failed"));
	}

	odbc_SQLSvc_PrepareFromModule_sme_(NULL, NULL,
		&exception_,
		dialogueId,
		(char *)nModuleName,
		moduleVersion,
		moduleTimestamp,
		(char *)nStmtName,
		TYPE_CALL,
		fetchSize,
		0,
		0,
		&estimatedCost,
		&inputDesc,
		&outputDesc,
		&sqlWarning,
		&stmtId,
		&inputParamOffset);

	if (moduleName)
		JNI_ReleaseStringUTFChars(jenv,moduleName, nModuleName);

	if (stmtName)
		JNI_ReleaseStringUTFChars(jenv,stmtName, nStmtName);

	// Prepare, don't abort transaction even if there is an error, hence CEE_SUCCESS
	if ((txn_status = endTxnControl(jenv, currentTxid, txid,
		autoCommit, CEE_SUCCESS, FALSE, txnMode, externalTxid)) != 0)
	{
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwTransactionException(jenv, txn_status);
		FUNCTION_RETURN_VOID(("endTxnControl() Failed"));
	}

	switch (exception_.exception_nr)
	{
	case CEE_SUCCESS:
		outputDesc._length = 0;
		outputDesc._buffer = 0;
		setPrepareOutputs(jenv, jobj, &inputDesc, &outputDesc, currentTxid, stmtId, inputParamOffset);
		if (sqlWarning._length > 0)
			setSQLWarning(jenv, jobj, &sqlWarning);
		break;
	case odbc_SQLSvc_PrepareFromModule_SQLQueryCancelled_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, QUERY_CANCELLED_ERROR, NULL, "HY008",
			exception_.u.SQLQueryCancelled.sqlcode);
		break;
	case odbc_SQLSvc_PrepareFromModule_SQLError_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, &exception_.u.SQLError);
		break;
	case odbc_SQLSvc_PrepareFromModule_ParamError_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, MODULE_ERROR, exception_.u.ParamError.ParamDesc, "HY000");
		break;
	case odbc_SQLSvc_PrepareFromModule_SQLStillExecuting_exn_:
	case odbc_SQLSvc_PrepareFromModule_InvalidConnection_exn_:
	case odbc_SQLSvc_PrepareFromModule_TransactionError_exn_:
	default:
		// TFDS - These exceptions should not happen
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception_.exception_nr);
		break;
	}
	FUNCTION_RETURN_VOID((NULL));
}
//venu changed from int to long for 64 bit
JNIEXPORT void JNICALL Java_org_trafodion_jdbc_t2_SQLMXCallableStatement_executeCall
(JNIEnv *jenv, jobject jobj, jstring server, jlong dialogueId,
 jint txid, jboolean autoCommit, jint txnMode, jlong stmtId,
 jint paramCount, jobject paramValues, jint queryTimeout, jstring iso88591Encoding)
{
	FUNCTION_ENTRY("Java_org_trafodion_jdbc_t2_SQLMXCallableStatement_executeCall",("..."));

	SQLValueList_def				outputSqlValueList;
	ERROR_DESC_LIST_def				sqlWarning;
	jint							currentTxid = txid;
	jint							externalTxid = 0;
	short							returnResultSet;
	long							sqlcode;
	short							txn_status;

	SQLValueList_def				inputSqlValueList;
	CLEAR_LIST(inputSqlValueList);
	ExceptionStruct	exception_;
	CLEAR_EXCEPTION(exception_);

	SRVR_STMT_HDL	*pSrvrStmt;

	if ((pSrvrStmt = getSrvrStmt(dialogueId, stmtId, &sqlcode)) == NULL)
	{
		throwSQLException(jenv, INVALID_HANDLE_ERROR, NULL, "HY000", sqlcode);
		FUNCTION_RETURN_VOID(("getSrvrStmt() Failed"));
	}
	CLI_DEBUG_SHOW_SERVER_STATEMENT(pSrvrStmt);
	inputSqlValueList._buffer = NULL;
	inputSqlValueList._length = 0;

	if (fillInSQLValues(jenv, jobj, pSrvrStmt,
		0, 1, paramCount, paramValues, iso88591Encoding))
		FUNCTION_RETURN_VOID(("fillInSQLValues() Failed"));

	if ((txn_status = beginTxnControl(jenv, currentTxid, externalTxid, txnMode, -1)) != 0)
	{
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwTransactionException(jenv, txn_status);
		FUNCTION_RETURN_VOID(("beginTxnControl() failed"));
	}

	odbc_SQLSvc_ExecuteCall_sme_(NULL, NULL,
		&exception_,
		dialogueId,
		stmtId,
		&inputSqlValueList,
		FALSE,
		queryTimeout,
		&outputSqlValueList,
		&returnResultSet,
		&sqlWarning);

	if ((txn_status = endTxnControl(jenv, currentTxid, txid, autoCommit, exception_.exception_nr,
		pSrvrStmt->isSPJRS, txnMode, externalTxid)) != 0)
	{
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwTransactionException(jenv, txn_status);
		DEBUG_OUT(DEBUG_LEVEL_ENTRY,("endTxnControl() Failed"));
	}

	switch (exception_.exception_nr)
	{
	case CEE_SUCCESS:

		setExecuteCallOutputs(jenv, jobj, pSrvrStmt, returnResultSet, currentTxid);
		DEBUG_OUT(DEBUG_LEVEL_STMT,("RSMax: %d  RSIndex: %d  isSPJResultSet: %d",
			pSrvrStmt->RSMax, pSrvrStmt->RSIndex, pSrvrStmt->isSPJRS));

		if (sqlWarning._length > 0)
			setSQLWarning(jenv, jobj, &sqlWarning);
		break;
	case odbc_SQLSvc_ExecuteCall_SQLQueryCancelled_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, QUERY_CANCELLED_ERROR, NULL, "HY008",
			exception_.u.SQLQueryCancelled.sqlcode);
		break;
	case odbc_SQLSvc_ExecuteCall_SQLError_exn_:
	case odbc_SQLSvc_ExecuteCall_SQLRetryCompile_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, &exception_.u.SQLError);
		break;
	case odbc_SQLSvc_ExecuteCall_ParamError_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, PROGRAMMING_ERROR, exception_.u.ParamError.ParamDesc, "HY000");
		break;
	case odbc_SQLSvc_ExecuteCall_SQLInvalidHandle_exn_:
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, INVALID_HANDLE_ERROR, NULL, "HY000", exception_.u.SQLInvalidHandle.sqlcode);
		break;
	case odbc_SQLSvc_ExecuteCall_SQLStillExecuting_exn_:
	case odbc_SQLSvc_ExecuteCall_InvalidConnection_exn_:
	case odbc_SQLSvc_ExecuteCall_TransactionError_exn_:
	case odbc_SQLSvc_ExecuteCall_SQLNeedData_exn_:
	default:
		// TFDS - These exceptions should not happen
		jenv->CallVoidMethod(jobj, gJNICache.setCurrentTxidStmtMethodId, currentTxid);
		throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", exception_.exception_nr);
		break;
	}
	FUNCTION_RETURN_VOID((NULL));
}