List:MySQL++« Previous MessageNext Message »
From:Seth Linden Date:October 16 2008 10:10pm
Subject:Re: problem with query (execute) timeout option
View as plain text  
I decided that I would try and use the latest version of the API
(version 3.0.6) to get at the timeout problem that I mentioned below.  I
am now using the new WriteTimeoutOption and am still having problems. 
Here is a snippet from my updated code:

unsigned int time_out = 60;

mysqlpp::Connection con(mysqlpp::use_exceptions);
con.set_option(new mysqlpp::WriteTimeoutOption(time_out));

The code compiles fine but when I run it I get the following error:

Error: Can't connect to local MySQL server through socket

When I comment out the con.set_option(...) line it works like it should
and I don't get the above mentioned error.  I am still trying to
manually set the query (execute) timeout to be much shorter than the
default value.

Any thoughts?


Seth Linden wrote:
> I am using mysql++-2.1.1  I am trying to set the query (execute) timeout
> so my program doesn't hang indefinitely when the table is locked.  I am
> using the set_options function with the opt_write_timeout argument.  The
> code compiles without error but the opt_write_timeout option doesn't
> change a thing.  Here are some relevant snippets from my code:
> unsigned int time_out = 1;
> mysqlpp::Connection con(mysqlpp::use_exceptions);
> con.set_option(mysqlpp::Connection::opt_write_timeout, time_out);
> con.set_option(mysqlpp::Connection::opt_read_timeout, time_out);
> .
> .
> .
> mysqlpp::Query query = con.query();
> .
> .
> .
> query.insert(point);
> query.execute();
> Why is this opt_write_timeout option not working?  Was this fixed in a
> later version?  Is this the best way to set the query-execute timeout? 
> Also, what is the best way (within the API) to find out if the table is
> locked?
> Thanks,
> Seth

Seth Linden
Software Engineer
Research Applications Laboratory (RAL)
National Center for Atmospheric Research
Foothills Laboratory
Building 2
3450 Mitchell Lane
Boulder, CO 80301 USA
Ph: 303-497-8433

problem with query (execute) timeout optionSeth Linden16 Oct
  • Re: problem with query (execute) timeout optionSeth Linden17 Oct
    • Re: problem with query (execute) timeout optionWarren Young17 Oct
  • Re: problem with query (execute) timeout optionWarren Young17 Oct