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 #34842 is a reply to message #34831] Wed, 14 December 2011 11:03 Go to previous messageGo to previous message
mr_ped is currently offline  mr_ped
Messages: 826
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
well, after reading that tutorial myself I think your first version may work if you change connect:
bool sqltry::connect(String path)
{
	if (!sqlite3.Open(path))
	{
		return false;
	}
	sqlPointer = sqlite3;
}

And of course rename that sqlPointer to something more verbose, like "someDatabaseForThisAndThatSql", so when you read it two years later, you will get idea what is it good for.
(to get pointers you would need to start to use "*", "&" and new/delete where appropriate. I don't believe you want to do that in this case. Smile

edit - addition:
you can of course use fresh instances as needed even with multiple databases. I would maybe put the most used one into SQL, so then Sql instances for that one would be "Sql sql;", Sql instances for other databases would be created like "Sql sql(other_db_session);"

[Updated on: Wed, 14 December 2011 11:08]

Report message to a moderator

 
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: Sat May 10 21:33:04 CEST 2025

Total time taken to generate the page: 0.03079 seconds