Exemplo n.º 1
0
// 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)
Exemplo n.º 2
0
short Shape::processNextStmt(SqlciEnv * sqlci_env, FILE * fStream)
{
  short retcode = 0;

  enum ShapeState 
   {
     PROCESS_STMT, DONE
   };

  Int32 done = 0;
  Int32 ignore_toggle = 0;
  ShapeState state;
  InputStmt * input_stmt;
  SqlciNode * sqlci_node = NULL;

  state = PROCESS_STMT;

  while (!done)
    {
      input_stmt = new InputStmt(sqlci_env);
      Int32 read_error = 0;
      if (state != DONE)
	{
	  read_error = input_stmt->readStmt(fStream, TRUE);
	  
	  if (feof(fStream) || read_error == -99)
	    {
	      if (!input_stmt->isEmpty() && read_error != -4)
		{
		  // Unterminated statement in obey file.
		  // Make the parser emit an error message.
		  input_stmt->display((UInt16)0, TRUE);
		  input_stmt->logStmt(TRUE);
		  input_stmt->syntaxErrorOnEof();
		}
	      state = DONE;
	    } // feof or error (=-99)
	}
      
      // 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 PROCESS_STMT:
	  {
	    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
	      {
		if (!read_error || read_error == -4)
		  {
		    sqlci_parser(input_stmt->getPackedString(),
				 input_stmt->getPackedString(),
				 &sqlci_node,sqlci_env);
		    if ((sqlci_node) &&
			(sqlci_node->getType() == SqlciNode::SQL_CMD_TYPE))
		      {
			delete sqlci_node;

			SqlCmd sqlCmd(SqlCmd::DML_TYPE, NULL);
			
			short retcode = sqlCmd.showShape(sqlci_env, 
							 input_stmt->getPackedString());
			if (retcode)
			{
			  delete input_stmt;
			  return retcode;
			}
		      }

		    input_stmt->display((UInt16)0, TRUE);
		    input_stmt->logStmt(TRUE);
		  }
		
		sqlci_env->displayDiagnostics() ;
		
		// Clear the DiagnosticsArea for the next command...
		sqlci_DA.clear();
		    
		// if an EXIT statement was seen, then a -1 will be returned
		// from process. We are done in that case.
		if (retcode == -1)
		  state = DONE;
	      }
	  }
	break;
	
	case DONE:
	  {
	    done = -1;
  	  }
	break;
	
	default:
	  {
	  }
	break;
	
	} // switch on state
      
      delete input_stmt;
      
    } // while not done

  return 0;
}
Exemplo n.º 3
0
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)
			    {
			      read_error = stmt->fix(-1/*append_only*/);
	      		      packedStr = stmt->getPackedString();
			    }

			  stmt->logStmt();
			  if (read_error != -20)       // see "abort" note above
			    sqlci_env->getSqlciStmts()->add(stmt);

			  if (!read_error)
			    {
			      SqlciNode * sqlci_node = 0;
			      sqlci_parser(packedStr, packedStr, &sqlci_node, sqlci_env);
			      if (sqlci_node)
				{
				  retval = sqlci_node->process(sqlci_env);
				  delete sqlci_node;
				}
			    }

			  sqlci_env->displayDiagnostics();
			  sqlci_DA.clear();
			  if (retval == -1)		// EXIT command
			    break;
			}

		      if (packedEnd)
			{
			  *packedEnd = packedEndC;
			  packedStr = packedEnd;
			}
		      else
			break;		// terminate the unterminated stmt
		    }
		  else
		    {
		      // If unterminated quote, log it and history it and
		      // display error message and exit the loop;
		      // if just trailing blanks, it's no error, exit the loop.
		      if (!fc_input_stmt->isEmpty(packedStr))
			{
			  if (is_single_stmt == DUNNO)
			    {
			      is_single_stmt = YES;
			      stmt = fc_input_stmt;
			    }
			  else
			    stmt = new InputStmt(fc_input_stmt, packedStr);
			  stmt->logStmt();
			  sqlci_env->getSqlciStmts()->add(stmt);
			  fc_input_stmt->syntaxErrorOnMissingQuote(packedStr);
			}
		      break;
		    }
		}
	      while (*packedStr);
	    }
	}
      if (is_single_stmt != YES)
	delete fc_input_stmt;
    }
  else
    {
      SqlciError(SQLCI_NO_STMT_MATCH, (ErrorParam *) 0);
    }

