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 » Community » Newbie corner » Separate Database Access code
Re: Separate Database Access code [message #38838 is a reply to message #38830] Tue, 22 January 2013 21:46 Go to previous messageGo to previous message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

Yes, you are right. It will work using one of your solutions. But:

1 - Re-affacting the value of SQL is dangerous. Developing an application, you will have to re-affect the right value before any use of SQL, as you will not be sure if it has been used by the library. Not very clean and bugs could be numerous !

2 - Making a DLL is a better solution. But as I want this library to be multi-platform, it will not be very easy. A simple U++ library that you add in a project is a lot easier to do !

The U++ documentation says :
Quote:

Most applications need to work with just single database backend, therefore repeating SqlSession parameter in all Sql declarations would be tedious.

To this end U++ supports concept of "main database" which is represented by SQL variable. SQL is of Sql type. When any other Sql variable is created with default constructor (no session parameter provided), it uses the same session as the one the SQL is bound to. To assign session to global SQL, use operator=:

If I understand well :
- It is possible to work with several databases,
- To work with another database than the "main database" (the one in my library is a secondary one), I must create sql variables with session parameter provided.

It's just what I'm trying to do... with no succes !
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to Draw without overriding Paint?
Next Topic: Deploying U++ Application
Goto Forum:
  


Current Time: Sat Apr 27 00:59:27 CEST 2024

Total time taken to generate the page: 0.03890 seconds