Results 1 to 4 of 4

Thread: design pattern for supporting multiple DB's?

  1. #1
    Join Date
    Jun 2010
    Location
    Cincinnati, Ohio, USA
    Posts
    92
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question design pattern for supporting multiple DB's?

    Up to this point my whole system has been Windows based using technologies other then Qt. I have started working on a Qt module which will ultimately go cross platform. One of the other things it is going to do is support two databases, both SQLite and Firebird. I do plan to keep as much of the DB simiar as possible, but there are a few syntax issues and feature differences. Can anyone suggest a good design pattern/approach to supporting both DB's?

    FYI: In time I might support additional DB's, ideally I would like to implement things in away that does not lock me into a fixed number of DB's.

    Sam

  2. #2
    Join Date
    Jun 2010
    Posts
    23
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: design pattern for supporting multiple DB's?

    Why would you like to use multiple dbs? Additional it is useful to know for what job you use the dbs.
    Stelios: What the hell are you laughing at?
    Astinos: Well, you had to say it!
    Stelios: What?
    Astinos: "Fight in the shade"!
    -------------------------------------------
    If my answer has helped you, i would appreciate it if you use the thanks button.

  3. #3
    Join Date
    Jun 2010
    Location
    Cincinnati, Ohio, USA
    Posts
    92
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: design pattern for supporting multiple DB's?

    Why use multiple databases? Very simple, I have different levels of my software. The basic version only needs basic features, all of which are provided by SQLite. The more advanced versions need more advanced features provided by client/server style DB's.

    This is the same theory behind what both Microsoft and Oracle have done: They have one super light DB designed to be embedded and is normally free, to compete with folks like SQLite. But then using the exact same code base, it can scale to an enterprise wide system with the big expensive DB's.

    I need to be cross platform, so both Microsoft is not viable options, the enterprise option only needs like 10~20 clients so something like Oracle simply isn't cost effective. On the other hand, SQLite and Firebird are perfect solutions. Now I just need to figure out how best to implement the Qt code to handle both versions of the DB.

    I started to look at the Bridge pattern, but got pulled away from that before I could really get into it. At the offset, it looks like overkill. Not quite sure at this point.

    Sam

  4. #4
    Join Date
    Jun 2010
    Posts
    23
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: design pattern for supporting multiple DB's?

    I would propose you to use the "Data Access Object" Pattern, it is original designed for java. But it seems to me, that you have the ability to adept it to c++.
    Last edited by CeeKey; 4th June 2010 at 17:28.
    Stelios: What the hell are you laughing at?
    Astinos: Well, you had to say it!
    Stelios: What?
    Astinos: "Fight in the shade"!
    -------------------------------------------
    If my answer has helped you, i would appreciate it if you use the thanks button.

Similar Threads

  1. Three Tier Database Programming - Design Pattern
    By sunil.thaha in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2011, 04:00
  2. GIS design pattern
    By olosie in forum Qt Programming
    Replies: 2
    Last Post: 19th May 2009, 16:19
  3. Replies: 3
    Last Post: 5th October 2008, 23:41
  4. Observer Design Pattern
    By joseph in forum General Programming
    Replies: 1
    Last Post: 21st January 2008, 12:17
  5. QTable Column width supporting fonts
    By kommu in forum Qt Programming
    Replies: 7
    Last Post: 27th December 2007, 11:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.