Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DBStatement Execute() and Fetch() behavior...
OK. Well, that's a bummer, because that's going to require a good bit of magic behind the scenes to make that work. You can't destroy a connection object until you've cleaned up all of the statements that are open against it. Which, if you are just stopping the IDE and it has to clean up, it can't know these things.

So I guess I'm going to have to have the statement objects internally reference count their associated connection handles, so that it doesn't actually get destroyed until all the statements are destroyed that reference it, even if you destroy the connection object.

If I'd realized this, I probably wouldn't have even had a connection object and just let you connect via the statement objects and reference counted the connections behind the scenes. But, too late for that now. I guess I'll just document that the connection object is only required to create the statements and doesn't have to stay around necessarily once you've created any statements you want to create.
Dean Roddey
Explorans limites defectum
It's always something... :-)

You could just document the order-of-destruction issue... It may be good practice just to use local statement objects anyway...
I think it's probably a good thing to use non-local statements. They may be fairly heavy to setup and tear down internally. So I think it should be supported. And since there's no good way to report the failure to clean up (because it happens in a destructor) and because even if it's reported the actual object doesn't get cleaned up, it's probably best I deal with it correctly. The same issue could occur in a driver when it's loaded and unloaded.
Dean Roddey
Explorans limites defectum
OK, I did the connection handle reference counting thing, so this shouldn't be a problem. You can either destroy or call Disconnect() on a connection object before destroying the statements and it won't cause a problem.
Dean Roddey
Explorans limites defectum

Possibly Related Threads…
Thread Author Replies Views Last Post
  Odd LogicSvr behavior gReatAutomation 2 1,109 08-14-2019, 12:40 PM
Last Post: Dean Roddey
  Odd behavior of Admin interface Mark Stega 1 1,852 10-22-2017, 09:12 AM
Last Post: Dean Roddey
  Field Boolean Image behavior pinballmark 6 2,963 12-28-2015, 04:45 PM
Last Post: pinballmark
  Execute a macro from another macro? dlmorgan999 6 2,603 08-10-2015, 07:53 AM
Last Post: dlmorgan999
  New Exception Behavior 4.2.16? wuench 1 1,434 11-19-2012, 12:52 PM
Last Post: Dean Roddey
  Elk 5.2.8/M1XEP 1.3.28 firmware curious behavior Ishmael 3 2,406 12-06-2011, 11:00 PM
Last Post: Ishmael
  Execute actions on CQCStartup? SamVimes2 3 1,875 06-23-2009, 09:00 PM
Last Post: Dean Roddey
  Retrieving Date/Time fields with DBStatement jrlewis 9 2,544 05-30-2008, 10:37 AM
Last Post: jrlewis
  Unusual behavior & RDP rm1759 9 3,816 11-17-2007, 07:32 AM
Last Post: wuench
  DBStatement errors when field is empty jrlewis 5 2,372 09-04-2007, 10:39 PM
Last Post: Dean Roddey

Forum Jump:

Users browsing this thread: 1 Guest(s)