dbTalk Databases Forums  

Help with BadQuery Exception

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Help with BadQuery Exception in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Allen Saucier
 
Posts: n/a

Default Help with BadQuery Exception - 02-17-2006 , 08:57 AM






--------------030702060301010904040908
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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_iExecuteSingleSqlCmdSto reResults", s );
g_cembMsgBox.m_vMsg("m_intExecuteSingleSqlCmdStore Results::
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_iExecuteSingleSqlCmdSto reResults",
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_iExecuteSingleSqlCmdNoR esults", s );
g_cembMsgBox.m_vMsg("m_intExecuteSingleSqlCmdStore Results::
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_iExecuteSingleSqlCmdNoR esults",
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)


--------------030702060301010904040908--

Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Help with BadQuery Exception - 02-17-2006 , 06:20 PM






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

"select * from signature;"
What do you get in the 'error' member of the BadQuery object?

Quote:
I am on an XP box running MySQL++ ver: 1.7.32
Why aren't you at least running 1.7.40? It would be even more
preferable if you were using 2.0.x.

Quote:
I know the command is valid.
Have you tried running the examples?

If the examples work, try reworking the simple1 example to query your
database instead of the MySQL++ sample database. Whether it fails on
your database or not, it will be educational.

Quote:
Both with and without the ; added.
The semicolon isn't needed in MySQL++ queries. It's only required by
the interactive MySQL query tools.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Allen Saucier
 
Posts: n/a

Default Re: Help with BadQuery Exception - 02-20-2006 , 02:06 PM



Thank you Warren.

Warren Young wrote:

Quote:
Allen Saucier wrote:


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

"select * from signature;"


What do you get in the 'error' member of the BadQuery object?
And for the Moment, I've been made a liar by my own code. GREAT...
:-( Sorry for the waste of time.

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


Why aren't you at least running 1.7.40? It would be even more
preferable if you were using 2.0.x.
Didn't know 2.x was available. Also, to switch now would be detrimental
to my project. I've only got 3 weeks left on it.

Quote:
I know the command is valid.


Have you tried running the examples?

If the examples work, try reworking the simple1 example to query your
database instead of the MySQL++ sample database. Whether it fails on
your database or not, it will be educational.
Yes, have tried the examples. However, their written for Visual
C++/.Net and not CodeBlocks. Shouldn't matter, but its a REAL hassel to
get the environment set up to run under CBs to match the VisC++/.Net env.

Quote:
Both with and without the ; added.


The semicolon isn't needed in MySQL++ queries. It's only required by
the interactive MySQL query tools.

Yeah, figured this out and that's cool.

--
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)


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.