Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » sql session in a global variable?
Re: sql session in a global variable? [message #34839 is a reply to message #34831] Wed, 14 December 2011 10:29 Go to previous messageGo to previous message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
Didn't try the sources, so just by quick reading it...

The "sql" in connect procedure is local variable, so it gets destroyed once it gets out of scope. I'm afraid this is making it's content invalid. The assignment to "sqlPointer", unless the Sql class has very clever copy constructor, will not help to preserve it. I'm too lazy to check actual Sql source, sorry. Wink

Anyway, I don't like the "sqlPointer" variable name, because it is not pointer, but an object, so the variable name is misleading.

I would suggest to completely remove sqlPointer class member variable, and create new instance of Sql every time you need it.

See http://www.ultimatepp.org/srcdoc$Sql$tutorial$en-us.html , especially step 2 may help you. After you set global "SQL", you can then get new instance by simple "Sql sql;" in your code.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Schema files, layouts
Next Topic: SqlArray with an Option
Goto Forum:
  


Current Time: Sun May 05 05:52:00 CEST 2024

Total time taken to generate the page: 0.02730 seconds