You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by an...@apache.org on 2017/09/07 01:55:20 UTC
[26/30] incubator-trafodion git commit: TRAFODION-2731 CodeCleanup:
Remove obsolete, legacy and unused code
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/Context.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Context.cpp b/core/sql/cli/Context.cpp
index ac3d9d9..2af4264 100644
--- a/core/sql/cli/Context.cpp
+++ b/core/sql/cli/Context.cpp
@@ -73,9 +73,6 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#if defined( NA_SHADOWCALLS )
-#include "sqlclisp.h"
-#endif
#include "ComplexObject.h"
#include "CliMsgObj.h"
@@ -92,10 +89,8 @@
#include <sys/syscall.h>
#include <pwd.h>
-#ifdef NA_CMPDLL
#include "CmpCommon.h"
#include "arkcmp_proc.h"
-#endif
#include "ExRsInfo.h"
#include "../../dbsecurity/auth/inc/dbUserAuth.h"
@@ -105,7 +100,7 @@
// Printf-style tracing macros for the debug build. The macros are
// no-ops in the release build.
-#ifdef NA_DEBUG_C_RUNTIME
+#ifdef _DEBUG
#include <stdarg.h>
#define StmtListDebug0(s,f) StmtListPrintf((s),(f))
#define StmtListDebug1(s,f,a) StmtListPrintf((s),(f),(a))
@@ -122,20 +117,10 @@
#define StmtListDebug5(s,f,a,b,c,d,e)
#endif
+#include "dtm/tm.h"
- #include "dtm/tm.h"
-
-#ifdef NA_CMPDLL
#include "CmpContext.h"
-#endif // NA_CMPDLL
-// forward declarations
-
-static
-SQLSTMT_ID* getStatementId(plt_entry_struct * plte,
- char * start_stmt_name,
- SQLSTMT_ID * stmt_id,
- NAHeap *heap);
-
+
ContextCli::ContextCli(CliGlobals *cliGlobals)
// the context heap's parent is the basic executor memory
: cliGlobals_(cliGlobals),
@@ -496,997 +481,6 @@ static Int32 allocAndReadPos(ModuleOSFile &file,
return retcode;
}
-RETCODE ContextCli::addModule(const SQLMODULE_ID * module_id,
- NABoolean tsCheck,
- NABoolean unpackTDBs, char * moduleDir,
- NABoolean lookInGlobalModDir)
-{
- const char * module_name = module_id->module_name;
- Lng32 module_nm_len = getModNameLen(module_id);
-
- // use this Space for versioning
- Space vspc;
- //NAVersionedObject::setReallocator(&vspc);
-
- module_header_struct dm, *latestModHdr, modHdrCls;
-
- ModuleOSFile file;
- const Int32 max_modname_len = 1024;
- char m_name[max_modname_len];
- Lng32 m_name_len;
- Int32 error = 0;
- short isSystemModule = 0;
-
- // odbc spawns mxosrvr (an oss executable stored as a guardian file)
- // as an oss process. So,
- // we cannot assume moduleDir is always NULL for Guardian executables.
- // Nor can we avoid having to check the global dir if moduleDir is not
- // null. In the case of zmxosrvr, moduleDir is /G/vol/subvol and we
- // have to search /usr/tandem/sqlmx/USERMODULES before declaring 8809.
-
- // look for the module in moduleDir first.
- Lng32 retcode = ComRtGetModuleFileName
- (module_name, moduleDir, m_name, max_modname_len,
- NULL,
- NULL,
- &m_name_len, isSystemModule);
- if (retcode || m_name_len >= max_modname_len)
- {
- diagsArea_ << DgSqlCode(- CLI_NO_INSTALL_DIR)
- << DgInt0(retcode);
- return ERROR;
- }
- else if ((error = file.open(m_name)) == 4002 || error == 11) // not found
- {
- if ((!moduleDir) || // above try was for global dir
- (NOT lookInGlobalModDir)) // do not look for module in global
- // mod dir, if cannot find it in local
- {
- // there's no local module dir to try
- diagsArea_ << DgSqlCode(- CLI_MODULEFILE_OPEN_ERROR)
- << DgString0(m_name)
- << DgInt0(error);
- return ERROR;
- }
- else // above try was for a local dir
- {
- // now try the global dir
- retcode = ComRtGetModuleFileName
- (module_name, NULL, m_name, max_modname_len,
- NULL,
- NULL,
- &m_name_len, isSystemModule);
- if (retcode || m_name_len >= max_modname_len)
- {
- diagsArea_ << DgSqlCode(- CLI_NO_INSTALL_DIR)
- << DgInt0(retcode);
- return ERROR;
- }
- else if ((error = file.open(m_name)) != 0) // open failed
- {
- diagsArea_ << DgSqlCode(- CLI_MODULEFILE_OPEN_ERROR)
- << DgString0(m_name)
- << DgInt0(error);
- return ERROR;
- }
- }
- }
- else if (error != 0) // module file exists but open failed
- {
- diagsArea_ << DgSqlCode(- CLI_MODULEFILE_OPEN_ERROR)
- << DgString0(m_name)
- << DgInt0(error);
- return ERROR;
- }
-
- Module * module = new(exCollHeap())
- Module(module_name, module_nm_len, &m_name[0], m_name_len, exHeap());
-
- // read the module header
- short countRead = 0;
- if ((file.readpos((char *)&dm, 0, sizeof(module_header_struct), countRead))
- )
- {
- // an error during reading of module file or the file is shorter
- // than the module header.
- diagsArea_ << DgSqlCode(-CLI_MODULEFILE_CORRUPTED) << DgString0(m_name);
- return ERROR;
- }
-
- // give versioning a chance to massage/migrate it to this version
- latestModHdr = (module_header_struct*)dm.driveUnpack(&dm, &modHdrCls, &vspc);
- if (!latestModHdr) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MODULE_HDR_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
- module->setVersion((COM_VERSION)latestModHdr->getModuleVersion());
-
- const char * real_module_name = NULL;
- char real_module_name_buf[max_modname_len];
- if (module_name[0] == '/')
- {
- // module name is fully qualified, it contains the path before
- // the actual name.
- // Fine the real module name.
- Lng32 len = (Int32)strlen(module_name);
-
- // find the directory name.
- Lng32 i = len-1;
- NABoolean done = FALSE;
- NABoolean dQuoteSeen = FALSE;
- while ((i > 0) && (NOT done))
- {
- if (module_name[i] == '"')
- dQuoteSeen = NOT dQuoteSeen;
-
- if (NOT dQuoteSeen)
- {
- if (module_name[i] == '/')
- {
- done = TRUE;
- continue;
- }
- }
- i--;
- }
-
- i++;
-
- Int32 j = 0;
- while (i < len)
- real_module_name_buf[j++] = module_name[i++];
- real_module_name_buf[j] = 0;
-
- real_module_name = real_module_name_buf;
- }
- else
- real_module_name = module_name;
-
- Lng32 errCode = latestModHdr->RtduStructIsCorrupt();
- if (errCode ||
- (strncmp(latestModHdr->module_name, real_module_name, module_nm_len) != 0) ||
- ((tsCheck) &&
- (latestModHdr->prep_timestamp != module_id->creation_timestamp))
- )
- {
- // the module file is corrupted or has invalid data
- if (!errCode) errCode = -CLI_MODULEFILE_CORRUPTED;
- diagsArea_ << DgSqlCode(errCode) << DgString0(m_name);
- return ERROR;
- }
-
- plt_header_struct * plt = 0, *latestPLTHdr=0, pltHdrCls;
- plt_entry_struct * plte = 0, *latestPLTE, plteCls;
-
- dlt_header_struct * dlt = 0, *latestDLTHdr=0, dltHdrCls;
- dlt_entry_struct * dlte = 0, *latestDLTE, dlteCls;
-
- SQLMODULE_ID * local_module_id;
- SQLDESC_ID * desc_id;
- SQLSTMT_ID * stmt_id;
-
- Descriptor * descriptor = NULL;
- Statement * statement;
-
- char * source_area = 0;
- char * object_area = 0;
-
- char * schema_names_area = NULL;
-
- char * recomp_control_info_area = NULL;
-
- char * vproc_area = NULL;
-
- char * start_stmt_name = 0;
- char * start_desc_name = 0;
-
- local_module_id =
- (SQLMODULE_ID *)(exHeap()->allocateMemory(sizeof(SQLMODULE_ID)));
- init_SQLMODULE_ID(local_module_id);
-
- char * mn =
- (char *)(exHeap()->allocateMemory((size_t)(module_nm_len + 1)));
- str_cpy_all(mn, module_name, module_nm_len);
- mn[module_nm_len] = 0;
-
- local_module_id->module_name = mn;
- local_module_id->module_name_len = module_nm_len;
-
- stmt_id =
- (SQLSTMT_ID *)(exHeap()->allocateMemory(sizeof(SQLSTMT_ID)));
- init_SQLCLI_OBJ_ID(stmt_id);
-
- stmt_id->module = local_module_id;
- stmt_id->identifier = 0;
- stmt_id->handle = 0;
-
- desc_id =
- (SQLDESC_ID *)(exHeap()->allocateMemory(sizeof(SQLDESC_ID)));
- init_SQLCLI_OBJ_ID(desc_id);
-
- desc_id->module = local_module_id;
- desc_id->identifier = 0;
- desc_id->handle = 0;
-
- if (latestModHdr->source_area_length > 0)
- {
- if (allocAndReadPos(file, source_area,
- latestModHdr->source_area_offset,
- (Int32)latestModHdr->source_area_length,
- exHeap(), diagsArea_, m_name))
- return ERROR;
- }
-
- if (latestModHdr->schema_names_area_length > 0)
- {
- if (allocAndReadPos(file, schema_names_area,
- latestModHdr->schema_names_area_offset,
- latestModHdr->schema_names_area_length,
- exHeap(), diagsArea_, m_name))
- return ERROR;
- }
-
- if (latestModHdr->object_area_length > 0)
- {
- if (allocAndReadPos(file, object_area,
- latestModHdr->object_area_offset,
- latestModHdr->object_area_length,
- exHeap(), diagsArea_, m_name))
- return ERROR;
- }
-
- if (latestModHdr->recomp_control_area_length > 0)
- {
- if (allocAndReadPos(file, recomp_control_info_area,
- latestModHdr->recomp_control_area_offset,
- latestModHdr->recomp_control_area_length,
- exHeap(), diagsArea_, m_name))
- return ERROR;
- }
-
- if (latestModHdr->dlt_area_offset > 0)
- {
- if (allocAndReadPos(file, (char *&)dlt,
- latestModHdr->dlt_area_offset,
- latestModHdr->dlt_area_length,
- exHeap(), diagsArea_, m_name))
- return ERROR;
-
- // give versioning a chance to massage/migrate it to this version
- latestDLTHdr = (dlt_header_struct*)dlt->driveUnpack(dlt, &dltHdrCls, &vspc);
- if (!latestDLTHdr) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_DLT_HDR_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
- errCode = latestDLTHdr->RtduStructIsCorrupt();
- if (errCode)
- {
- exHeap()->deallocateMemory(dlt);
- exHeap()->deallocateMemory(local_module_id);
- exHeap()->deallocateMemory(stmt_id);
- exHeap()->deallocateMemory(desc_id);
- if (source_area)
- exHeap()->deallocateMemory(source_area);
- if (schema_names_area)
- exHeap()->deallocateMemory(schema_names_area);
- if (recomp_control_info_area)
- exHeap()->deallocateMemory(recomp_control_info_area);
- if (object_area)
- exHeap()->deallocateMemory(object_area);
-
- // the module file is corrupted or has invalid data
- diagsArea_ << DgSqlCode(errCode) << DgString0(m_name);
- return ERROR;
- }
-
- Lng32 num_descs = latestDLTHdr->num_descriptors;
- char * desc_area = 0;
-
- if (allocAndReadPos(file, desc_area,
- latestModHdr->descriptor_area_offset,
- latestModHdr->descriptor_area_length,
- exHeap(), diagsArea_, m_name))
- return ERROR;
-
- desc_id->name_mode = desc_name;
-
- start_desc_name = (((char *)(latestDLTHdr))
- + latestModHdr->dlt_hdr_length
- + (num_descs) * latestModHdr->dlt_entry_length);
-
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
- Int32 length;
-#else
- Lng32 length;
-#endif
- desc_header_struct *desc, *latestDescHdr, descHdrCls;
-
- for (Lng32 i = 0; i < num_descs; i++)
- {
- // get ith descriptor location table entry
- dlte = latestDLTHdr->getDLTEntry(i, latestModHdr->dlt_entry_length);
-
- // give versioning a chance to massage/migrate it to this version
- latestDLTE = (dlt_entry_struct*)dlte->driveUnpack(dlte, &dlteCls, &vspc);
- if (!latestDLTE) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_DLT_ENT_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
- str_cpy_all((char *)&length,
- start_desc_name + latestDLTE->descname_offset, 4);
-
- if (desc_id->identifier) {
- exHeap()->deallocateMemory((char*)desc_id->identifier);
- desc_id->identifier = 0;
- }
- char * id =
- (char *)(exHeap()->allocateMemory((size_t)(length + 1)));
- str_cpy_all(id,
- start_desc_name + latestDLTE->descname_offset + 4,
- length);
- id[length] = '\0';
- desc_id->identifier = id;
- desc_id->identifier_len = length;
-
- desc_id->handle = 0;
-
- allocateDesc(desc_id, 500);
-
- descriptor = getDescriptor(desc_id);
-
- // get descriptor header
- desc = (desc_header_struct *)(&desc_area[latestDLTE->descriptor_offset]);
-
- // give versioning a chance to massage/migrate it to this version
- latestDescHdr = (desc_header_struct*)
- desc->driveUnpack(desc, &descHdrCls, &vspc);
- if (!latestDescHdr) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_DESC_HDR_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
- descriptor->alloc(latestDescHdr->num_entries);
-
- desc_entry_struct *de, *latestDE, deCls;
- register Lng32 num_entries = latestDescHdr->num_entries;
- Lng32 rowsetSize = 0;
-
- for (register Lng32 j = 1; j <= num_entries; j++)
- {
- // get j-1th descriptor entry
- de = latestDescHdr->getDescEntry
- (j-1, latestModHdr->desc_entry_length);
-
- // give versioning a chance to massage/migrate it to this version
- latestDE = (desc_entry_struct*)de->driveUnpack(de, &deCls, &vspc);
- if (!latestDE) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_DESC_ENT_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
- if (latestDE->rowsetSize > 0)
- {
- if (rowsetSize == 0 || latestDE->rowsetSize < rowsetSize) {
- rowsetSize = latestDE->rowsetSize;
- descriptor->setDescItem(0, SQLDESC_ROWSET_SIZE,
- rowsetSize, 0);
- }
- descriptor->setDescItem(j, SQLDESC_ROWSET_VAR_LAYOUT_SIZE,
- latestDE->length, 0);
- }
-
- // This line of code is not necessary because internally
- // we record the FStype in the datatype field.
- // Besides, SQLDESC_TYPE and the FS datatype are not
- // compatible.
- // descriptor->setDescItem(j, SQLDESC_TYPE,
- // latestDE->datatype, 0);
-
- descriptor->setDescItem(j, SQLDESC_TYPE_FS,
- latestDE->datatype, 0);
- descriptor->setDescItem(j, SQLDESC_LENGTH,
- latestDE->length, 0);
- descriptor->setDescItem(j, SQLDESC_PRECISION,
- latestDE->precision, 0);
- descriptor->setDescItem(j, SQLDESC_SCALE,
- latestDE->scale, 0);
- descriptor->setDescItem(j, SQLDESC_NULLABLE,
- latestDE->nullable, 0);
-
- if (latestDE->datatype == REC_DATETIME)
- {
- descriptor->setDescItem(j, SQLDESC_DATETIME_CODE,
- latestDE->precision, 0);
-
- // SQLDESC_PRECISION is used to set fractional precision.
- // ANSI.
- descriptor->setDescItem(j, SQLDESC_PRECISION,
- latestDE->fractional_precision, 0);
-
- }
- else if ((latestDE->datatype >= REC_MIN_INTERVAL) &&
- (latestDE->datatype <= REC_MAX_INTERVAL))
- {
- descriptor->setDescItem(j, SQLDESC_INT_LEAD_PREC,
- latestDE->precision, 0);
-
- // SQLDESC_PRECISION is used to set fractional precision.
- // ANSI.
- descriptor->setDescItem(j, SQLDESC_PRECISION,
- latestDE->fractional_precision, 0);
- }
- // The SQLDESC_CHAR_SET_NAM has to be set for
- // charsets other than ISO88591 to work properly.
- else if ((latestDE->datatype >= REC_MIN_CHARACTER) &&
- (latestDE->datatype <= REC_MAX_CHARACTER))
- {
- CharInfo::CharSet cs = (CharInfo::CharSet)(latestDE->charset_offset);
-
- // the charset_offset field is not initialized to a valid
- // value in R1.8, it contains a value of 0(unknown).
- // Treat that value as ISO88591 in R2.
- if (((COM_VERSION) latestModHdr->getModuleVersion() ==
- COM_VERS_R1_8) &&
- (cs == CharInfo::UnknownCharSet))
- cs = CharInfo::ISO88591;
-
- descriptor->setDescItem(j, SQLDESC_CHAR_SET_NAM, 0,
- (char*)CharInfo::getCharSetName(cs));
-
-
- if ( CharInfo::maxBytesPerChar(cs) == SQL_DBCHAR_SIZE )
- descriptor->setDescItem(j, SQLDESC_LENGTH,
- (latestDE->length)/SQL_DBCHAR_SIZE, 0);
- }
-
- // For JDBC use. ordinal positon is not used, so we set to 0
- descriptor->setDescItem(j, SQLDESC_PARAMETER_INDEX, j, 0);
- if (latestDLTE->desc_type == dlt_entry_struct::INPUT_DESC_TYPE){
- descriptor->setDescItem(j, SQLDESC_PARAMETER_MODE, PARAMETER_MODE_IN, 0);
- descriptor->setDescItem(j, SQLDESC_ORDINAL_POSITION, 0, 0);
- }
- else{
- descriptor->setDescItem(j, SQLDESC_PARAMETER_MODE, PARAMETER_MODE_OUT, 0);
- descriptor->setDescItem(j, SQLDESC_ORDINAL_POSITION, 0, 0);
- }
-
-
-#if 0
-// what else is really there on disk?
-fprintf(stderr, "latestDescHdr->desc_entry[%d]\n", j);
-fprintf(stderr, " Int32 datatype = %d ;\n", latestDE->datatype);
-fprintf(stderr, " Int32 length = %d ;\n", latestDE->length);
-fprintf(stderr, " short nullable = %d ;\n", latestDE->nullable);
-fprintf(stderr, " Int32 charset_offset = %d ;\n", latestDE->charset_offset);
-fprintf(stderr, " Int32 coll_seq_offset = %d ;\n", latestDE->coll_seq_offset);
-fprintf(stderr, " Int32 scale = %d ;\n", latestDE->scale);
-fprintf(stderr, " Int32 precision = %d ;\n", latestDE->precision);
-fprintf(stderr, " Int32 fractional_precision = %d ;\n", latestDE->fractional_precision);
-fprintf(stderr, " Int32 output_name_offset = %d ;\n", latestDE->output_name_offset);
-fprintf(stderr, " short generated_output_name = %d ;\n", latestDE->generated_output_name);
-fprintf(stderr, " Int32 heading_offset = %d ;\n", latestDE->heading_offset);
-fprintf(stderr, " short string_format = %d ;\n", latestDE->string_format);
-fprintf(stderr, " Int32 var_ptr = %p ;\n", latestDE->var_ptr);
-fprintf(stderr, " Int32 var_data = %p ;\n", latestDE->var_data);
-fprintf(stderr, " Int32 ind_ptr = %p ;\n", latestDE->ind_ptr);
-fprintf(stderr, " Int32 ind_data = %d ;\n", latestDE->ind_data);
-fprintf(stderr, " Int32 datatype_ind = %d ;\n", latestDE->datatype_ind);
-fflush(stderr);
-// what may be at those offsets?
-if (latestDE->charset_offset > 0) {
-fprintf(stderr, " char * charset = %s ;\n",
- (char *)((char *)latestDescHdr + latestDE->charset_offset));
-fflush(stderr); }
-if (latestDE->coll_seq_offset > 0) {
-fprintf(stderr, " char * coll_seq = %s ;\n",
- (char *)((char *)latestDescHdr + latestDE->coll_seq_offset));
-fflush(stderr); }
-if (latestDE->output_name_offset > 0) {
-fprintf(stderr, " char * output_name = %s ;\n",
- (char *)((char *)latestDescHdr + latestDE->output_name_offset));
-fflush(stderr); }
-if (latestDE->heading_offset > 0) {
-fprintf(stderr, " char * heading = %s ;\n",
- (char *)((char *)latestDescHdr + latestDE->heading_offset));
-fflush(stderr); }
-
-#endif
-
- }
-
- } // for (i< numDesc), iterate on descriptors
- exHeap()->deallocateMemory(desc_area);
- } /* dlt area present */
-
- if (latestModHdr->plt_area_offset > 0)
- {
- if (allocAndReadPos(file, (char *&) plt,
- latestModHdr->plt_area_offset,
- latestModHdr->plt_area_length,
- exHeap(), diagsArea_, m_name))
- return ERROR;
-
- // give versioning a chance to massage/migrate it to this version
- latestPLTHdr = (plt_header_struct*)plt->driveUnpack(plt, &pltHdrCls, &vspc);
- if (!latestPLTHdr) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_PLT_HDR_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
- errCode = latestPLTHdr->RtduStructIsCorrupt();
- if (errCode)
- {
- exHeap()->deallocateMemory(plt);
- exHeap()->deallocateMemory(local_module_id);
- exHeap()->deallocateMemory(stmt_id);
- exHeap()->deallocateMemory(desc_id);
- if (dlt)
- exHeap()->deallocateMemory(dlt);
- if (source_area)
- exHeap()->deallocateMemory(source_area);
- if (schema_names_area)
- exHeap()->deallocateMemory(schema_names_area);
- if (object_area)
- exHeap()->deallocateMemory(object_area);
-
- // the module file is corrupted or has invalid data
- diagsArea_ << DgSqlCode(errCode) << DgString0(m_name);
- return ERROR;
- }
-
- if (latestPLTHdr->num_procedures >= 1)
- {
- Int32 num_procs = latestPLTHdr->num_procedures;
- module->setStatementCount( num_procs );
-
- start_stmt_name = (((char *)(latestPLTHdr))
- + latestModHdr->plt_hdr_length
- + (num_procs) * latestModHdr->plt_entry_length);
-
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
- Int32 length;
-#else
- Lng32 length;
-#endif
-
- for (Lng32 i = 0; i < num_procs; i++)
- {
- // get ith procedure location table entry
- plte = latestPLTHdr->getPLTEntry(i, latestModHdr->plt_entry_length);
-
- // give versioning a chance to massage/migrate it to this version
- latestPLTE = (plt_entry_struct*)plte->driveUnpack(plte, &plteCls, &vspc);
- if (!latestPLTE) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_PLT_ENT_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
- stmt_id = getStatementId(latestPLTE, start_stmt_name, stmt_id,
- exHeap());
-
- if (latestPLTE->curname_offset >= 0)
- {
- if (stmt_id->name_mode == stmt_name)
- {
- statement = getStatement(stmt_id);
- if (!statement)
- {
- allocateStmt(stmt_id, Statement::DYNAMIC_STMT);
- }
- }
-
- str_cpy_all((char *)&length,
- (start_stmt_name + latestPLTE->curname_offset),
- sizeof(length));
-
- char * curname =
- (char *)(exHeap()->allocateMemory((size_t)(length + 1)));
- str_cpy_all(curname,
- start_stmt_name + latestPLTE->curname_offset + 4,
- length);
- curname[length] = '\0';
-
- stmt_id->name_mode = cursor_name;
- allocateStmt(stmt_id, curname, Statement::STATIC_STMT, module);
-
- // now make stmt_id suitable to look up the new statement...
- const char * stmtname = stmt_id->identifier;
- stmt_id->identifier = curname;
- stmt_id->identifier_len = length;
- exHeap()->deallocateMemory((char*)stmtname);
- }
- else
- {
- SQLSTMT_ID * cloned_stmt = NULL;
- allocateStmt(stmt_id, Statement::STATIC_STMT, cloned_stmt, module);
- }
-
- statement = getStatement(stmt_id);
- // this flag indicates whether the statement is a holdable cursor.
- // This flag will be propagated to the leave operators, partition access
- // upon opening the statement - For pubsub holdable
- statement->setPubsubHoldable(diagsArea_, latestPLTE->holdable);
-
- // copy statement index from PLTE
- assert (latestPLTE->statementIndex < module->getStatementCount());
- statement->setStatementIndex(latestPLTE->statementIndex);
-
- if (latestPLTE->source_offset >= 0)
- {
- statement->copyInSourceStr(source_area + latestPLTE->source_offset,
- latestPLTE->source_length);
- }
-
- if (latestPLTE->schema_name_offset >= 0)
- {
- statement->copySchemaName(schema_names_area + latestPLTE->schema_name_offset,
- latestPLTE->schema_name_length);
- }
-
- if (latestPLTE->gen_object_offset >= 0)
- {
- statement->copyGenCode(object_area + latestPLTE->gen_object_offset,
- latestPLTE->gen_object_length,
- unpackTDBs);
- }
- else
- {
-#pragma nowarn(1506) // warning elimination
- statement->setRecompWarn(latestPLTE->recompWarn());
-#pragma warn(1506) // warning elimination
- }
-if (latestPLTE->recomp_control_info_offset >= 0)
- {
- statement->copyRecompControlInfo(recomp_control_info_area,
- recomp_control_info_area +
- latestPLTE->recomp_control_info_offset,
- latestPLTE->recomp_control_info_length);
- }
-
-#pragma nowarn(1506) // warning elimination
- statement->setNametypeNsk(latestPLTE->nametypeNsk());
-#pragma warn(1506) // warning elimination
-
-#pragma nowarn(1506) // warning elimination
- statement->setOdbcProcess(latestPLTE->odbcProcess());
- statement->setSystemModuleStmt(isSystemModule);
-#pragma warn(1506) // warning elimination
- } /* for , iterate on statements */
-
- }
- } /* plt area present */
-
-
- if (latestModHdr->vproc_area_length > 0)
- {
- if (allocAndReadPos(file, vproc_area,
- latestModHdr->vproc_area_offset,
- (Int32)latestModHdr->vproc_area_length,
- exHeap(), diagsArea_, m_name))
- return ERROR;
-
- module->setVproc(vproc_area);
- }
-
- if (latestDLTHdr)
- {
- for (Lng32 i = 0; i < latestDLTHdr->num_descriptors; i++)
- {
- // get ith descriptor location table entry
- dlte = latestDLTHdr->getDLTEntry(i, latestModHdr->dlt_entry_length);
-
- // give versioning a chance to massage/migrate it to this version
- latestDLTE = (dlt_entry_struct*)dlte->driveUnpack(dlte, &dlteCls, &vspc);
- if (!latestDLTE) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_DLT_ENT_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
- if (latestDLTE->stmtname_offset >= 0)
- {
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
- Int32 length;
-#else
- Lng32 length;
-#endif
-
- str_cpy_all((char *)&length,
- start_desc_name + latestDLTE->stmtname_offset, 4);
-
- if (stmt_id->identifier) {
- exHeap()->deallocateMemory((char*)stmt_id->identifier);
- stmt_id->identifier = 0;
- }
- char * id =
- (char *)(exHeap()->allocateMemory((size_t)(length + 1)));
- str_cpy_all(id,
- start_desc_name + latestDLTE->stmtname_offset + 4 ,
- length);
- id[length] = '\0';
-
- stmt_id->identifier = id;
- stmt_id->identifier_len = length;
-
- stmt_id->handle = 0;
-
- statement = getStatement(stmt_id);
-
- if (statement)
- {
- enum SQLWHAT_DESC descType;
- if (latestDLTE->desc_type == dlt_entry_struct::INPUT_DESC_TYPE)
- descType = SQLWHAT_INPUT_DESC;
- else
- descType = SQLWHAT_OUTPUT_DESC;
- statement->addDefaultDesc(descriptor, descType);
- } // if(statement)
- }
- }
- }
-
- if (latestPLTHdr)
- {
- for (Lng32 i = 0; i < latestPLTHdr->num_procedures; i++)
- {
- // get ith procedure location table entry
- plte = latestPLTHdr->getPLTEntry(i, latestModHdr->plt_entry_length);
-
- // give versioning a chance to massage/migrate it to this version
- latestPLTE = (plt_entry_struct*)plte->driveUnpack(plte, &plteCls, &vspc);
- if (!latestPLTE) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_PLT_ENT_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
- stmt_id = getStatementId(latestPLTE, start_stmt_name, stmt_id,
- exHeap());
- if (stmt_id &&
- (latestPLTE->curname_offset >= 0) &&
- (stmt_id->name_mode == stmt_name))
- {
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
- Int32 length;
-#else
- Lng32 length;
-#endif
-
- str_cpy_all((char *)&length,
- (start_stmt_name + latestPLTE->curname_offset), 4);
- char * curname =
- (char *)(exHeap()->allocateMemory((size_t)(length + 1)));
- str_cpy_all(curname,
- start_stmt_name + latestPLTE->curname_offset + 4,
- length);
- curname[length] = '\0';
-#if 0
- fprintf(stderr, "Looking for special cursor '%s' for statement %s\n",
- curname,
- stmt_id->identifier);
-#endif
- if (stmt_id->identifier)
- {
- exHeap()->deallocateMemory((char *)stmt_id->identifier);
- stmt_id->identifier = 0;
- }
- stmt_id->identifier = curname;
- stmt_id->identifier_len = length;
-
- stmt_id->name_mode = cursor_name;
- }
- statement = getStatement(stmt_id);
-#if 0
- if (!statement)
- {
- fprintf(stderr, "Could not find ");
- if (stmt_id->name_mode == cursor_name)
- {
- fprintf(stderr, "CURSOR %s\n", stmt_id->identifier);
- }
- else
- {
- fprintf(stderr, "STATEMENT %s\n", stmt_id->identifier);
- }
- }
-#endif
-
- if (latestPLTE->input_desc_entry >= 0)
- {
- // get input descriptor entry
- dlte = latestDLTHdr->getDLTEntry
- (latestPLTE->input_desc_entry, latestModHdr->dlt_entry_length);
-
- // give versioning a chance to massage/migrate it to this version
- latestDLTE = (dlt_entry_struct*)dlte->driveUnpack(dlte, &dlteCls, &vspc);
- if (!latestDLTE) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_DLT_ENT_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
- Int32 length;
-#else
- Lng32 length;
-#endif
-
- str_cpy_all((char *)&length,
- (start_desc_name + latestDLTE->descname_offset), 4);
-
- if (desc_id->identifier) {
- exHeap()->deallocateMemory((char *)desc_id->identifier);
- desc_id->identifier = 0;
- }
- char * id =
- (char *)(exHeap()->allocateMemory((size_t)(length + 1)));
- str_cpy_all(id, start_desc_name + latestDLTE->descname_offset + 4, length);
- id[length] = '\0';
- desc_id->identifier = id;
- desc_id->identifier_len = length;
-
- descriptor = getDescriptor(desc_id);
-
- statement->addDefaultDesc(descriptor, SQLWHAT_INPUT_DESC);
-
- // select desc info and move them into desc
- if (unpackTDBs)
- {
- // the static Call desc is "wide" by default,
- // in the future, we may choose to store flags in the
- // desc_struct to represent the "wide"/"narrow" mode.
- // or have a dynamic runtime flag to control the mode.
- if (statement->getRootTdb() &&
- statement->getRootTdb()->hasCallStmtExpressions())
- descriptor->setDescTypeWide(TRUE);
-
- RETCODE retCode =
- statement->addDescInfoIntoStaticDesc(descriptor,
- SQLWHAT_INPUT_DESC,
- diags());
- ex_assert(retCode>=0, "failed to add desc info.");
- }
- }
-
- if (latestPLTE->output_desc_entry >= 0)
- {
- // get output descriptor entry
- dlte = latestDLTHdr->getDLTEntry
- (latestPLTE->output_desc_entry, latestModHdr->dlt_entry_length);
-
- // give versioning a chance to massage/migrate it to this version
- latestDLTE = (dlt_entry_struct*)dlte->driveUnpack(dlte, &dlteCls, &vspc);
- if (!latestDLTE) {
- // error: version is no longer supported
- diagsArea_ << DgSqlCode(-CLI_MOD_DLT_ENT_VERSION_ERROR)
- << DgString0(m_name);
- return ERROR;
- }
-
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
- Int32 length;
-#else
- Lng32 length;
-#endif
-
- str_cpy_all((char *)&length,
- (start_desc_name+ latestDLTE->descname_offset), 4);
-
- if (desc_id->identifier) {
- exHeap()->deallocateMemory((char *)desc_id->identifier);
- desc_id->identifier = 0;
- }
- char * id =
- (char *)(exHeap()->allocateMemory((size_t)(length + 1)));
- str_cpy_all(id,
- start_desc_name + latestDLTE->descname_offset + 4,
- length);
- id[length] = '\0';
- desc_id->identifier =id;
- desc_id->identifier_len = length;
-
- descriptor = getDescriptor(desc_id);
- statement->addDefaultDesc(descriptor, SQLWHAT_OUTPUT_DESC);
-
- if (unpackTDBs)
- {
- if (statement->getRootTdb() &&
- statement->getRootTdb()->hasCallStmtExpressions())
- descriptor->setDescTypeWide(TRUE);
-
- RETCODE retCode =
- statement->addDescInfoIntoStaticDesc(descriptor,
- SQLWHAT_OUTPUT_DESC,
- diags());
- ex_assert(retCode>=0, "failed to add desc info");
- }
-
- }
- } // for loop
- }
-
- if (dlt) {
- exHeap()->deallocateMemory(dlt);
- dlt = 0;
- }
-
- if (plt) {
- exHeap()->deallocateMemory(plt);
- plt = 0;
- }
-
- if (source_area) {
- exHeap()->deallocateMemory(source_area);
- source_area = 0;
- }
-
- if (schema_names_area) {
- exHeap()->deallocateMemory(schema_names_area);
- schema_names_area = 0;
- }
-
- if (recomp_control_info_area) {
- exHeap()->deallocateMemory(recomp_control_info_area);
- recomp_control_info_area = 0;
- }
-
- if (object_area) {
- exHeap()->deallocateMemory(object_area);
- object_area = 0;
- }
-
- if (stmt_id->identifier) {
- exHeap()->deallocateMemory((char *)stmt_id->identifier);
- stmt_id->identifier = 0;
- }
- exHeap()->deallocateMemory(stmt_id);
- stmt_id = 0;
-
- if (desc_id->identifier) {
- exHeap()->deallocateMemory((char *)desc_id->identifier);
- desc_id->identifier = 0;
- }
- exHeap()->deallocateMemory(desc_id);
- desc_id = 0;
-
- if (local_module_id->module_name) {
- exHeap()->deallocateMemory((char *)local_module_id->module_name);
- local_module_id->module_name = 0;
- }
- exHeap()->deallocateMemory(local_module_id);
- local_module_id = 0;
-
- moduleList()->insert(module_name, module_nm_len, (void *)module);
-
- return SUCCESS;
-}
-
RETCODE ContextCli::allocateDesc(SQLDESC_ID * descriptor_id, Lng32 max_entries)
{
const char * hashData;
@@ -1521,115 +515,6 @@ RETCODE ContextCli::allocateDesc(SQLDESC_ID * descriptor_id, Lng32 max_entries)
return SUCCESS;
}
-RETCODE ContextCli::dropModule(const SQLMODULE_ID * module_id)
-{
- const char * module_name = module_id->module_name;
- Lng32 module_nm_len = getModNameLen(module_id);
-
- Module * module;
- moduleList()->position(module_name, module_nm_len);
- NABoolean found = FALSE;
- while ((NOT found) &&
- (module = (Module *)moduleList()->getNext()))
- {
- if ((module_nm_len == module->getModuleNameLen()) &&
- (str_cmp(module_id->module_name,
- module->getModuleName(),
- module_nm_len) == 0) )
- found = TRUE; // found
- }
-
- if (NOT found)
- {
- // caller should have validated that module has been added.
- return ERROR;
- }
-
- NABoolean done = FALSE;
- while (NOT done)
- {
- Statement * statement;
- NABoolean found = FALSE;
- statementList_->position();
- while ((NOT found) &&
- (statement = (Statement *)statementList_->getNext()))
- {
- if ((statement->getModule()) &&
- (statement->getModule() == module) &&
- (statement->getStmtId()))
- {
- found = TRUE;
- }
- } // while
-
- if (found)
- {
- // Should we ignore errors from deallocStmt?? TBD.
- if (deallocStmt(statement->getStmtId(), TRUE))
- return ERROR;
- }
- else
- done = TRUE;
- } // while not done
-
- done = FALSE;
- while (NOT done)
- {
- Descriptor *desc;
- NABoolean found = FALSE;
- descriptorList()->position();
- while ((NOT found) &&
- (desc = (Descriptor *)descriptorList()->getNext()))
- {
- if ((desc->getModuleId()) &&
- (desc->getModuleId()->module_name) &&
- (strcmp(desc->getModuleId()->module_name, module_name) == 0))
- {
- found = TRUE;
- }
- } // while
-
- if (found)
- {
- // Should we ignore errors from deallocDesc?? TBD.
- if (deallocDesc(desc->getDescName(), TRUE))
- return ERROR;
- }
- else
- done = TRUE;
- } // while not done
-
- moduleList()->remove(module);
-
- delete module;
-
- return SUCCESS;
-}
-
-Module * ContextCli::getModule(const SQLMODULE_ID * module_id)
-{
- const char * module_name = module_id->module_name;
- Lng32 module_nm_len = getModNameLen(module_id);
-
- Module * module;
- moduleList()->position(module_name, module_nm_len);
- NABoolean found = FALSE;
- while ((NOT found) &&
- (module = (Module *)moduleList()->getNext()))
- {
- if ((module_nm_len == module->getModuleNameLen()) &&
- (str_cmp(module_id->module_name,
- module->getModuleName(),
- module_nm_len) == 0) )
- found = TRUE; // found
- }
-
- if (found)
- return module;
- else
- return NULL;
-}
-
RETCODE ContextCli::deallocDesc(SQLDESC_ID * desc_id,
NABoolean deallocStaticDesc)
{
@@ -1733,9 +618,6 @@ Descriptor *ContextCli::getDescriptor(SQLDESC_ID * descriptor_id)
{
case desc_handle:
if (descriptor_id->handle == descriptor->getDescHandle()) {
-#if defined( NA_SHADOWCALLS )
- SqlCliSp_StoreDescriptor(descriptor_id, (void *)descriptor);
-#endif
return descriptor;
}
break;
@@ -1760,9 +642,6 @@ Descriptor *ContextCli::getDescriptor(SQLDESC_ID * descriptor_id)
exHeap()->deallocateMemory(desc1);
desc1 = 0;
}
-#if defined( NA_SHADOWCALLS )
- SqlCliSp_StoreDescriptor(descriptor_id, (void *)descriptor); //shadow
-#endif
return descriptor;
}
break;
@@ -2000,62 +879,9 @@ Statement *ContextCli::getStatement(SQLSTMT_ID * statement_id, HashQueue * stmtL
return 0;
}
-static
-SQLSTMT_ID * getStatementId(plt_entry_struct * plte,
- char * start_stmt_name,
- SQLSTMT_ID * stmt_id,
- NAHeap *heap)
-{
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
- Int32 length;
-#else
- Lng32 length;
-#endif
-
- if (plte->stmtname_offset >= 0)
- {
- stmt_id->name_mode = stmt_name;
- str_cpy_all((char *)&length, (start_stmt_name + plte->stmtname_offset), 4);
-
- if (stmt_id->identifier) {
- heap->deallocateMemory((char *)stmt_id->identifier);
- stmt_id->identifier = 0;
- }
- char * id =
- (char *)(heap->allocateMemory((size_t)(length + 1)));
-
- str_cpy_all(id, start_stmt_name + plte->stmtname_offset + 4, length);
- id[length] = '\0';
- stmt_id->identifier = id;
- stmt_id -> identifier_len = length;
- }
- else if (plte->curname_offset >= 0)
- {
- stmt_id->name_mode = cursor_name;
-
- str_cpy_all((char *)&length, (start_stmt_name + plte->curname_offset), 4);
-
- if (stmt_id->identifier) {
- heap->deallocateMemory((char *)stmt_id->identifier);
- stmt_id->identifier = 0;
- }
- char * id =
- (char *)(heap->allocateMemory((size_t)(length + 1)));
- str_cpy_all(id, start_stmt_name + plte->curname_offset + 4, length);
- id[length] = '\0';
- stmt_id->identifier = id;
- stmt_id -> identifier_len = length;
- }
-
- return stmt_id;
-}
-
-
RETCODE ContextCli::allocateStmt(SQLSTMT_ID * statement_id,
Statement::StatementType stmt_type,
- SQLSTMT_ID * cloned_from_stmt_id,
- Module *module)
+ SQLSTMT_ID * cloned_from_stmt_id)
{
const char * hashData = NULL;
ULng32 hashDataLength = 0;
@@ -2101,7 +927,7 @@ RETCODE ContextCli::allocateStmt(SQLSTMT_ID * statement_id,
}
Statement * statement =
- new(exCollHeap()) Statement(statement_id, cliGlobals_, stmt_type, NULL, module);
+ new(exCollHeap()) Statement(statement_id, cliGlobals_, stmt_type, NULL, NULL);
if (cloned_from_stmt)
statement->bindTo(cloned_from_stmt);
@@ -2128,56 +954,11 @@ RETCODE ContextCli::allocateStmt(SQLSTMT_ID * statement_id,
return SUCCESS;
}
-
-// private internal method - only called from ContextCli::addModule()
-RETCODE ContextCli::allocateStmt(SQLSTMT_ID * statement_id,
- char * cn,
- Statement::StatementType stmt_type,
- Module *module)
-{
- char * hashData = NULL;
- ULng32 hashDataLength = 0;
-
- if (statement_id->name_mode != cursor_name)
- {
- diagsArea_ << DgSqlCode(-CLI_INTERNAL_ERROR);
- return ERROR;
- }
-
- // find if this cursor already exists & return error, if it does...
- const char * sn = statement_id->identifier; // save the statement name
- statement_id->identifier = cn; // do the lookup with cursor name
- if (getStatement(statement_id))
- {
- statement_id->identifier = sn; // restore the statement name
- diagsArea_ << DgSqlCode(- CLI_DUPLICATE_STMT);
- return ERROR;
- }
-
- statement_id->identifier = sn; // restore the statement name
-
- Statement * statement =
- new(exCollHeap()) Statement(statement_id, cliGlobals_, stmt_type, cn, module);
-
- hashData = cn;
- hashDataLength = strlen(hashData);
-
- StmtListDebug1(statement, "Adding %p to statementList_", statement);
-
- semaphoreLock();
- statementList()->insert(hashData, hashDataLength, (void *) statement);
- if (processStats_!= NULL)
- processStats_->incStmtCount(stmt_type);
- semaphoreRelease();
-
- return SUCCESS;
-}
-
RETCODE ContextCli::deallocStmt(SQLSTMT_ID * statement_id,
NABoolean deallocStaticStmt)
{
// for now, dump memory info before deleting the statement
-#if defined(_DEBUG) && !defined(__EID) && !defined(NA_NSK)
+#if defined(_DEBUG)
char * filename = getenv("MEMDUMP");
if (filename) {
// open output file sytream.
@@ -3028,7 +1809,7 @@ NABoolean ContextCli::reclaimStatements()
return FALSE;
-#if defined(_DEBUG) && !defined(__EID)
+#if defined(_DEBUG)
char *reclaimAfter = NULL;
Lng32 reclaimIf = (reclaimAfter == NULL)? 0: atol(reclaimAfter);
@@ -3159,7 +1940,7 @@ void ContextCli::removeFromCloseStatementList(Statement * statement,
statement);
}
-#if defined(_DEBUG) && !defined(__EID) && !defined(NA_NSK)
+#if defined(_DEBUG)
void ContextCli::dumpStatementInfo()
{
@@ -3645,7 +2426,7 @@ RETCODE ContextCli::cleanupChildStmt(Statement *child)
} // ContextCLI::cleanupChildStmt()
-#ifdef NA_DEBUG_C_RUNTIME
+#ifdef _DEBUG
void ContextCli::StmtListPrintf(const Statement *s,
const char *formatString, ...) const
{
@@ -3943,7 +2724,6 @@ void ContextCli::endMxcmpSession(NABoolean cleanupEsps,
if (clearCmpCache)
flags |= CmpMessageEndSession::CLEAR_CACHE;
-#ifdef NA_CMPDLL
Int32 cmpStatus = 2; // assume failure
if (getSessionDefaults()->callEmbeddedArkcmp() &&
isEmbeddedArkcmpInitialized() &&
@@ -3979,29 +2759,26 @@ void ContextCli::endMxcmpSession(NABoolean cleanupEsps,
(cmpStatus != 0 || (CmpCommon::context()->getRecursionLevel() > 0) ||
getArkcmp()->getServer())))
{
-#endif // NA_CMPDLL
- // send request to mxcmp so it can cleanup esps started by it
- // and reset nonResetable attributes.
- // Ignore errors.
- if (getNumArkcmps() > 0)
- {
- short indexIntoCompilerArray = getIndexToCompilerArray();
- ExSqlComp::ReturnStatus status =
- cliGlobals_->getArkcmp(indexIntoCompilerArray)->sendRequest
- (EXSQLCOMP::END_SESSION, (char*)&flags, sizeof(Lng32));
-
- if (status == ExSqlComp::SUCCESS)
+ // send request to mxcmp so it can cleanup esps started by it
+ // and reset nonResetable attributes.
+ // Ignore errors.
+ if (getNumArkcmps() > 0)
{
- status =
- cliGlobals_->getArkcmp(indexIntoCompilerArray)->getReply(
- dummyReply, dummyLength);
- cliGlobals_->getArkcmp(indexIntoCompilerArray)->
- getHeap()->deallocateMemory((void*)dummyReply);
+ short indexIntoCompilerArray = getIndexToCompilerArray();
+ ExSqlComp::ReturnStatus status =
+ cliGlobals_->getArkcmp(indexIntoCompilerArray)->sendRequest
+ (EXSQLCOMP::END_SESSION, (char*)&flags, sizeof(Lng32));
+
+ if (status == ExSqlComp::SUCCESS)
+ {
+ status =
+ cliGlobals_->getArkcmp(indexIntoCompilerArray)->getReply(
+ dummyReply, dummyLength);
+ cliGlobals_->getArkcmp(indexIntoCompilerArray)->
+ getHeap()->deallocateMemory((void*)dummyReply);
+ }
}
- }
-#ifdef NA_CMPDLL
} // end if (getSessionDefaults()->callEmbeddedArkcmp() && ...
-#endif // NA_CMPDLL
}
void ContextCli::resetAttributes()
@@ -5252,9 +4029,6 @@ RETCODE ContextCli::authQuery(
//*********************** End of ContextCli::authQuery *************************
-
-
-
// Public method to update the databaseUserID_ and databaseUserName_
// members and at the same time. It also calls dropSession() to create a
// session boundary.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/Context.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Context.h b/core/sql/cli/Context.h
index ad5a0be..e0d6ccc 100644
--- a/core/sql/cli/Context.h
+++ b/core/sql/cli/Context.h
@@ -56,9 +56,7 @@
#include "NAUserId.h"
#include "SessionDefaults.h"
#include "ex_transaction.h"
-#ifdef NA_CMPDLL
#include "CmpCommon.h"
-#endif // NA_CMPDLL
#include "ExSqlComp.h"
#include "ExStats.h"
#include "ExpSeqGen.h"
@@ -285,11 +283,9 @@ private:
// keeps track of current define context.
unsigned short defineContext_;
-#ifdef NA_CMPDLL
// flag and pointer to the embedded arkcmp context
NABoolean isEmbeddedArkcmpInitialized_;
CmpContext * embeddedArkcmpContext_;
-#endif // NA_CMPDLL
// pointer to the array of server versions used to communicate with ARKCMP.
ARRAY(ExSqlComp *) arkcmpArray_;
@@ -419,10 +415,6 @@ private:
inline HashQueue * cursorList(){return cursorList_;};
inline HashQueue * openStatementList(){return openStatementList_;};
- RETCODE allocateStmt(SQLSTMT_ID * stmt_id, char * cn,
- Statement::StatementType stmt_type,
- Module *module = NULL);
-
// Used to reclaim space from a list of closed statements.
void addToCloseStatementList(Statement *statement);
@@ -644,19 +636,8 @@ public:
Lng32 initializeExeBDRConfigInfo(char *mgbltyCatName,
ComDiagsArea * diagsArea);
-SQLCLI_LIB_FUNC
short moduleAdded(const SQLMODULE_ID * module_name);
-SQLCLI_LIB_FUNC
- RETCODE addModule(const SQLMODULE_ID * module_name,
- NABoolean tsCheck = TRUE,
- NABoolean unpackTDBs = TRUE, char * moduleDir = NULL,
- NABoolean lookInGlobalModDir = TRUE);
-
-SQLCLI_LIB_FUNC
- RETCODE dropModule(const SQLMODULE_ID * module_name);
- Module * getModule(const SQLMODULE_ID * module_id);
-
RETCODE allocateDesc(SQLDESC_ID * desc_id, Lng32 max_entries);
RETCODE deallocDesc(SQLDESC_ID * desc_id,
NABoolean deallocStaticDesc);
@@ -664,8 +645,7 @@ SQLCLI_LIB_FUNC
RETCODE allocateStmt(SQLSTMT_ID * stmt_id,
Statement::StatementType stmt_type = Statement::DYNAMIC_STMT,
- SQLSTMT_ID * cloned_stmt_id = NULL,
- Module * module = NULL);
+ SQLSTMT_ID * cloned_stmt_id = NULL);
RETCODE deallocStmt(SQLSTMT_ID * stmt_id,
NABoolean deallocStaticStmt);
@@ -686,7 +666,6 @@ SQLCLI_LIB_FUNC
short commitTransaction(NABoolean waited);
short releaseAllTransactionalRequests();
-SQLCLI_LIB_FUNC
void closeAllCursors(enum CloseCursorType,
enum closeTransactionType transType, const Int64 executorXnId = 0,
NABoolean inRollback = FALSE);
@@ -729,10 +708,8 @@ SQLCLI_LIB_FUNC
// return the TimeoutData field of the context (if it is NULL --allocate it)
// (If allocate == FALSE, just return it as is, even if it is NULL)
-SQLCLI_LIB_FUNC
TimeoutData * getTimeouts( NABoolean allocate = TRUE );
-SQLCLI_LIB_FUNC
void clearTimeoutData(); // deallocate the TimeoutData
// make these functions non-inline on NT and inline on NSK.
@@ -742,14 +719,11 @@ SQLCLI_LIB_FUNC
// By making them non-inline on nt, a stub could be added.
// This problem does not show up on nsk since inline functions
// are really inline out there.
-SQLCLI_LIB_FUNC
void incrementTimeoutChangeCounter();
-SQLCLI_LIB_FUNC
UInt32 getTimeoutChangeCounter();
void* &catmanInfo() {return catmanInfo_;}
-#ifdef NA_CMPDLL
////////////////////////////////////////////////////
// Used to communicate with the embedded ARKCMP.
////////////////////////////////////////////////////
@@ -763,7 +737,6 @@ SQLCLI_LIB_FUNC
void setEmbeddedArkcmpContext(CmpContext * cntx)
{ embeddedArkcmpContext_ = cntx; }
-#endif // NA_CMPDLL
////////////////////////////////////////////////////
// Used to communicate with the ARKCMP process.
////////////////////////////////////////////////////
@@ -983,7 +956,7 @@ SQLCLI_LIB_FUNC
void killIdleMxcmp();
void killAndRecreateMxcmp();
-#ifdef NA_DEBUG_C_RUNTIME
+#ifdef _DEBUG
public:
void StmtListPrintf(const Statement *s, const char *formatString, ...) const;
#endif
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/Descriptor.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Descriptor.cpp b/core/sql/cli/Descriptor.cpp
index f501ecc..efa5d58 100644
--- a/core/sql/cli/Descriptor.cpp
+++ b/core/sql/cli/Descriptor.cpp
@@ -56,12 +56,7 @@
#include "exp_clause_derived.h"
// WARNING: assuming varchar length indicator of sizeof(long) == 4
-#ifdef NA_64BIT
-// dg64 - should be 4 bytes - see WARNING above
#define VCPREFIX_LEN sizeof(Int32)
-#else
-#define VCPREFIX_LEN sizeof(Lng32)
-#endif
// extern declaration
extern short
@@ -483,19 +478,9 @@ void setVCLength(char * tgt, Lng32 len, size_t vcPrefixLength)
return;
}
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
if (vcPrefixLength == sizeof(Int32))
-#else
- if (vcPrefixLength == sizeof(Lng32))
-#endif
{
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
str_cpy_all(tgt, (char *)&len, sizeof(Int32));
-#else
- str_cpy_all(tgt, (char *)&len, sizeof(Lng32));
-#endif
}
else if (vcPrefixLength == sizeof(short))
{
@@ -521,19 +506,9 @@ Lng32 getVCLength(const char * source_string, size_t vcPrefixLength)
return 0L;
}
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
if (vcPrefixLength == sizeof(Int32))
-#else
- if (vcPrefixLength == sizeof(Lng32))
-#endif
{
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
str_cpy_all((char *)&returned_len, source_string, sizeof(Int32));
-#else
- str_cpy_all((char *)&returned_len, source_string, sizeof(Lng32));
-#endif
}
else if (vcPrefixLength == sizeof(short))
{
@@ -2271,12 +2246,7 @@ RETCODE Descriptor::setDescItem(Lng32 entry, Lng32 what_to_set,
case SQLDESC_LENGTH:
case SQLDESC_IND_TYPE:
targetType = REC_BIN32_SIGNED;
-#ifdef NA_64BIT
- // dg64 - should be 4 bytes
targetLen = sizeof(Int32);
-#else
- targetLen = sizeof(Lng32);
-#endif
targetPrecision = 31;
targetScale = 0;
break;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/Descriptor.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Descriptor.h b/core/sql/cli/Descriptor.h
index df07a0d..b092069 100644
--- a/core/sql/cli/Descriptor.h
+++ b/core/sql/cli/Descriptor.h
@@ -60,7 +60,7 @@ class CliStatement;
// BulkMoveInfo
// -----------------------------------------------------------------------
-class SQLCLI_LIB_FUNC BulkMoveInfo
+class BulkMoveInfo
{
public:
friend class Descriptor;
@@ -130,7 +130,7 @@ private:
// Descriptor
// -----------------------------------------------------------------------
#pragma warning (disable : 4275) //warning elimination
-class SQLCLI_LIB_FUNC Descriptor : public ExGod {
+class Descriptor : public ExGod {
#pragma warning (default : 4275) //warning elimination
enum Flags
{
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/ExSqlComp.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/ExSqlComp.cpp b/core/sql/cli/ExSqlComp.cpp
index 94a110b..dd4a576 100644
--- a/core/sql/cli/ExSqlComp.cpp
+++ b/core/sql/cli/ExSqlComp.cpp
@@ -27,17 +27,6 @@
* Description: This file contains the implementation of ExSqlComp class for
* executor to create arkcmp process and send requests
* for compilation and SQLCAT related tasks.
- * There are two modes this file to be compiled :
- * -DNA_ARKCMP_PROCESS_SINGLE :
- * In this case, the routines are compiled such that the
- * user will have choice to call compiler routines either
- * through linked in routines or through IPC to arkcmp, a
- * different process (choice via an env var).
- * (NOT USED ANY MORE. SEE NOTE BELOW.)
- * default case :
- * In this case, the routines are compiled such that all
- * the compiler main routines are performed in arkcmp process
- * (a different process, not linked into the executor).
*
* Created: 06/21/96
* Language: C++
@@ -103,16 +92,6 @@ void ExSqlComp::clearDiags()
diagArea_ = diagArea_->allocate(h_);
}
-inline NABoolean ExSqlComp::oneProcess()
-{
-#ifdef NA_ARKCMP_PROCESS_SINGLE
- static NABoolean flag = !getenv("ARKCMP_PROCESS_SINGLE_OFF");
- return flag;
-#else
- return FALSE;
-#endif
-}
-
inline void ExSqlComp::initRequests(Requests& req)
{
req.message_ = 0;
@@ -150,11 +129,11 @@ ExSqlComp::ReturnStatus ExSqlComp::createServer()
compilerVersion_,nodeName_)))
{
//ss_cc_change : Rare error condition
- //LCOV_EXCL_START
+ //
*diagArea_ << DgSqlCode(- CLI_OUT_OF_MEMORY)
<< DgString0("IpcServerClass");
ret = ERROR;
- //LCOV_EXCL_STOP
+
}
else
{
@@ -174,7 +153,7 @@ ExSqlComp::ReturnStatus ExSqlComp::createServer()
(priority < 1))
//ss_cc_change - rare occurence
- priority = IPC_PRIORITY_DONT_CARE;//LCOV_EXCL_LINE
+ priority = IPC_PRIORITY_DONT_CARE;
ComDiagsArea* diags = 0;
if ( !( server_ = sc_->allocateServerProcess(&diags, h_,nodeName_,
@@ -193,14 +172,14 @@ ExSqlComp::ReturnStatus ExSqlComp::createServer()
cliGlobals_->currContext()->checkAndSetCurrentDefineContext();
}
//ss_cc_change : rare error condition
- //LCOV_EXCL_START
+ //
if (ret == ERROR)
{
error(arkcmpErrorServer);
if (getenv("DEBUG_SERVER"))
MessageBox(NULL, "ExSqlComp:createServer", "error ", MB_OK|MB_ICONINFORMATION);
}
- //LCOV_EXCL_STOP
+
return ret;
}
@@ -234,10 +213,10 @@ ExSqlComp::ReturnStatus ExSqlComp::establishConnection()
ret = ERROR;
}
//ss_cc_change : rare error path
- //LCOV_EXCL_START
+ //
if (ret == ERROR)
error(arkcmpErrorConnection);
- //LCOV_EXCL_STOP
+
return ret;
}
@@ -284,7 +263,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendRequest()
arkcmpErrorUserTxnAndArkcmpGone : 0;*/
Lng32 sqlCode=0;
//ss_cc_change : debug error path
- //LCOV_EXCL_START
+ //
if (
#ifdef _DEBUG
getenv("ARKCMP_NORESEND_DEBUG") ||
@@ -302,7 +281,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendRequest()
outstandingSendBuffers_.ioStatus_ = FINISHED;
return ERROR;
}
- //LCOV_EXCL_STOP
+
// if this transaction was
// implicitly started by the executor clean it up now. otherwise
// this executor will get stuck in a repeated 8841 cycle.
@@ -379,14 +358,14 @@ ExSqlComp::ReturnStatus ExSqlComp::sendR(CmpMessageObj* c, NABoolean w)
indexIntoCliCompilerArray = cliGlobals_->currContext()->getIndexToCompilerArray();
//ss_cc_change : rare error condition
- //LCOV_EXCL_START
+ //
if (badConnection_)
{
deleteServerStruct();
badConnection_ = FALSE;
breakReceived_ = FALSE;
}
- //LCOV_EXCL_STOP
+
if (!sqlcompMessage_)
{
ret = startSqlcomp();
@@ -394,7 +373,7 @@ ExSqlComp::ReturnStatus ExSqlComp::sendR(CmpMessageObj* c, NABoolean w)
return ret;
}
//ss_cc_change : can only happen through nowait CLI
- //LCOV_EXCL_START
+ //
if(this->isShared() && (cliGlobals_->currContext() != lastContext_))
{
@@ -405,7 +384,7 @@ ExSqlComp::ReturnStatus ExSqlComp::sendR(CmpMessageObj* c, NABoolean w)
return ret;
}
}
- //LCOV_EXCL_STOP
+
sqlcompMessage_->clearAllObjects();
(*sqlcompMessage_) << *c;
@@ -462,20 +441,16 @@ ExSqlComp::OperationStatus ExSqlComp::status(Int64 reqId)
{
OperationStatus s = FINISHED;
-#ifdef NA_ARKCMP_PROCESS_SINGLE
- if (!oneProcess())
-#endif
- {
- waitForReply();
- s = outstandingSendBuffers_.ioStatus_;
- }
+ waitForReply();
+ s = outstandingSendBuffers_.ioStatus_;
+
return s;
}
// --------------------------------------------------------------------------
// Parse the info fetched from Describe::bindNode(). Genesis 10-981211-5986.
//ss_cc_change : This is unused dead code
-//LCOV_EXCL_START
+//
static NABoolean pairLenTxt(Int32 &len, const char *&txt, const char *&cqd)
{
len = 0;
@@ -491,7 +466,7 @@ static NABoolean pairLenTxt(Int32 &len, const char *&txt, const char *&cqd)
cqd += len;
return FALSE;
}
-//LCOV_EXCL_STOP
+
void ExSqlComp::appendControls(ExControlArea *dest, ExControlArea *src){
Queue *srcList = src->getControlList();
@@ -511,7 +486,7 @@ void ExSqlComp::appendControls(ExControlArea *dest, ExControlArea *src){
}
}
//ss_cc_change : This was used only for versioning - obsolete on SQ
-//LCOV_EXCL_START
+//
static ExSqlComp::ReturnStatus saveControls(ExControlArea *ca, const char *cqd)
{
#ifdef _DEBUG
@@ -571,7 +546,7 @@ static ExSqlComp::ReturnStatus saveControls(ExControlArea *ca, const char *cqd)
return ret;
}
-//LCOV_EXCL_STOP
+
ExSqlComp::ReturnStatus ExSqlComp::resetAllDefaults(){
const char * buf[] = {"control query default * reset", "control query shape off",
@@ -581,7 +556,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resetAllDefaults(){
Lng32 len = str_len(buf[i])+1;
CmpCompileInfo c((char *)buf[i], len,
(Lng32)SQLCHARSETCODE_UTF8
- , NULL, 0, NULL, 0, 0, 0);
+ , NULL, 0, 0, 0);
size_t dataLen = c.getLength();
char * data = new(h_) char[dataLen];
c.pack(data);
@@ -595,32 +570,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resetAllDefaults(){
}
return SUCCESS;
}
-//ss_cc_change : this used only when talking to a downrev compiler
-//LCOV_EXCL_START
-ExSqlComp::ReturnStatus ExSqlComp::resetRemoteDefaults(){
- const char * buf[] = {"control query default MP_CATALOG reset",
- "control query default MP_SUBVOLUME reset",
- "control query default MP_SYSTEM reset",
- "control query default MP_VOLUME reset "};
- for(Int32 i=0; i<sizeof(buf)/sizeof(char *); i++){
- Lng32 len = str_len(buf[i])+1;
- CmpCompileInfo c((char *)buf[i], len,
- (Lng32)SQLCHARSETCODE_UTF8
- , NULL, 0,NULL,0, 0, 0);
- size_t dataLen = c.getLength();
- char * data = new(h_) char[dataLen];
- c.pack(data);
-
- ReturnStatus ret = sendRequest(EXSQLCOMP::SQLTEXT_STATIC_COMPILE,
- data,dataLen);
-
- h_->deallocateMemory(data);
- if(ret == ERROR) return ret;
- }
- return SUCCESS;
-}
-//LCOV_EXCL_STOP
ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis 10-981211-5986
{
// If we are already resending the controls, then we must return.
@@ -635,18 +585,6 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
resendingControls_ = TRUE;
-#ifdef NA_ARKCMP_PROCESS_SINGLE
- if (oneProcess())
- {
- // sendRequest(CmpMessageObj*...) in single-process mode not tested!
- assert(FALSE);
- resendingControls_ = FALSE;
- lastContext_ = 0;
-
- return ERROR;
- }
-#endif
-
// ##DLL-linkage problem ...
// ## Perhaps we need to copy the global IdentifyMyself to exe-glob-ctxt ...
// cerr << "## resendControls: I am " << IdentifyMyself::getMyName() << endl;
@@ -664,7 +602,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
short indexIntoCliCompilerArray = ctxt->getIndexToCompilerArray();
//ss_cc_change: rare error condition
- //LCOV_EXCL_START
+ //
if (ctxt->arkcmpInitFailed(indexIntoCliCompilerArray))
{
ctxt->arkcmpInitFailed(indexIntoCliCompilerArray) =
@@ -673,7 +611,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
ret = ERROR;
}
- //LCOV_EXCL_STOP
+
if (ret != ERROR)
{
@@ -691,7 +629,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
char userMessage [MAX_AUTHID_AS_STRING_LEN + 1 + MAX_USERNAME_LEN + 1 + 2];
str_sprintf(userMessage, "%d,%d,%s", authOn, userAsInt, ctxt->getDatabaseUserName());
-#if defined(NA_DEBUG_C_RUNTIME)
+#ifdef _DEBUG
NABoolean doDebug = (getenv("DBUSER_DEBUG") ? TRUE : FALSE);
if (doDebug)
{
@@ -716,7 +654,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
{
ret=resetAllDefaults();
//ss_cc_change : rare error condition
- //LCOV_EXCL_START
+ //
if (ret == ERROR)
{
resendingControls_ = FALSE;
@@ -724,7 +662,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
return ERROR;
}
- //LCOV_EXCL_STOP
+
ExControlArea *sharedCtrl = cliGlobals_->getSharedControl();
Queue *sharedCtrlList = sharedCtrl->getControlList();
@@ -745,7 +683,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
str_len(GetControlDefaults::GetExternalizedDefaultsStmt())+1;
CmpCompileInfo c(buf, len,
(Lng32)SQLCHARSETCODE_UTF8
- , NULL, 0, NULL, 0, 0, 0);
+ , NULL, 0, 0, 0);
size_t dataLen = c.getLength();
char * data = new(h_) char[dataLen];
c.pack(data);
@@ -825,7 +763,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
Lng32 len = ctl->getSqlTextLen()+1;
CmpCompileInfo c(buf, len,
(Lng32)SQLCHARSETCODE_UTF8
- , NULL, 0, NULL, 0, 0, 0);
+ , NULL, 0, 0, 0);
size_t dataLen = c.getLength();
char * data = new(h_) char[dataLen];
c.pack(data);
@@ -860,7 +798,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
if (ret != ERROR)
{
// ss_cc_change : only applicable to downrev compiler
- //LCOV_EXCL_START
+ //
if (
((*diagArea_).contains(-2050) ||
(*diagArea_).contains(-2055)) &&
@@ -874,7 +812,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
loopDiags.mergeAfter(*diagArea_);
diagArea_->clear();
}
- //LCOV_EXCL_STOP
+
ret = SUCCESS;
}
else
@@ -896,9 +834,6 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
ret = ERROR;
}
- if (compilerVersion_ < COM_VERS_COMPILER_VERSION)
- resetRemoteDefaults();
-
if ((ret == ERROR) && (!breakReceived_))
{
ctxt->arkcmpInitFailed(indexIntoCliCompilerArray) =
@@ -911,7 +846,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
} // control list is NOT empty
} // if (ret != ERROR)
//ss_cc_change : rare error case
- //LCOV_EXCL_START
+ //
if (ret != SUCCESS || diagArea_->getNumber() || loopDiags.getNumber())
{
diagArea_->mergeAfter(loopDiags);
@@ -922,7 +857,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
*diagArea_ << DgSqlCode(- CLI_SEND_REQUEST_ERROR)
<< DgString0("resendControls");
}
- //LCOV_EXCL_STOP
+
doRefreshEnvironment_ = e; // restore
outstandingSendBuffers_.message_ = t; // restore
@@ -1048,7 +983,7 @@ ExSqlComp::~ExSqlComp()
diagArea_->deAllocate();
}
//ss_cc_change : this is applicable to nowait cli
-//LCOV_EXCL_START
+//
void ExSqlComp::endConnection()
{
if ( sqlcompMessage_ )
@@ -1065,7 +1000,7 @@ void ExSqlComp::endConnection()
sqlcompMessage_ = NULL;
doRefreshEnvironment_ = TRUE;
}
-//LCOV_EXCL_STOP
+
inline NABoolean ExSqlComp::getEnvironment(char*&, ULng32&)
{
// TODO : use environment in executor globals.
@@ -1108,92 +1043,16 @@ ExSqlComp::ReturnStatus
ExSqlComp::sendRequest(CmpMessageObj* request, NABoolean waited)
{
ReturnStatus ret = SUCCESS;
-
-#ifdef NA_ARKCMP_PROCESS_SINGLE
- if (oneProcess())
- {
- CmpStatement cmpStatement(cmpCurrentContext, h_);
-
- jmp_buf oldBuf;
- memcpy ( &oldBuf, &ExportJmpBuf, sizeof(jmp_buf));
+ outstandingSendBuffers_.ioStatus_ = ExSqlComp::PENDING;
+ outstandingSendBuffers_.message_ = request;
+ outstandingSendBuffers_.waited_ = waited;
+ outstandingSendBuffers_.requestId_ = request->id();
+ ret = sendR(request, waited);
+ if (ret != ERROR)
+ if (waitForReply() == ERROR)
+ if (waited)
+ ret = ERROR;
- if (setjmp(ExportJmpBuf))
- {
- diagArea_->mergeAfter(*CmpCommon::diags());
- *diagArea_ << DgSqlCode(arkcmpErrorAssert)
- << DgInt0(0) << DgString0("from longjmp(NAAssert)");
- cmpStatement.exceptionRaised();
- if (request)
- request->decrRefCount();
- memcpy ( &ExportJmpBuf, &oldBuf, sizeof(jmp_buf));
- return ERROR;
- }
-
- ExportJmpBufPtr = &ExportJmpBuf;
-
- CmpCommon::diags()->clear();
- EH_REGISTER(EH_INTERNAL_EXCEPTION);
- EH_REGISTER(EH_BREAK_EXCEPTION);
- EH_REGISTER(EH_ALL_EXCEPTIONS);
- EH_TRY
- {
- if (cmpStatement.process(*request)==CmpStatement::ERROR)
- ret = ERROR;
- else
- ret = SUCCESS;
- if (cmpStatement.reply())
- {
- replyData_ = (cmpStatement.reply())->takeData();
- replyDatalen_=(ULng32)((cmpStatement.reply())->getSize());
- //cmpStatement.reply()->decrRefCount();
- }
- else
- {
- replyData_ = 0;
- replyDatalen_ = 0;
- }
-
- }
- EH_END_TRY;
- EH_CATCH(EH_INTERNAL_EXCEPTION)
- {
- cmpStatement.exceptionRaised();
- ret = ERROR;
- }
- EH_CATCH(EH_BREAK_EXCEPTION)
- {
- NAExit(1);
- }
- EH_CATCH(EH_ALL_EXCEPTIONS)
- {
- cmpStatement.exceptionRaised();
- ret = ERROR;
- }
- diagArea_->mergeAfter(*cmpStatement.diags());
- if (diagArea_->getNumber(DgSqlCode::ERROR_))
- retval_ = ERROR;
- else if (diagArea_->getNumber(DgSqlCode::WARNING_))
- retval_ = WARNING;
- if (request)
- request->decrRefCount();
- memcpy(&ExportJmpBuf, &oldBuf, sizeof(jmp_buf));
- }
- else
-#endif
- {
- if (ret != ERROR)
- {
- outstandingSendBuffers_.ioStatus_ = ExSqlComp::PENDING;
- outstandingSendBuffers_.message_ = request;
- outstandingSendBuffers_.waited_ = waited;
- outstandingSendBuffers_.requestId_ = request->id();
- ret = sendR(request, waited);
- if (ret != ERROR)
- if (waitForReply() == ERROR)
- if (waited)
- ret = ERROR;
- }
- }
return ret;
}
@@ -1222,12 +1081,12 @@ ExSqlComp::ReturnStatus ExSqlComp::sendRequest (Operator op,
// figure out which charsets are not understood by the downrev
// compiler where this msg is being sent to.
// ss_cc_change : down rev compiler is obsolete on SQ
- //LCOV_EXCL_START
+ //
if (getVersion() < COM_VERS_2300)
{
charset = SQLCHARSETCODE_ISO88591;
}
- //LCOV_EXCL_STOP
+
if ( ( ret = preSendRequest(FALSE) ) == ERROR )
{
if ( resendFlg && badConnection_ )
@@ -1298,11 +1157,6 @@ ExSqlComp::ReturnStatus ExSqlComp::sendRequest (Operator op,
CmpMessageDatabaseUser(input_data,(CmpMsgBufLenType)size,h_);
break;
- case EXSQLCOMP::READTABLEDEF_REQUEST :
- request = new(h_)CmpMessageRequest(EXSQLCOMP::READTABLEDEF_REQUEST,
- input_data, size, h_, charset);
- break;
-
case EXSQLCOMP::END_SESSION :
request = new(h_)CmpMessageEndSession(input_data,
(CmpMsgBufLenType)size, h_);
@@ -1324,7 +1178,7 @@ ExSqlComp::ReturnStatus ExSqlComp::sendRequest (Operator op,
// If we are talking to a downrev compiler take care of the following.
//ss_cc_change
- //LCOV_EXCL_START
+ //
if ( compilerVersion_ < COM_VERS_COMPILER_VERSION)
{
// if the structure of any of the above message op types have changed from
@@ -1336,7 +1190,7 @@ ExSqlComp::ReturnStatus ExSqlComp::sendRequest (Operator op,
}
- //LCOV_EXCL_STOP
+
// send the request.
ret = sendRequest(request, waited);
if ((ret == ERROR) && badConnection_)
@@ -1360,13 +1214,13 @@ ExSqlComp::ReturnStatus ExSqlComp::sendRequest (Operator op,
else
{
//ss_cc_change : rare error condition
- //LCOV_EXCL_START
+ //
// The second retry failed. Reset outstandingSendBuffers.
outstandingSendBuffers_.ioStatus_ = ExSqlComp::FINISHED;
outstandingSendBuffers_.resendCount_ = 0;
outstandingSendBuffers_.message_ = 0;
badConnection_ = FALSE;
- //LCOV_EXCL_STOP
+
}
} // if (resendFlg)
@@ -1472,15 +1326,6 @@ ExSqlComp::ReturnStatus ExSqlComp::getReply
assert(outstandingSendBuffers_.ioStatus_ == FINISHED);
outstandingSendBuffers_.ioStatus_ = FETCHED;
-#ifdef NA_ARKCMP_PROCESS_SINGLE
- if (oneProcess())
- {
- reply = replyData_;
- size = replyDatalen_;
- return retval_;
- }
-#endif
-
Int64 request = ( reqId ) ? reqId : outstandingSendBuffers_.requestId_;
if (diagArea_->getNumber(DgSqlCode::ERROR_))
{
@@ -1542,7 +1387,7 @@ ComDiagsArea* ExSqlComp::getDiags(Int64 )
return diagArea_;
}
//ss_cc_change : dead code
-//LCOV_EXCL_START
+//
ComDiagsArea* ExSqlComp::takeDiags(Int64)
{
ComDiagsArea* d = diagArea_;
@@ -1560,7 +1405,7 @@ void ExSqlComp::deleteServerStruct()
sqlcompMessage_ = NULL;
sc_ = NULL;
}
-//LCOV_EXCL_STOP
+
// -----------------------------------------------------------------------
// Methods for CmpMessageStream
@@ -1607,15 +1452,7 @@ void CmpMessageStream::actOnSend(IpcConnection*)
Int32 guaRetcode = phandle.decompose();
if (XZFIL_ERR_OK == guaRetcode)
{
-#ifdef SQ_PHANDLE_VERIFIER
msg_mon_stop_process_name(phandle.getPhandleString());
-#else
- Int32 nid = 0;
- Int32 pid = 0;
- msg_mon_get_process_info(phandle.getPhandleString(),
- &nid, &pid);
- msg_mon_stop_process(phandle.getPhandleString(), nid, pid);
-#endif
}
delete sqlcomp_->sqlcompMessage_;
sqlcomp_->getDiags() ->setRollbackTransaction(-1);
@@ -1689,16 +1526,7 @@ void CmpMessageStream::actOnReceive(IpcConnection*)
Int32 guaRetcode = phandle.decompose();
if (XZFIL_ERR_OK == guaRetcode)
{
-#ifdef SQ_PHANDLE_VERIFIER
msg_mon_stop_process_name(phandle.getPhandleString());
-#else
- Int32 nid = 0;
- Int32 pid = 0;
- msg_mon_get_process_info(phandle.getPhandleString(),
- &nid, &pid);
- msg_mon_stop_process(phandle.getPhandleString(),
- nid, pid);
-#endif
}
delete sqlcomp_->sqlcompMessage_;
sqlcomp_->sqlcompMessage_ = NULL;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/ExSqlComp.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/ExSqlComp.h b/core/sql/cli/ExSqlComp.h
index 83830a9..8f88183 100644
--- a/core/sql/cli/ExSqlComp.h
+++ b/core/sql/cli/ExSqlComp.h
@@ -190,7 +190,6 @@ private:
// Some helper routines for internal usage
NABoolean getEnvironment(char* &data, ULng32 &size);
- NABoolean oneProcess();
// preSendRequest is to initialize the objects for each request.
ReturnStatus preSendRequest(NABoolean doRefreshEnvs);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/Globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Globals.cpp b/core/sql/cli/Globals.cpp
index 070ed84..cb9c836 100644
--- a/core/sql/cli/Globals.cpp
+++ b/core/sql/cli/Globals.cpp
@@ -77,14 +77,8 @@ CliGlobals * cli_globals = NULL;
// segment id.
#endif
-
-
-#ifdef NA_CMPDLL
#include "CmpContext.h"
-#endif // NA_CMPDLL
-//ss_cc_change
-//LCOV_EXCL_START
CliGlobals::CliGlobals(NABoolean espProcess)
: inConstructor_(TRUE),
executorMemory_("Global Executor Memory",0,0,
@@ -118,9 +112,7 @@ CliGlobals::CliGlobals(NABoolean espProcess)
defaultContext_(NULL),
langManC_(NULL),
langManJava_(NULL)
-#ifdef SQ_PHANDLE_VERIFIER
, myVerifier_(-1)
-#endif
{
globalsAreInitialized_ = FALSE;
executorMemory_.setThreadSafe();
@@ -171,20 +163,16 @@ void CliGlobals::init( NABoolean espProcess,
myNodeNumber_, myNodeName_, nodeNameLen,
myStartTime_, myProcessNameString_,
parentProcessNameString_
-#ifdef SQ_PHANDLE_VERIFIER
, &myVerifier_
-#endif
);
if (retcomrt)
{
- char errStr[128];//LCOV_EXCL_LINE
- sprintf (errStr, "Could not initialize CLI globals.ComRtGetProgramInfo returned an error :%d.", retcomrt);//LCOV_EXCL_LINE
- ex_assert(0,errStr);//LCOV_EXCL_LINE
+ char errStr[128];
+ sprintf (errStr, "Could not initialize CLI globals.ComRtGetProgramInfo returned an error :%d.", retcomrt);
+ ex_assert(0,errStr);
}
-
-
ComRtGetProcessPriority(myPriority_);
savedPriority_ = (short)myPriority_;
myNumCpus_ = ComRtGetCPUArray(cpuArray_, (NAHeap *)&executorMemory_);
@@ -192,35 +180,7 @@ void CliGlobals::init( NABoolean espProcess,
// create global structures for IPC environment
#if !(defined(__SSCP) || defined(__SSMP))
- // check if Measure is enabled and allocate Measure process counters.
- measProcCntrs_ = NULL;
- measProcEnabled_ = 0;
- measStmtEnabled_ = 0;
- measSubsysRunning_ = 0;
-
- measProcCntrs_ = new(&executorMemory_) ExMeasProcCntrs();
-
- // Ask Measure for status
- ExMeasGetStatus( measStmtEnabled_,
- measProcEnabled_,
- measSubsysRunning_ );
-
- if (measProcEnabled_)
- {
- //ss_cc_change This will not get hit on seaquest
- //LCOV_EXCL_START
- Int32 measError = measProcCntrs_->ExMeasProcCntrsBump();
- if (measError)
- {
- NADELETEBASIC (measProcCntrs_, &executorMemory_);
- measProcCntrs_ = NULL;
- measProcEnabled_ = 0;
- measStmtEnabled_ = 0;
- }
- //LCOV_EXCL_STOP
- }
-
- ipcHeap_ = new(&executorMemory_) NAHeap("IPC Heap",
+ ipcHeap_ = new(&executorMemory_) NAHeap("IPC Heap",
NAMemory::IPC_MEMORY, 2048 * 1024);
ipcHeap_->setThreadSafe();
if (! espProcess)
@@ -939,14 +899,12 @@ Lng32 CliGlobals::setEnvVar(const char * name, const char * value,
envvarsContext_++;
-#ifdef NA_CMPDLL
// need to set the env to the embedded compiler too
if (currContext()->isEmbeddedArkcmpInitialized())
{
currContext()->getEmbeddedArkcmpContext()
->setArkcmpEnvDirect(name, value, reset);
}
-#endif // NA_CMPDLL
return sendEnvironToMxcmp();
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/Globals.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Globals.h b/core/sql/cli/Globals.h
index 2eeb746..b825fb9 100644
--- a/core/sql/cli/Globals.h
+++ b/core/sql/cli/Globals.h
@@ -149,7 +149,6 @@ public:
void setExProcessStats(ExProcessStats *processStats)
{ processStats_ = processStats; }
-SQLCLI_LIB_FUNC
ExSqlComp * getArkcmp(short index = 0);
IpcEnvironment *getEnvironment();
@@ -244,16 +243,6 @@ SQLCLI_LIB_FUNC
ULng32 length,
Lng32 &retcode);
- // Measure support
- inline NABoolean getMeasStmtEnabled() { return measStmtEnabled_; }
- inline NABoolean getMeasProcEnabled() { return measProcEnabled_; }
- inline NABoolean getMeasSubsysRunning() { return measSubsysRunning_; }
-#ifndef BUILD_MUSE
- inline ExMeasProcCntrs * getMeasProcCntrs() { return measProcCntrs_; }
-#else
- inline void * getMeasProcCntrs() { return measProcCntrs_; }
-#endif
-
inline NABoolean breakEnabled() { return breakEnabled_; }
inline void setBreakEnabled(NABoolean enabled)
{ breakEnabled_ = enabled;
@@ -305,7 +294,6 @@ SQLCLI_LIB_FUNC
const char* getJniErrorStrPtr();
void updateTransMode(TransMode *transMode);
-SQLCLI_LIB_FUNC
inline
short getGlobalSbbCount()
@@ -356,9 +344,7 @@ inline
char * myNodeName() { return myNodeName_; }
Int32 myCpu() { return myCpu_; };
Int32 myPin() { return myPin_; };
-#ifdef SQ_PHANDLE_VERIFIER
SB_Verif_Type myVerifier() const {return myVerifier_;}
-#endif
Lng32 myNodeNumber() { return myNodeNumber_; };
Int64 myStartTime() { return myStartTime_; };
@@ -503,17 +489,6 @@ private:
char sysVolName_[ 18 ]; // '$' + VOLNAME + '.' +
// SUBVOL + null-terminator
-
- NABoolean measProcEnabled_;
- NABoolean measStmtEnabled_;
- NABoolean measSubsysRunning_;
-
-#ifndef BUILD_MUSE
- ExMeasProcCntrs * measProcCntrs_;
-#else
- void * measProcCntrs_;
-#endif
-
// copy of the oss envvars
char ** envvars_;
@@ -566,9 +541,7 @@ private:
// node, cpu and pin this process is running at.
char myNodeName_[8];
Int32 myCpu_;
-#ifdef SQ_PHANDLE_VERIFIER
SB_Verif_Type myVerifier_;
-#endif
pid_t myPin_;
Lng32 myNodeNumber_;
@@ -634,7 +607,6 @@ private:
// a lot of times. It is better to cache the pointer to the globals.
// -----------------------------------------------------------------------
-SQLCLI_LIB_FUNC
CliGlobals * GetCliGlobals();
#endif /* __cplusplus */
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/GlobalsDef.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/GlobalsDef.cpp b/core/sql/cli/GlobalsDef.cpp
index d5c360f..384fce2 100644
--- a/core/sql/cli/GlobalsDef.cpp
+++ b/core/sql/cli/GlobalsDef.cpp
@@ -42,4 +42,4 @@
// to link cli.lib
__declspec(dllexport) CliGlobals * cli_globals = 0;
-THREAD_P SQLEXPORT_LIB_FUNC jmp_buf ExportJmpBuf;
+THREAD_P jmp_buf ExportJmpBuf;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/Module.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Module.cpp b/core/sql/cli/Module.cpp
index 379120f..f4c5781 100644
--- a/core/sql/cli/Module.cpp
+++ b/core/sql/cli/Module.cpp
@@ -45,7 +45,6 @@ Module::Module(const char * module_name, Lng32 len, char * pathName,
Lng32 pathNameLen, NAHeap *heap)
: module_name_len_(len), path_name_len_(pathNameLen),
heap_(heap), statementCount_(0),
- stmtCntrsSpace_(NULL),
vproc_(NULL)
{
module_name_ = (char *)
@@ -61,8 +60,7 @@ Module::Module(const char * module_name, Lng32 len, char * pathName,
path_name_[pathNameLen] = 0;
}
-// ss-cc_change . The desctructore for module is never called.
-//LCOV_EXCL_START
+
Module::~Module()
{
if (module_name_)
@@ -70,51 +68,7 @@ Module::~Module()
heap_->deallocateMemory(module_name_);
}
module_name_ = 0;
-
- if (stmtCntrsSpace_)
- {
- heap_->deallocateMemory(stmtCntrsSpace_);
- }
- stmtCntrsSpace_ = 0;
}
-//LCOV_EXCL_STOP
-
-void Module::allocStmtCntrsSpace(NABoolean measEnabled)
-{
- if (statementCount_ == 0)
- return;
-
- // allocate a block of contiguous memery for measure statement counters
- // of all statements in one module.
- stmtCntrsSpace_ = (char *)heap_->allocateMemory((size_t) (statementCount_ * sizeof (ExMeasStmtCntrs)));
- // initialize each statement counters space.
-
- // mid = PXFS_PATHNAME_RESOLVE_(moduleName)
- //char * mid = this->getPathName();
-
- ExMeasStmtCntrs * stmtCntrs;
- for (Int32 i = 0; i < statementCount_; i++)
- {
- stmtCntrs = (ExMeasStmtCntrs *)getStmtCntrsSpace(i);
- stmtCntrs->init(i);
- };
- if (measEnabled)
- {
- // call Measure to setup statment counters.
- stmtCntrs = (ExMeasStmtCntrs *)stmtCntrsSpace_;
- stmtCntrs->ExMeasStmtCntrsBump(statementCount_, module_name_,
- (Int32)module_name_len_);
- }
-};
-
-char * Module::getStmtCntrsSpace (Int32 statementIndex)
-{
- // get individule counter space
- assert (statementIndex < statementCount_);
- if (stmtCntrsSpace_)
- return stmtCntrsSpace_ + (statementIndex * sizeof (ExMeasStmtCntrs));
- else return 0;
-};
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/cli/Module.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Module.h b/core/sql/cli/Module.h
index 5c28d29..7f1b6a0 100644
--- a/core/sql/cli/Module.h
+++ b/core/sql/cli/Module.h
@@ -51,17 +51,12 @@ class Module : public ExGod {
Int32 statementCount_;
COM_VERSION version_;
char * vproc_;
- char * stmtCntrsSpace_; // contiguous block of memory for all measure
- // statement counters in one module.
public:
Module(const char * module_name, Lng32 module_name_len,
char * pathName, Lng32 pathNameLen, NAHeap *heap);
~Module();
- void allocStmtCntrsSpace(NABoolean measEnabled);
- char * getStmtCntrsSpace (Int32 statementIndex); /* get individule counter */
-
inline char * getModuleName() { return module_name_; };
inline Lng32 getModuleNameLen() { return module_name_len_; };
inline char * getPathName() { return path_name_; };