List:MySQL++« Previous MessageNext Message »
From:Kevin Regan Date:June 14 2009 1:27am
Subject:RE: Why dynamic allocation for Option objects?
View as plain text  
The change below seems to fix this.  I believe that the type_info object returned is a
singleton that outlives the object, but I'm not 100% sure of that.  Can some C++ expert
confirm this?

==== //depot/project/georgetown/ports/mysql++/build/lib/connection.cpp#1 -
/home/regan/dev/kregan-em-georgetown-ws1/ports/mysql++/build/lib/connection.cpp ====
@@ -314,13 +314,14 @@
 bool
 Connection::set_option(Option* o)
 {
+       const std::type_info& typeInfo = typeid(*o);
        error_message_ = driver_->set_option(o);
        if (error_message_.empty()) {
                return true;
        }
        else {
                if (throw_exceptions()) {
-                       throw BadOption(error_message_, typeid(*o));
+                       throw BadOption(error_message_, typeInfo);
                }
                return false;
        }



--Kevin
________________________________________
From: jonathan.wakely@stripped [jonathan.wakely@stripped] On Behalf Of Jonathan Wakely
[mysql@stripped]
Sent: Saturday, June 13, 2009 3:29 AM
To: Kevin Regan
Cc: plusplus@stripped
Subject: Re: Why dynamic allocation for Option objects?

2009/6/12 Kevin Regan:
> I was taking another look at this issue (please see the code below to following along
> with my issue).  If the DBDriver::set_option returns non-empty error string, wouldn't it
> have deleted the objected contained in o that Connection::set_option will call typeid(*o)
> on?

Yes, that's a bug.
Thread
Why dynamic allocation for Option objects?Kevin Regan6 Jun
  • Re: Why dynamic allocation for Option objects?Warren Young6 Jun
    • RE: Why dynamic allocation for Option objects?Kevin Regan11 Jun
      • Re: Why dynamic allocation for Option objects?Jonathan Wakely11 Jun
        • RE: Why dynamic allocation for Option objects?Kevin Regan13 Jun
          • RE: Why dynamic allocation for Option objects?Kevin Regan13 Jun
          • Re: Why dynamic allocation for Option objects?Jonathan Wakely13 Jun
            • RE: Why dynamic allocation for Option objects?Kevin Regan14 Jun
              • Re: Why dynamic allocation for Option objects?Jonathan Wakely14 Jun
                • RE: Why dynamic allocation for Option objects?Kevin Regan14 Jun
                  • Re: Why dynamic allocation for Option objects?Jonathan Wakely15 Jun
                    • RE: Why dynamic allocation for Option objects?Kevin Regan15 Jun
                      • Re: Why dynamic allocation for Option objects?Jonathan Wakely15 Jun
              • Re: Why dynamic allocation for Option objects?Warren Young16 Jun
        • Re: Why dynamic allocation for Option objects?Warren Young16 Jun