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   |
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. 
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
|
|
|
 |
|
sql session in a global variable?
By: Wolfgang on Tue, 13 December 2011 22:55
|
 |
|
Re: sql session in a global variable?
By: mr_ped on Wed, 14 December 2011 10:29
|
 |
|
Re: sql session in a global variable?
By: Wolfgang on Wed, 14 December 2011 10:33
|
 |
|
Re: sql session in a global variable?
By: mr_ped on Wed, 14 December 2011 11:03
|
 |
|
Re: sql session in a global variable?
By: mirek on Thu, 15 December 2011 08:29
|
 |
|
Re: sql session in a global variable?
By: Wolfgang on Thu, 15 December 2011 09:51
|
 |
|
Re: sql session in a global variable?
By: mirek on Thu, 15 December 2011 11:23
|
 |
|
Re: sql session in a global variable?
By: Wolfgang on Thu, 15 December 2011 11:26
|
 |
|
Re: sql session in a global variable?
By: mirek on Thu, 15 December 2011 11:56
|
 |
|
Re: sql session in a global variable?
By: Alboni on Thu, 12 September 2013 22:14
|
 |
|
Re: sql session in a global variable?
By: coolman on Fri, 12 June 2020 22:41
|
 |
|
Re: sql session in a global variable?
By: mirek on Sun, 14 June 2020 10:18
|
 |
|
Re: sql session in a global variable?
By: Wolfgang on Thu, 15 December 2011 11:58
|
 |
|
Re: sql session in a global variable?
By: mirek on Thu, 15 December 2011 12:49
|
Goto Forum:
Current Time: Sat May 10 21:33:04 CEST 2025
Total time taken to generate the page: 0.03079 seconds
|