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 #34854 is a reply to message #34842] Thu, 15 December 2011 08:29 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
Ehm, I have created a reply here, but it seems I forgot to hit "Send".

Well, the problem here is that you cannot assign Sql nor SqlSession. It was a minor bug that copy constructor and operator= were not made private.

So what you can now is something like:

class sqltry
{
	public:
		typedef sqltry CLASSNAME;
		sqltry();
	private:
		Sqlite3Session sqlite3;
                One<Sql> sql;
		Sql& SQL() {
                    if(!sql)
                          sql = new Sql(sqlite3);
                    return *sql;
                }


...and then use SQL()...

 
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: Mon Jun 17 02:02:43 CEST 2024

Total time taken to generate the page: 0.02562 seconds