ODBC (Open Database Connectivity) database abstraction layer or API for XBMC?
#46
ccMatrix Wrote:I was just over at sourceforge to vote in the community choice awards, and found the following project:
http://cppdbc.sourceforge.net/

Maybe this could be useful for XBMC?

Ya, I did the same thing ... going through the sourceforge projects .. and I found it too, I am taking a look at it
Reply
#47
ccMatrix Wrote:I was just over at sourceforge to vote in the community choice awards, and found the following project:
http://cppdbc.sourceforge.net/

Maybe this could be useful for XBMC?
Sounds good at first glance at the project summery:

http://cppdbc.sourceforge.net/
Quote:This is the C++dbc project.

Its goal is to provide several database connectivity APIs (like MySQL, SqLite, ODBC and so on) for developers of C++ under a single API, that is easy to use and extensible for further APIs.

http://sourceforge.net/projects/cppdbc/
Quote:A C++ database connectivity class library supporting different database management systems under a simple interface. The API is hiding implementation details from developers, so class usage is same for each database management system.

Though it seems to be a new project with only two developers, and the development status is listed as "Alpha", so one has to question how much work it will be to maintain it is if the upstream developers ever abandon that project(?), ...it is also listed as "Operating System : All 32-bit MS Windows (95/98/NT/2000/XP)" however it might still be portable? Also no documenation other than this diagram?
http://cppdbc.sourceforge.net/imgs/diagram1.jpg

Again, remember that XBMC has to run on Linux/Mac/Windows OS and x86/AMD64/PPC/ARM CPU.
Reply
#48
Gamester17 Wrote:...it is also listed as "Operating System : All 32-bit MS Windows (95/98/NT/2000/XP)" however it might still be portable? Also no documenation other than this diagram?

I saw that too after posting, it can't be used for xbmc.

LibDBI and OpenDBX are looking pretty good at the moment, but I need to look in more detail at the lower level interface to know what sort of dependencies it has to know if it is suitable for xbmc to support cross platform.
Reply
#49
Smile 
So, this is my first post, so go easy. I'm new to XBMC (MythTV user) but enjoy xbmc as a slimmed down, simpler (prettier) interface when I'm not using mythtv. Also, my roommates and guests use xbmc. That being said, I think this iniative is huge and would like to help where I can. It's been a while since I coded in C/C++ but I think I could pick it back up.

From earlier:
Soju Wrote:Application --> ADO --> ODBC --> Database

ADO is microsoft specific, but it's the right concept.

Ideally the application should make all data requests through an API. The API then interprets these requests differently depending on the setup.

Quote:For example, if you wanted to retrieve all the video sources, there would be an API call for this. It would probably get passed the profile name or id.

So, in the case of sqllite, it would search the appropriate db for that profile and return the sources. For an ODBC connection, it would probably run a query joining the profiles table to the video_sources table. That way you could use best practices in RDBMS and keep simplicity with sqllite.

Seeing this is a big task to take on, I think the first step would be to abstract the current sqllite calls into an agreed-upon api. For starters we would need to determine which functions are needed, what parameters are passed, and what values are returned.

Once the API is created, thoughts about creating a second ODBC backend to the API will become a more realistic goal.

Anyone want to help me start? Nod
Reply
#50
It's an even larger task than you're probably thinking it is. Something to be mindful of is that "standard SQL" ain't, and that just making an abstraction layer removing sqlite objects and replacing them with generic objects probably won't cut it. As it is now, XBMC already uses an abstraction layer (dbiplus), which only happens to have a sqlite implementation.

Sure, making it be able to point to any database library is a task, but going through and checking every hand-built SQL statement in XBMC for compatibility against all database libraries is even bigger. Not that I'm trying to discourage anyone from implementing this, because I'd like to see it, but I think you're going to find that replacing dbiplus::DataSet with FooDataSet is the easiest part.
Reply
#51
also we're looking into replacing sql database usage with a document store thingie instead
Reply
#52
@CapnBry: If only!!

I agree, it is a sizable task that would require significant code changes. I have some ideas on how to implement it. I'll take some time to play around with my ideas and attach a small patch for proof of concept / review of approach.

@spiff: Can you explain this more or point to a forum thread. I'd love to know more.
Reply
#53
no posts written up on it just yet. i can't recall what the thingie was called, basically
you query over http and get json returned. mdd/jmarshall was looking at it at devcon and it looked quite promising.

stay tuned Wink
Reply
#54
That's what I get for missing devcon, was there also punch and pie?
Reply
#55
I have been reviewing the XBMC code. There appears to be a database abstraction layer in XBMC already. It appears the original intent was to be able to support other databases, there is in fact references to Mysql. There are hooks to be able to supply a host address, userid and password for the database to the abstraction layer.

The SQL statements used in the XBMC code are fairly generic and should be able to remain as is and then translated to the appropriate database specific sql syntax. This is what the data abstraction libraries discussed previously do anyway.

The main alteration to the code will be to modify the video/music/program/view database code to support passing a database address, userid and password to the current abstraction layer instead of assuming an sqlite file name. And to provide settings in the GUI to set the database type (sqlite or mysql), userid and password. Second would be to create a driver for mysql based on the current XBMC sqlite driver code.

My current intention would be to expand the current XBMC data abstraction layer to support a networked database (mysql) rather than incorporating some other API. At this stage I don`t think we need to incorporate one of the data abstraction api`s previously discussed, but I may borrow some driver code from there.
Reply
#56
The db alternative discussed at the XBMC DevCon was the use of CouchDb for the video library:
http://en.wikipedia.org/wiki/CouchDB
http://couchdb.apache.org

Essentially it's a document based distributed storage system. Thus, multiple clients are automatically kept in sync across the network.

Views (written in javascript) are then placed over the top, and are indexed/cached. They're also documents, so view creation on one client is propogated to the rest.

You communicate with the db over http and get json results. There are also API's for various languages, C/C++ not being one of them, however.

Essentially we're in an exploratory phase: It seems to be well suited (we don't really use the relational side of the db all that much, after all) to our needs, but the main question is whether or not it can do all we want and can return results fast enough to be useful. If it does, then the problem of concurrent databases on multiple clients is solved. You also get full editting of the database from any web browser.

You need an Erlang daemon running, but that shouldn't be of any major issue I should think.

If anyone wants to help out at the exploratory phase, give me a shout. Essentially we need to:

1. Setup an example db with a bunch of documents with whatever fields we want.
2. Setup a bunch of views to give us what we have today.
3. Look at how easy/hard it is to generate dynamic views for smartplaylists and the like - perhaps they can simply be generated directly based on input from the UI and be kept in the db rather than hanging on to their XML descriptions?

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#57
jmarshall, so has it been decided to go in that direction instead for XBMC?

I ask because I don't want to spend time working to expand the current database abstraction code for mysql, if in the end it won't be incorporated.
Reply
#58
No, it's been decided to investigate it. If it turns out we can do everything we want to with it, with acceptable performance, then yes, I believe we will go with it.

If it turns out to not do what we want, or doesn't have the performance we need, then we'll drop the idea.

In either case, the Music Library is likely to stay as-is for the foreseeable future.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#59
Ok, then I will continue my efforts to update the existing database code.
Reply
#60
jmarshall Wrote:In either case, the Music Library is likely to stay as-is for the foreseeable future.

Why so?

Also, reading more about CouchDB and its decentralized nature. How does it know where the other hosts are located?
Reply

Logout Mark Read Team Forum Stats Members Help
ODBC (Open Database Connectivity) database abstraction layer or API for XBMC?2