#pragma nowarn(1506)   // warning elimination 
  return retval;
#pragma warn(1506)  // warning elimination 
} // end FixCommand::process
Exemplo n.º 4
0
short FCRepeat::process(SqlciEnv * sqlci_env)
{
  Int32 retval = 0;

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

  // ignore if "!" 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;

  // Don't add the repeat 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)
    {

      // Log the statement
      input_stmt->logStmt();

      // Add the repeated command to the stmt list
      // Make a separate copy of the cmd to be repeated; even tho it will not
      // change, a non-separate copy (i.e. 2 pointers pointing at same entity)
      // will free same memory twice in ~SqlciStmts (delete InputStmt).
      InputStmt *new_input_stmt = new InputStmt(sqlci_env);
      *new_input_stmt = input_stmt;
      sqlci_env->getSqlciStmts()->add(new_input_stmt);

      input_stmt->display((UInt16)0); //64bit project: add dummy arg - prevent C++ error
      
      SqlciNode * sqlci_node = 0;
      
      sqlci_parser(input_stmt->getPackedString(),
		   input_stmt->getPackedString(),
		   &sqlci_node, 
		   sqlci_env);
      
      if (sqlci_node)
	{
	  retval = sqlci_node->process(sqlci_env);
	  delete sqlci_node;
	}
    }
  else
    {
      SqlciError(SQLCI_NO_STMT_MATCH, (ErrorParam *) 0);
    }
  
#pragma nowarn(1506)   // warning elimination 
  return retval;
#pragma warn(1506)  // warning elimination 
}
Exemplo n.º 5
0
short Obey::process(SqlciEnv * sqlci_env)
{
  short retcode = 0;

  enum ObeyState 
   {
     SKIP_STMT, PROCESS_STMT, DONE
   };

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

  char *name = get_argument();

  errno = 0;
  FILE * file_stream = fopen(name, "r");
  if (!file_stream)
    {
      #ifndef NA_CASE_INSENSITIVE_FILENAMES
	static Int32 desensitize = -1;
	if (desensitize < 0) {
	  const char *env = getenv("SQL_MXCI_CASE_INSENSITIVE_OBEY");
	  if (!env || !*env || *env == '0')
	    desensitize = 0;
	  else if (*env == '1'   || isupper(*env))
	    desensitize = 'U';
	  else if (isdigit(*env) || islower(*env))
	    desensitize = 'L';
	  else
	    desensitize = 'U';
	}
	if (desensitize)
	  {
	    NABoolean U = (desensitize == 'U');
	    for (Int32 i = 0; i < 2 && !file_stream; i++, U = !U)
	      {
		if (U)
#pragma nowarn(1506)   // warning elimination 
		  {for (char *n=name; *n; n++) *n = toupper(*n);}
#pragma warn(1506)  // warning elimination 
		else
#pragma nowarn(1506)   // warning elimination 
		  {for (char *n=name; *n; n++) *n = tolower(*n);}
#pragma warn(1506)  // warning elimination 
		file_stream = fopen(name, "r");
	      }

	    if (!file_stream)
	      {
		// We've tried the original name aBc,
		// and ABC and abc, so as a last-ditch effort we try Abc.
#pragma nowarn(1506)   // warning elimination 
		{for (char *n=name; *n; n++) *n = tolower(*n);}
#pragma warn(1506)  // warning elimination 
#pragma nowarn(1506)   // warning elimination 
		*name = toupper(*name);
#pragma warn(1506)  // warning elimination 
		file_stream = fopen(name, "r");

		// If all failed, ensure name all upper for prettier error msg
		if (!file_stream)
#pragma nowarn(1506)   // warning elimination 
		  {for (char *n=name; *n; n++) *n = toupper(*n);}
#pragma warn(1506)  // warning elimination 
	      }
	  }
	if (!file_stream)
      #endif
	  {
	    ErrorParam *p1 = new ErrorParam (errno);
	    ErrorParam *p2 = new ErrorParam (name);
	    SqlciError (SQLCI_OBEY_FOPEN_ERROR,
			p1,
			p2,
			(ErrorParam *) 0
			);
	    delete p1;
	    delete p2;	    
	    return 0;
	  }
    }

  short prevEnvObey = sqlci_env->inObeyFile();
  sqlci_env->setObey(-1);

  Int32 done = 0;
  Int32 ignore_toggle = 0;
  Int32 veryFirst = 1;
  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
		state = PROCESS_STMT;
		section_was_seen = (state == PROCESS_STMT);
		// Clear the DiagnosticsArea for the section we're to process
		// (clear it of any preceding sections' syntax errors).
		sqlci_DA.clear();
	      }
	  }
	  break;

	case PROCESS_STMT:
	  {
#pragma nowarn(1506)   // warning elimination 
	    short section_match = input_stmt->sectionMatches();
#pragma warn(1506)  // warning elimination 

	    if (!section_name && section_match)
	      {
		input_stmt->display((UInt16)0); //64bit project: add dummy arg - prevent C++ error

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

	    if ((!section_name) || (!section_match))
	      {
		input_stmt->display((UInt16)0); //64bit project: add dummy arg - prevent C++ error

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

		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
		  {
		    if (!read_error || read_error == -4)
                      {
#pragma nowarn(1506)   // warning elimination 
                        retcode = sqlci_parser(input_stmt->getPackedString(),
                                               input_stmt->getPackedString(),
                                               &sqlci_node,sqlci_env);
#pragma warn(1506)  // warning elimination 
                        if (sqlci_node)
                          {
                            retcode = sqlci_node->process(sqlci_env);
                            if (retcode == SQL_Canceled)
                              {
			      	state = DONE;
			        retcode = 0;
			      }
			    delete sqlci_node;
                          }
                        if (retcode > 0)
                          {
                            sqlci_env->setPrevErrFlushInput();
                            retcode = 0;
                          }
                      }
                  }
                
                sqlci_env->displayDiagnostics() ;

		    // Clear the DiagnosticsArea for the next command...
		    sqlci_DA.clear();

		    // if an EXIT statement was seen, then a -1 will be returned
		    // from process. We are done in that case.
		    if (retcode == -1)
		    {
		      state = DONE;
		      fclose(file_stream);
		      done = -1;

		    }
		      
	      }
	    else
	      {
		state = DONE;
	      }
	  }
	  break;

	case DONE:
	  {
	    fclose(file_stream);
	    done = -1;
  	  }
	  break;

	default:
	  {
	  }
	  break;

	} // switch on state

      // Delete the stmt if it's not one of those we saved on the history list
      if (!input_stmt->isInHistoryList())
	delete input_stmt;

      if (breakReceived)
      {
        state = DONE;
        sqlci_env->resetPrevErrFlushInput();
	retcode = 0;
      }

    } // while not done

  sqlci_env->setObey(prevEnvObey);
  return retcode;
}
Exemplo n.º 6
0
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
                            retval = 0;
                        }
		    }
                    if (retval > 0)
                    {
			if (!eol_seen_on_input)
			{
				prev_err_flush_input = -1;
			}
			retval = 0;
                    }

                 } // else
	    }// if
         } // else
	 if ( read_error == -20)
	 {
	    sqlci_DA << DgSqlCode(SQLCI_BREAK_RECEIVED, DgSqlCode::WARNING_);
	 }
         
         if (read_error == SqlciEnv::MAX_FRAGMENT_LEN_OVERFLOW && !eolSeenOnInput() )
           setPrevErrFlushInput();


        displayDiagnostics();
        sqlci_DA.clear(); // Clear the DiagnosticsArea for the next command...

	if (total_opens != total_closes)
	{
	    char buf[100];

	    sprintf(buf, "total opens = %d, total closes = %d", total_opens, total_closes);

#pragma nowarn(1506)   // warning elimination 
	    get_logfile()->WriteAll(buf, strlen(buf));
#pragma warn(1506)  // warning elimination 
	}

	// Delete the stmt if not one of those we saved on the history list
	if (!input_stmt->isInHistoryList())
	    delete input_stmt;
   
	if (inputPassedIn)
	  retval = 1;
    } // while
    if (retval == SQL_Canceled)
      return SQL_Canceled;
    else
      return 0;
   }
   catch(EHBreakException&)
   {
     sqlci_DA << DgSqlCode(SQLCI_BREAK_RECEIVED, DgSqlCode::WARNING_);
     displayDiagnostics();
     sqlci_DA.clear(); // Clear the DiagnosticsArea for the next command...

     if (sqlci_node)
       delete sqlci_node;
     sqlci_node = NULL;
     cin.clear();
     // NOTE: EnterCriticalSection has been done in ThrowBreakException()
     LeaveCriticalSection(&g_CriticalSection);
     return -1;
   }
   catch(...)
   {
      return 1;
   }

} // executeCommands