当前位置: 首页>>代码示例>>C++>>正文


C++ ComDiagsArea::clear方法代码示例

本文整理汇总了C++中ComDiagsArea::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ ComDiagsArea::clear方法的具体用法?C++ ComDiagsArea::clear怎么用?C++ ComDiagsArea::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ComDiagsArea的用法示例。


在下文中一共展示了ComDiagsArea::clear方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sqlci_parser_handle_error

Int32 sqlci_parser_handle_error(SqlciNode **node, Lng32 retval)
{
  NABoolean syntaxError_ = sqlci_DA.contains(-SQLCI_SYNTAX_ERROR);
  
  if (retval && syntaxError_)
    {	
      if (SqlciEnvGlobal->isReportWriterMode())
	{
	  SqlciParseTree = (SqlciNode *)new SqlciRWQueryCmd(SqlciParse_OriginalStr,
			(Lng32)strlen(SqlciParse_OriginalStr));
	  assert(SqlciParseTree->isSqlciNode());
	  *node = SqlciParseTree;	
	  sqlci_DA.clear(); // clear the diagonistics
	  return 0;
	}
      else if (SqlciEnvGlobal->isMXCSMode())
      {
        SqlciParseTree = (SqlciNode *)new SqlciCSQueryCmd(SqlciParse_OriginalStr,
                               (Lng32)strlen(SqlciParse_OriginalStr));
	  assert(SqlciParseTree->isSqlciNode());
	  *node = SqlciParseTree;	
	  sqlci_DA.clear(); // clear the diagonistics
	  return 0;
      }
      else
	return retval;
    }
  else
    return retval;
  
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:31,代码来源:SqlciParser.cpp

示例2: run

// sqlci run with input coming in from an infile specified at command line
void SqlciEnv::run(char * in_filename, char * input_string)
{
  if ((! in_filename) && (input_string))
    {
      runWithInputString(input_string);
      return;
    }
  interactive_session = 0;		// overwrite value from ctor!
  // This function is called during the initialization phase of MXCI
  // (SqlciEnv_prologue_to_run). Use specialERROR_ as a flag indicating that
  // the querry being executed is invoke during MXCI's initialization phase and
  // that any errors will be fatal. Should an error occur,  exit MXCI.
  SqlciEnv_prologue_to_run(this);

   SqlCmd::executeQuery("SET SESSION DEFAULT SQL_SESSION 'BEGIN';", this);
  Int32 retval = 0;
  SqlciNode * sqlci_node = 0;

  // input is from a file given at command line (SQLCI -i<filename>).
  // Create an "OBEY filename" command and process it.
  char * command = new char[10 + strlen(in_filename)];
  strcpy(command, "OBEY ");
  strcat(command, in_filename);
  strcat(command, ";");
  sqlci_parser(command, command, &sqlci_node,this);
  delete [] command;
  void (*intHandler_addr) (Int32);
  intHandler_addr = interruptHandler;
      if (sqlci_node)
      {
        retval = sqlci_node->process(this);
        delete sqlci_node;
        sqlci_node = NULL;
        displayDiagnostics();
        sqlci_DA.clear(); // Clear the DiagnosticsArea for the next command...
      }

      if (!retval) // EXIT not seen in the obey file
      {
        // create an EXIT command
        char command[10];
        strcpy(command, "exit;");
        get_logfile()->WriteAll(">>exit;");
        sqlci_parser(command, command, &sqlci_node,this);
        if (sqlci_node)
	{
	  retval = sqlci_node->process(this);
	  delete sqlci_node;
          sqlci_node = NULL;
	  displayDiagnostics();
	  sqlci_DA.clear();
	}
      }
   DeleteCriticalSection(&g_CriticalSection);
   DeleteCriticalSection(&g_InterruptCriticalSection);

  cleanupSockets();
}  // run (in_filename)
开发者ID:XueminZhu,项目名称:incubator-trafodion,代码行数:59,代码来源:SqlciEnv.cpp

示例3: CmpSPExtractFunc_

SP_HELPER_STATUS CmpSPExtractFunc_ (
                                    Lng32 fieldNo, 
                                    SP_ROW_DATA rowData, 
                                    Lng32 fieldLen, 
                                    void* fieldData,
                                    Lng32 casting )
{
  CmpSPExecDataItemInput* inPtr = (CmpSPExecDataItemInput*)rowData;
  ULng32 tempNum = (ULng32)fieldNo;
  ULng32 tempLen = (ULng32)fieldLen;
  ComDiagsArea* diags = inPtr->SPFuncsDiags();
  if ( inPtr->extract(tempNum,(char*)fieldData,tempLen, 
    ((casting==1) ? TRUE : FALSE), diags) < 0 ||
    diags->getNumber() )
  {
    // TODO, convert the errors in diags into error code.
    diags->clear(); // to be used for next CmpSPExtractFunc_
    return SP_ERROR_EXTRACT_DATA;
  }
  // test code for assert, check for arkcmp/SPUtil.cpp SP_ERROR_*
  // for detail description.
  //#define ASTRING "TestCMPASSERTEXE"
  //assert( strncmp((char*)fieldData, ASTRING, strlen(ASTRING) != 0 ) ) ;

  return SP_NO_ERROR;
}
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:26,代码来源:CmpISPUtils.cpp

示例4: interruptHandler

void interruptHandler (Int32 signalType)
{
   void (*intHandler_addr) (Int32);
   intHandler_addr = interruptHandler;
   Lng32 retcode = 0; // for return of success or failure from handleBreak methods in MACL and RW.

   UInt32 recoverNeeded = 0;

   signal(SIGINT, intHandler_addr);  // arm the signal for break.
   // This is for the Break key abend problem in Outside View for NSK.  Instead of SIGINT,
   // SIGQUIT is being sent by the TELSRV people to OSS.  We catch it right here.


   if (TryEnterCriticalSection(&g_CriticalSection))
     {
	   Lng32 eCode = SQL_EXEC_Cancel(0);
		if (eCode ==0) {

			LeaveCriticalSection(&g_CriticalSection);

		}
		else { // retry
			switch (-eCode) {
			case CLI_CANCEL_REJECTED:
				{
				  SqlciEnv s;
				  s.displayDiagnostics();
				  sqlci_DA.clear();
				  LeaveCriticalSection(&g_CriticalSection);

				}
				break;
			default:
				{
				 sqlci_DA << DgSqlCode(SQLCI_BREAK_ERROR, DgSqlCode::WARNING_);
				 SqlciEnv s;
				 s.displayDiagnostics();
				 sqlci_DA.clear();
				 LeaveCriticalSection(&g_CriticalSection);
				}
				break;
			}
		}

     }

}
开发者ID:XueminZhu,项目名称:incubator-trafodion,代码行数:47,代码来源:SqlciEnv.cpp

示例5: CmpSPFormatFunc_

SP_HELPER_STATUS CmpSPFormatFunc_ (Lng32 fieldNo,
                                   SP_ROW_DATA rowData, 
                                   Lng32 fieldLen, 
                                   void* fieldData,
                                   Lng32 casting)
{
  CmpSPExecDataItemReply* replyPtr = (CmpSPExecDataItemReply*)rowData;
#pragma nowarn(262)   // warning elimination 
  ULng32 tempNum = (ULng32)fieldNo;
  ULng32 tempLen = (ULng32)fieldLen;
  ComDiagsArea* diags = replyPtr->SPFuncsDiags();
  if ( replyPtr->moveOutput(fieldNo,(char*)fieldData,tempLen, 
    ((casting==1) ? TRUE : FALSE), diags) < 0 ||
    diags->getNumber() )
  {
    diags->clear(); // to be used for next CmpSPFormatFunc_
    return SP_ERROR_FORMAT_DATA;
  }
  else
    return SP_NO_ERROR;
}
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:21,代码来源:CmpISPUtils.cpp

示例6: sqlci_parser

Int32 sqlci_parser(char *instr, char *origstr, SqlciNode ** node, SqlciEnv *sqlci_env)
{
  Lng32 prevDiags = sqlci_DA.getNumber();	// capture this before parsing

  // replace any user defined pattern in the query
  char * newstr = origstr;
  newstr = SqlCmd::replacePattern(sqlci_env, origstr);  

  Int32 retval = sqlci_parser_subproc(instr, newstr, node, sqlci_env);
  
  // There's still some weird error in the Sqlci Lexer
  // ("OBEY F(S);FC 1;" and "OBEY F;!O;" fail -- bug in the <FNAME> state?).
  // Here we *KLUDGE* around the problem, by retrying the parse once only.
  
  if (retval)
    {
      sqlci_parser_syntax_error_cleanup(NULL, sqlci_env);
      if (!prevDiags && retval > 0)		// NOT the -99 from above!
	{
	  sqlci_DA.clear();
	  retval = sqlci_parser_subproc(instr, newstr, node, sqlci_env);
	  if (retval)
	    sqlci_parser_syntax_error_cleanup(NULL, sqlci_env);
	}
    }
  
  if (retval > 0)
    {
      SqlciParse_OriginalStr = origstr;
      retval = sqlci_parser_handle_error(node, retval);
    }

  if (newstr != origstr)
    delete [] newstr;

  return retval;
  
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:38,代码来源:SqlciParser.cpp

示例7: printMDFWriterErrors

// print MDFWriter errors to cout
void SQLJFile::printMDFWriterErrors(char *errFileName)
{
  char args[1024], EorW[10];
  Int32  errNum;
  FILE *errFile = fopen(errFileName, "r");
  if (errFile) {
    // accommodate case of MDFWriter dumping more entries into its errFile
    // than can fit into the fixed-size diags area. Do this by feeding
    // and then dumping diags one entry at a time.
    ComDiagsArea *myDiags = ComDiagsArea::allocate(mxCUMptr->heap());
    while (fscanf(errFile, "%s %d ", EorW, &errNum) != EOF) {
      size_t sLen = 0;
      if (fgets(args, 1024, errFile) == NULL) { // fgets got EOF or an error
        args[0] = 0; // empty string
        *mxCUMptr << FAIL;
      }
      else { // fgets got something
        sLen = strlen(args);
        // chop off terminating newline
        if (args[sLen-1] == '\n') {
          args[sLen-1] = 0;
        }
        if (sLen >= 1023) { // diagnostic msg is too long
          // toss rest of line
          Int32 nxtCh;
          do {
            nxtCh = fgetc(errFile);
          } while (nxtCh != '\n' && nxtCh != EOF);
        }
      }
      if (!myDiags) { // no diags
        *mxCUMptr << FAIL;
        if (sLen >= 1023) { // diagnostic msg is too long
          cerr << "Diagnostic message is over 1023 characters long." << endl;
        }
        // echo error file entry to cerr
        cerr << EorW << " " << errNum << " " << args << endl;
      }
      else {
        if (sLen >= 1023) { // diagnostic msg is too long
          *mxCUMptr << WARNING;
          *myDiags << DgSqlCode(2237);
        }
        switch (errNum) {
        case 2224:
        case 2225:
        case 2226:
          *mxCUMptr << FAIL; 
          *myDiags << DgSqlCode(-errNum);
          break;
        case 2227:
        case 2228:
        case 2230:
          *mxCUMptr << FAIL;
          *myDiags << DgSqlCode(-errNum) << DgString0(args);
          break;
        case 2229:
          *mxCUMptr << ERROR;
          *myDiags << DgSqlCode(-errNum) << DgString0(args);
          break;
        default:
          *mxCUMptr << (EorW[0]=='E' ? ERROR :
                        (EorW[0]=='W' ? WARNING : FAIL));
          *myDiags << DgSqlCode(-2231) << DgInt0(errNum) 
                   << DgString0(EorW) << DgString1(args);
          break;
        } // end switch
        NADumpDiags(cerr, myDiags, TRUE);
        myDiags->clear();
      } // end if
    } // end while
    if (myDiags) {
      myDiags->decrRefCount();
    }
    fclose(errFile);
  }
  else {
    *mxCUMptr << FAIL << DgSqlCode(-2218) << DgString0(errFileName);
  }
  // clean up temporary file (MDFWriter errors)
  remove(errFileName);
}
开发者ID:apache,项目名称:incubator-trafodion,代码行数:83,代码来源:SQLJFile.cpp

示例8: process

short FixCommand::process(SqlciEnv * sqlci_env)
{
  Int32 retval = 0;

  if (sqlci_env->isOleServer())
  {
	SqlciError (SQLCI_CMD_NOT_SUPPORTED,
				(ErrorParam *) 0 );
	return 0;
  }

  // ignore if FC is in an obey file, or stdin redirected from a file
  // (should we display an informative error message?)
  if (!sqlci_env->isInteractiveNow())
#pragma nowarn(1506)   // warning elimination 
    return retval;
#pragma warn(1506)  // warning elimination 

  InputStmt *input_stmt = 0, *stmt = 0;

  // Don't add the FC cmd to the sqlci stmts list. 
  sqlci_env->getSqlciStmts()->remove();

  if (cmd != 0) // Character string was provided...
    { 
      input_stmt = sqlci_env->getSqlciStmts()->get(cmd);
    }
  else
    {
      if (!cmd_num)
	input_stmt = sqlci_env->getSqlciStmts()->get();
      else
	{
	  if (neg_num) cmd_num = (sqlci_env->getSqlciStmts()->last_stmt()  
				  - cmd_num) + 1;
	  
	  input_stmt = sqlci_env->getSqlciStmts()->get(cmd_num);
	}
    }

  if (input_stmt)
    {
      enum { DUNNO, YES, NO };
      Int32 is_single_stmt = DUNNO;
      InputStmt * fc_input_stmt = new InputStmt(sqlci_env);
      *fc_input_stmt = input_stmt;

      // Prompt user to fix the input stmt.
      // Fix() value is 0 if we are to execute (and log and history) new stmt,
      // -20 if user "aborted" the FC via an EOF or "//" at the prompt
      // (we must emulate this behavior at the -20 section later on!)
      //
      if (fc_input_stmt->fix() != -20)
	{
	  if (!fc_input_stmt->isEmpty())
	    {
	      // Clear any syntax errors thrown by InputStmt::fix();
	      // we'll get to 'em one at a time in this loop
	      sqlci_DA.clear();

	      // Looping, process one or more commands ("a;b;c;")
	      // on the FC input line.
	      char * packedStr = fc_input_stmt->getPackedString();
	      do
		{
		  size_t quotePos;		// unterminated quote seen?
		  char packedEndC = '\0';
		  char * packedEnd = fc_input_stmt->findEnd(packedStr, quotePos);
		  if (!quotePos)
		    {
		      // No unterminated quote

		      if (is_single_stmt == DUNNO)
			is_single_stmt = 
			  (!packedEnd || fc_input_stmt->isEmpty(packedEnd)) ?
			  YES : NO;
			
		      if (packedEnd)		// semicolon seen
			{
			  packedEndC = *packedEnd;
			  *packedEnd = '\0';
			  if (is_single_stmt == YES && packedEndC)
			    is_single_stmt = NO;
			}

		      if (!fc_input_stmt->isEmpty(packedStr))
			{
			  if (is_single_stmt == YES)
			    stmt = fc_input_stmt;
			  else
			    stmt = new InputStmt(fc_input_stmt, packedStr);

			  Int32 read_error = 0;

			  // Unterminated stmt (no ";" seen),
			  // so prompt for the rest of it.
			  // If user enters EOF in the appended lines,
			  // then log it, but don't history it or execute it.
			  if (!packedEnd)
			    {
//.........这里部分代码省略.........
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:101,代码来源:SqlciStmts.cpp

示例9: process


//.........这里部分代码省略.........
  ObeyState state;

  if (!section_name)
    state = PROCESS_STMT;
  else
    state = SKIP_STMT;

  Int32 section_was_seen = (state == PROCESS_STMT);

  InputStmt * input_stmt;
  SqlciNode * sqlci_node = 0;

  while (!done)
    {
      input_stmt = new InputStmt(sqlci_env);
      Int32 read_error = 0;
	  if(veryFirst == 1)
	  {
	    veryFirst = 0;
		input_stmt->setVeryFirstLine();
      }
      if (state != DONE)
	{
	  // If section wasn't seen yet, then suppress echoing of blank lines
	  // in the preceding sections of the obey file as we read thru it.
	  read_error = input_stmt->readStmt(file_stream, !section_was_seen);

	  if (feof(file_stream) || read_error == -99)
	  {
	    if (!section_was_seen && read_error != -99)
	      {
		// Clear the DiagnosticsArea of any preceding sections'
		// syntax errors.
		sqlci_DA.clear();
		SqlciError (SQLCI_SECTION_NOT_FOUND,
			    new ErrorParam (section_name),
			    new ErrorParam (name),
			    (ErrorParam *) 0
			   );
	      }
	    else if (!input_stmt->isEmpty() && read_error != -4)
	      {
		// Unterminated statement in obey file.
		// Make the parser emit an error message.
		input_stmt->display((UInt16)0); //64bit project: add dummy arg - prevent C++ error
		input_stmt->logStmt();
		input_stmt->syntaxErrorOnEof();
	      }
	      state = DONE;
	      
		}
		
	  // if there is an eof directly after a statement
	  // that is terminated with a semi-colon, process the
	  // statement
	  if (read_error == -4)   state = PROCESS_STMT;
	}


    switch (state)
	{
	case SKIP_STMT:
	  {
	    if (input_stmt->sectionMatches(section_name))
	      {
		input_stmt->display((UInt16)0); //64bit project: add dummy arg - prevent C++ error
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:67,代码来源:Obey.cpp

示例10: executeCommands

Int32 SqlciEnv::executeCommands(InputStmt *& input_stmt)
{
   Int32 retval = 0;
   Int32 ignore_toggle = 0;
   SqlciNode * sqlci_node = 0;

   NABoolean inputPassedIn = (input_stmt ? TRUE : FALSE);

   try
   {

     while (!retval)
      {
	 total_opens = 0;
	 total_closes = 0;

	 // This is new'd here, deleted when history buffer fills up,
	 // in SqlciStmts::add/StmtEntry::set
	 if (NOT inputPassedIn)
	   input_stmt = new InputStmt(this);



	 Int32 read_error = 0;
	 if (NOT inputPassedIn)
	   read_error = input_stmt->readStmt(NULL/*i.e. input is stdin*/);

         prev_err_flush_input = 0;

	 if (cin.eof() || read_error == -99)
	   {
	       // allow the other thread to process
	       Sleep(50);				// milliseconds
	     if (!input_stmt->isEmpty())
	       {
		 // Unterminated statement in input file (redirected stdin).
		 // Make the parser emit an error message.
		 if (!isInteractiveSession())
		   input_stmt->display((UInt16)0);
		 input_stmt->logStmt();
		 input_stmt->syntaxErrorOnEof();
		 displayDiagnostics();
		 sqlci_DA.clear();
	       }
	     char command[10];
	     strcpy(command, ">>exit;");
	     if (!isInteractiveSession())
	       get_logfile()->WriteAll(command);
	     else if (get_logfile()->IsOpen())
#pragma nowarn(1506)   // warning elimination 
	       get_logfile()->Write(command, strlen(command));
#pragma warn(1506)  // warning elimination 
	     sqlci_parser(&command[2], &command[2], &sqlci_node,this);

	     if (sqlci_node)
	       {
		 retval = sqlci_node->process(this);
		 delete sqlci_node;
                 sqlci_node = NULL;
	       }
	   }
	 else
	   {
	     if (!isInteractiveSession())
	       input_stmt->display((UInt16)0);

	     if (logCommands())
	       get_logfile()->setNoLog(FALSE);
	     input_stmt->logStmt();
	     if (logCommands())
	       get_logfile()->setNoLog(TRUE);

	     if (!input_stmt->sectionMatches())
	       {
		 Int32 ignore_stmt = input_stmt->isIgnoreStmt();
		 if (ignore_stmt)
		   ignore_toggle = ~ignore_toggle;
		 if (ignore_stmt || ignore_toggle || input_stmt->ignoreJustThis())
		   {
		     // ignore until stmt following the untoggling ?ignore
		     sqlci_DA.clear();
		   }
		 else
		 {
		     getSqlciStmts()->add(input_stmt);
		     if (!read_error)
		     {
			retval = sqlci_parser(input_stmt->getPackedString(),
				   input_stmt->getPackedString(),
				   &sqlci_node, this);
			if (sqlci_node)
                        {
			  retval = sqlci_node->process(this);
			  delete sqlci_node;
                          sqlci_node = NULL;

			  if (retval == SQL_Canceled)
                            retval = 0;
			} else {
                          // pure MXCI synatax error. Reset retval
//.........这里部分代码省略.........
开发者ID:XueminZhu,项目名称:incubator-trafodion,代码行数:101,代码来源:SqlciEnv.cpp

示例11: CtrlHandler

BOOL CtrlHandler(DWORD ctrlType) {
  if (Sqlci_PutbackChar == LOOK_FOR_BREAK)	// see InputStmt.cpp
     Sqlci_PutbackChar = FOUND_A_BREAK;
  breakReceived =1;
	sqlci_DA << DgSqlCode(SQLCI_BREAK_RECEIVED, DgSqlCode::WARNING_);
  switch (ctrlType) {
      case CTRL_C_EVENT:
      case CTRL_BREAK_EVENT:
	if (TryEnterCriticalSection(&g_CriticalSection))
     {
	   Lng32 eCode = SQL_EXEC_Cancel(0);
		if (eCode ==0) {
			sqlci_DA << DgSqlCode( -SQL_Canceled, DgSqlCode::WARNING_);
			LeaveCriticalSection(&g_CriticalSection);

		}
		else { // retry
			switch (-eCode) {
			case CLI_CANCEL_REJECTED:
				{
				  sqlci_DA << DgSqlCode(SQLCI_BREAK_REJECTED, DgSqlCode::WARNING_);
				  //sqlci_DA << DgSqlCode(SQLCI_COMMAND_NOT_CANCELLED, DgSqlCode::WARNING_);
				  SqlciEnv s;
				  s.displayDiagnostics();
				  sqlci_DA.clear();
				  //breakReceived = 0;
				  LeaveCriticalSection(&g_CriticalSection);

				}
				break;
			default:
				{
				 sqlci_DA << DgSqlCode(SQLCI_BREAK_ERROR, DgSqlCode::WARNING_);
				 SqlciEnv s;
				 s.displayDiagnostics();
				 sqlci_DA.clear();
				 LeaveCriticalSection(&g_CriticalSection);
				}
				break;
			}
		}

     }
	return TRUE;
	break;

      case CTRL_CLOSE_EVENT:

      case CTRL_LOGOFF_EVENT:

      case CTRL_SHUTDOWN_EVENT:

	if (TryEnterCriticalSection(&g_CriticalSection))
     {
	   Lng32 eCode = SQL_EXEC_Cancel(0);
		if (eCode ==0) {
			sqlci_DA << DgSqlCode( -SQL_Canceled, DgSqlCode::WARNING_);
      LeaveCriticalSection(&g_CriticalSection);

		}
		else { // retry
			switch (-eCode) {
			case CLI_CANCEL_REJECTED:
				{
				  SqlciEnv s;
				  s.displayDiagnostics();
				  sqlci_DA.clear();
				  LeaveCriticalSection(&g_CriticalSection);

				}
				break;
			default:
				{
				 sqlci_DA << DgSqlCode(SQLCI_BREAK_ERROR, DgSqlCode::WARNING_);
				 SqlciEnv s;
				 s.displayDiagnostics();
				 sqlci_DA.clear();
				 LeaveCriticalSection(&g_CriticalSection);
				}
				break;
			}
		}

     }
	return TRUE;
	break;

      default:
	return FALSE;
  }
}
开发者ID:XueminZhu,项目名称:incubator-trafodion,代码行数:91,代码来源:SqlciEnv.cpp


注:本文中的ComDiagsArea::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。