Hi Johnny,

On Sat, 2008-07-12 at 08:43 -0400, Johnny Handsome wrote:
> Hi guys,
>  
> I'm working on a db system for the library and so far I have mirrored
> the XML file system to a sqlite db.

You mentioned this database stuff on the forum earlier. Perhaps you can
explain what you've done and why you've done it? (Is library
loading/saving quicker?)

As one of the maintainers of Mixxx, a few concerns pops into my head
immediately:
1) I assume you're using QtSQL for this - What about the sqlite
dependency? Did you add sqlite.c (or whatever it's called) to Mixxx's
lib directory? How are you intending to manage this dependency?
(internal or external?)
2) How does the database schema work? If we change the database format,
will users have to rescan their entire libraries and lose extra stuff
they've added like comments and BPMs? 

>  
> the only thing is that i am passing the pointer of my DB object that I
> created in the main mixxx class, so i can be reused as need, and to
> eliminate opening the db every time it is needed.
>  
> It is currently defined as public in the mixxx class as:
>  
> Mixxx.h
>  
> public:
> QSqlDatabase     m_pPrimaryDB;
>  
> and then initialized in mixxx.cpp as:
>  
> bool MixxxApp::createDbConnection();
>  
> Can the pro developers, create a pointer to the main MixxxAPP class so
> that we can use a pointer to access global variables/functions in
> class MixxxApp as an example:
>  
> bool DlgBpmTap::SetBpm() {
>  
>   if (bpm > 0) {
>    // lets update the db with the new track value
>      if (theApp->m_pPrimaryDB) // check if db is good
>      {
>        m_pSQLquery.prepare(theApp->m_pPrimaryDB, "update tablname....)
>      }
>   }
> }
>  
> what do you guys think, can a guru implement this pointer to MixxxApp,
> as I have been failing miserilby, and it would extremely benificial
> and convinient for DB operations.

What you're proposing (a global instance pointer) is typically
implemented in C++ using something called the "Singleton" design
pattern. See this link for more information:
http://en.wikipedia.org/wiki/Singleton_pattern

While it does probably make sense for the MixxxApp class to be a
singleton class (you only ever want one instance to be around), I feel
like the way you've integrated SQL into Mixxx might be slightly awkward,
based on the code snippet above.

If you're replacing the XML system we have for the library, then I would
expect all the database operations would mimic the centralization of
loadXML and saveXML stuff in track.cpp.

However, if you're trying to replace Mixxx's internal runtime
representation of the library (something called a TrackCollection), then
you might want to have the database code in there. The data model behind
the track table/library view is a giant QList (populated from the
TrackCollection), and I feel like that should be changed to wrap a
TrackCollection instead.

Anyways, don't let my comments discourage you - Mixxx has a big codebase
that can be daunting at times. I would encourage you to keep hacking
away with the database stuff and eventually you might figure out a
better way to integrate it. Keep up the good work!

Thanks,
Albert


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to