SDB.Database.OpenSQL Interator Issue

To discuss development of addons / skins / customization of MediaMonkey.

Moderators: jiri, drakinite, Addon Administrators

MyVikes
Posts: 34
Joined: Sun Jul 02, 2017 1:20 am

SDB.Database.OpenSQL Interator Issue

Post by MyVikes »

I get an error ("Exception:System.MissingMemberException: Public member 'EOF' on type 'String' not found.") on the While loop in MM5 and it works fine in MM4 using COM. Using a Console statement i can see i get an array of objects:

Code: Select all

Dim databaseIterator As Object

        Try
            SDB = CreateObject(ProgId)

            databaseIterator = SDB.Database.OpenSQL(sqlString)

            Console.WriteLine("databaseIterator:" & databaseIterator.ToString)

            While Not databaseIterator.EOF
                albumArtistIndexCollection.Add(
                    New Album(
                        databaseIterator.StringByName("ID"),
                        databaseIterator.StringByName("Album"),
Any suggestions what (or why it) might have changed as I thought it was supposed to be transparent?

Thanks!
Peke
Posts: 14285
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Re: SDB.Database.OpenSQL Interator Issue

Post by Peke »

Hi,
Looks like code is incomplete eg missing ) to close new album or I am missing something?
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum
MyVikes
Posts: 34
Joined: Sun Jul 02, 2017 1:20 am

Re: SDB.Database.OpenSQL Interator Issue

Post by MyVikes »

I did not post the full code...there is a close to the while loop. The issue is at the ".EOF" on the databaseIterator. It worked fine with MM4 but breaks with MM5 giving a "String' not found." error.
bensynnock
Posts: 12
Joined: Thu Oct 11, 2012 3:23 pm

Re: SDB.Database.OpenSQL Interator Issue

Post by bensynnock »

What happens if you change this code:

Console.WriteLine("databaseIterator:" & databaseIterator.ToString)

to

Console.WriteLine("databaseIterator:" & databaseIterator)

??

Can you verify that databaseIterator is the type of object that you think it is? The error message "Public member 'EOF' on type 'String' not found" implies that the object in question is of type 'String'.
MyVikes
Posts: 34
Joined: Sun Jul 02, 2017 1:20 am

Re: SDB.Database.OpenSQL Interator Issue

Post by MyVikes »

The databaseIterator has changed. It now returns a JSON array see here:

"data":[{"ID":"222", "ARTIST":"B.B. King", "ALBUM":"One Kind Favor", "YEAR":"20080000", "COMMENT":"", "TRACKS":"12", "YEAR":"20080000",...................

So i know the "fix". Basically convert the string to to array of json objects, loop on that....but i have several of these that have broken due to a change in what the databaseIterator is in MM5 versus what it was in MM4 (see here: https://www.mediamonkey.com/wiki/ISDBDatabase::OpenSQL ).

According to the document here, https://www.mediamonkey.com/wiki/Contro ... plications, it says "The SDBApplication class is largely unchanged from MediaMonkey 4...". So was the change intentional or unintentional? IF unintentional will it be corrected but if intentional than that statement needs to be updated in my app.

BTW...i've developed my own Android app that interacts with MM4 via a set of RESTful web services written in VB.Net which communicate with MM4 via COM. All very customized to how i listen to my rather expansive music collection. What I'm working to do now is to replace the web services with direct calls from the Android app to MM5 via web sockets and i'm making good progress but this is going to make me some time to do still.
bensynnock
Posts: 12
Joined: Thu Oct 11, 2012 3:23 pm

Re: SDB.Database.OpenSQL Interator Issue

Post by bensynnock »

I couldn't get the MM5 com object to work at all in vb.net (using visual studio 2019). I assume you got it to work, but how is yours set up?

I'd like to get it working, because otherwise I'll have to rewrite my apps, but maybe this is the push I need to get me to learn javascript.
MyVikes
Posts: 34
Joined: Sun Jul 02, 2017 1:20 am

Re: SDB.Database.OpenSQL Interator Issue

Post by MyVikes »

I have had it working with MM4 following the instructions here https://www.mediamonkey.com/wiki/Contro ... plications and i did nothing specific to MM5 except to change "SongsDB.SDBApplication" to "SongsDB5.SDBApplication" and it continues to work. This has been working well with MM4 for quite some time and except for the glitch with the iterator (purpose of the original post here) seems to work fine with MM5.

Did you have it working with MM4?
MyVikes
Posts: 34
Joined: Sun Jul 02, 2017 1:20 am

Re: SDB.Database.OpenSQL Interator Issue

Post by MyVikes »

Correction:
after taking a closer look at the Reference Manager i see i have added a MM5 specific library. these are the references i have in the project now:
"MediaMonkey Library" and "MediaMonkey Library" 5"
so maybe i added that and forgot. :D
Post Reply