List:MySQL++« Previous MessageNext Message »
From:Allen Saucier Date:February 17 2006 2:57pm
Subject:Help with BadQuery Exception
View as plain text  
Hi all,

I am getting a "BadQuery" exception thrown _*every time*_ I send in this 
statement:

"select * from signature;"

I am on an XP box running MySQL++ ver: 1.7.32
I am running MySQL ver: 4.1

I know the command is valid.  I use MySQL Query Browser for this windows 
env to test the command and it executes perfectly!!!!  Both with and 
without the ; added.

The command in code that I use to execute the above statement is one of 
the following:

**************************   1  
**********************************************
  m_pqryQuery->reset();
 
 
  // Put SQL Cmd into the Query Object.
  //
  try{
    *m_pqryQuery << p_strSqlCmd;
    cout << "Query: " << m_pqryQuery->preview() << endl;
    string s = m_pqryQuery->preview();
    g_cembMsgBox.m_vMsg("preview: " + s);
  }
  catch (exception &e)
    {
      string s=e.what();
      s.append(" Unable to Set Up SQL  Statement Properly");
      elog.put("CTableStructs::m_iExecuteSingleSqlCmdStoreResults", s );
      g_cembMsgBox.m_vMsg("m_intExecuteSingleSqlCmdStoreResults:: 
Exception! with Query Construction\n");
      return g_intCANTCONSTRUCTQRY;
    };

 
  // Execute the query and store the results w/in the Parameter m_rltResult
  //
  try{
    m_rltResults = m_pqryQuery->store();
    i_numrows    = m_rltResults.size();
  }
  catch (BadQuery &er)
    {
      //elog.put("CTableStructs::m_iExecuteSingleSqlCmdStoreResults", 
er.what());
      //string s = "CDatabaseInterface::  Bad Query: [" + er.error +"]";
      //g_cembMsgBox.m_vMsg(s);
      return g_intBADQUERY;
    } // catch sql cmd error

*************************     1  
**********************************************




************************** 2 **********************************************
  m_pqryQuery->reset();

  try{
    *m_pqryQuery << p_strSqlCmd;
    cout << "Query: " << m_pqryQuery->preview() << endl;
    string s = m_pqryQuery->preview();
    g_cembMsgBox.m_vMsg(s);
  }
  catch (exception &e)
    {
      string s=e.what();
      s.append(" Unable to Set Up SQL Statement Properly");
      elog.put("CTableStructs::m_iExecuteSingleSqlCmdNoResults", s );
      g_cembMsgBox.m_vMsg("m_intExecuteSingleSqlCmdStoreResults:: 
Exception! with Query Construction\n");
      return g_intCANTCONSTRUCTQRY;
    };


  // Execute the query and store the results w/in the Parameter m_rltResult
  //
  try{
    m_pqryQuery->execute();
    i_numrows    = 0;
  }
  catch (BadQuery &er)
    {
      //elog.put("CTableStructs::m_iExecuteSingleSqlCmdNoResults", 
er.what());
      //string s = "CDatabaseInterface::  Bad Query: [" + er.error +"]";
      //g_cembMsgBox.m_vMsg(s);
      return g_intBADQUERY;
    } // catch sql cmd error

************************** 2 **********************************************

Could someone please help me?  I really need to understand this "error" 
which is NOT an error.

Everything is set up correctly and yes I know that executing  
"m_pqryQuery->execute();" results in NO  RESULTS but still I get the 
exception thrown and I really don't understand.

Any help will be greatly appreciated.  Thank you ahead of time!

-- 
Sincerely, Allen

Gene Allen Saucier, Jr
Senior Software Engineer
CAS, Inc
100 Quality Circle
Huntsville, AL  35806
or
PO Box 11190
Huntsville, AL  35814
(256) 922-6453 (w)


Thread
Help with BadQuery ExceptionAllen Saucier17 Feb
  • Re: Help with BadQuery ExceptionWarren Young18 Feb
    • Re: Help with BadQuery ExceptionAllen Saucier20 Feb