Home » U++ Library support » U++ SQL » U++ SQL Begginer
Re: U++ SQL Begginer [message #17325 is a reply to message #17324] |
Thu, 07 August 2008 15:23 |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
Ahh, I just learned this, but there is only 1 SQL object being used in the background to manage all the sessions.
From sqls.h:
struct AppSql : Sql {
void operator=(SqlSource& s) { Assign(s); }
void Detach() { Sql::Detach(); }
AppSql() : Sql(NULLSQL) {}
};
AppSql& AppCursor();
#define SQL AppCursor()
When you make an Sql object, that sql object you make will actually call the global SQL object
For example, from sql.cpp:
Sql::Sql(const char *stmt) {
cn = SQL.GetSession().CreateConnection();
SetStatement(stmt);
}
The sqlite3 example you are referencing shows an alternate way of working with the sql packages, calling on the SQL object itself. Instead, to keep it all similar, do something like this:
Sqlite3Session m_session;
bool good_conn = m_session.Open("my_database_file.db");
Sql sql(m_session); //define Sql object to act on Session object m_session.
Notice how I used Sqlite3Session just like I used PostgreSQLSession in the tutorial example. Also, I passed the session to the Sql object as well. Here we used the Sql object's constructor instead of assigning the sqlite3 object to the global SQL object.
Sqlite3Session m_session;
Sql sql(m_session);
- instead of -
Sqlite3Session sqlite3;
SQL = sqlite3;
Sql sql;
Other than that, it should otherwise be all the same.
|
|
|
|
|
U++ SQL Begginer
|
|
|
Re: U++ SQL Begginer
By: captainc on Wed, 06 August 2008 16:41
|
|
|
Re: U++ SQL Begginer
|
|
|
Re: U++ SQL Begginer
By: captainc on Wed, 06 August 2008 18:28
|
|
|
Re: U++ SQL Begginer
By: captainc on Wed, 06 August 2008 22:33
|
|
|
Re: U++ SQL Begginer
|
|
|
Re: U++ SQL Begginer
By: captainc on Thu, 07 August 2008 15:23
|
|
|
Re: U++ SQL Begginer
|
|
|
Re: U++ SQL Begginer
By: mirek on Sat, 09 August 2008 14:12
|
|
|
Re: U++ SQL Begginer
By: captainc on Sat, 09 August 2008 20:26
|
|
|
Re: U++ SQL Begginer
|
|
|
Re: U++ SQL Begginer
|
|
|
Re: U++ SQL Begginer
By: mirek on Tue, 12 August 2008 16:14
|
|
|
Re: U++ SQL Begginer
|
|
|
Re: U++ SQL Begginer
By: captainc on Wed, 13 August 2008 22:08
|
|
|
Re: U++ SQL Begginer
|
|
|
Re: U++ SQL Begginer
By: captainc on Thu, 14 August 2008 16:46
|
|
|
Re: U++ SQL Begginer
By: mirek on Thu, 21 August 2008 16:52
|
|
|
Re: U++ SQL Begginer
By: captainc on Thu, 21 August 2008 19:51
|
|
|
Re: U++ SQL Begginer
By: mirek on Thu, 21 August 2008 21:16
|
|
|
Re: U++ SQL Begginer
|
|
|
Re: U++ SQL Begginer
By: captainc on Tue, 12 August 2008 13:19
|
|
|
Re: U++ SQL Begginer
|
Goto Forum:
Current Time: Tue May 14 05:43:45 CEST 2024
Total time taken to generate the page: 0.02787 seconds
|