List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 13 2003 1:03pm
Subject:Re: problem with C and mysql 4
View as plain text  
At 23:44 -0700 5/12/03, Carl B. Constantine wrote:
>* Paul DuBois (paul@stripped) wrote:
>>  >I always get a failed result and a subsequent select also fails at that
>>  >point. This is in the same routine that I've just done the query to
>>  >verify a successful connection to the DB. I've tried all kinds of things
>>  >to no avail. I'm using Matthew Stucky's "MySQL: Building User
>>  >Interfaces" as a guide.
>>  >
>>  >Anyone know what is up?
>>
>>  Print the values of mysql_error() and mysql_errno() and see what
>>  they tell you.
>
>Ok, I did what you suggest and here is what I get:
>
>Insert failed
>Error is: Commands out of sync;  You can't run this command now
>Error No is: 2014

In your first query, you ran a SELECT.  But apparently you didn't
actually fetch the results and free the result set.  So the server's
still waiting for you to do that before you issue another query.
At least, that's what I'd guess based on the error message.  It
should be sufficient to call mysql_store_result() and mysql_free_result()
before issuing the second query.

>
>for the sake of argument, I did the exact same thing on my debian system
>   running MySQL 3.23.52 and received the exact same error.
>
>Does this help in some way? How can a command be "out of sync" after a
>connect test (the first select query)? I know my query is valid sql as
>I've done the same insert query (using different field values) in
>mysqlcc without issues.
>
>
>Once the insert is tried, I try the select and get the exact same error.
>
>>  Paul DuBois
>>  http://www.kitebird.com/
>>  sql, query
>
>Paul, I have your first MySQL book. It's great. Thanks for writting it.
>I still have to pick up the second one though.

Actually, there are three. :-)

>
>--
>  .''`.      Carl B. Constantine
>: :' :     duckwing@stripped
>`. `'    GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
>   `-  Debian GNU/Linux -- The power of freedom


-- 
Paul DuBois
http://www.kitebird.com/
sql, query
Thread
problem with C and mysql 4Carl B. Constantine13 May
  • Re: problem with C and mysql 4Dobromir Velev13 May
  • Re: problem with C and mysql 4Allen Grace13 May
  • Re: problem with C and mysql 4Paul DuBois14 May
  • Re: problem with C and mysql 4Fred van Engen14 May
RE: problem with C and mysql 4Bruce W. Marriner13 May
  • RE: problem with C and mysql 4Paul DuBois14 May
Re: problem with C and mysql 4Paul DuBois13 May
Re: problem with C and mysql 4Carl B. Constantine14 May
Re: problem with C and mysql 4Carl B. Constantine14 May
Re: problem with C and mysql 4Carl B. Constantine14 May
  • Re: problem with C and mysql 4Paul DuBois14 May