Edit field values with "SQL Addon"

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Edit field values with "SQL Addon"

Re: Edit field values with "SQL Addon"

by Andre_H » Thu Jan 28, 2021 12:50 pm

Ludek wrote: Thu Jan 28, 2021 11:49 am I guess this happens because the track is already loaded in the memory and shown in the user interface?
That's it. If i restart MMW on the "Pos1"-Node, execute my SQL, and then select the artist, the updates are there.

Thank's a lot!

Great Addon, btw.

[solved]

Re: Edit field values with "SQL Addon"

by Ludek » Thu Jan 28, 2021 11:49 am

I guess this happens because the track is already loaded in the memory and shown in the user interface?

The correct steps would be something like this:

Code: Select all

var list = app.db.getTracklist('SELECT * FROM Songs WHERE ID = 10409', -1);
list.whenLoaded().then(() => {
	listForEach(list, (item) => { 
		item.playCounter = 9;
	});
	list.commitAsync(); // saves the tracks to the database and tag
});

Edit field values with "SQL Addon"

by Andre_H » Thu Jan 28, 2021 2:30 am

Hi there,

i try to correct some data with the "SQL Addon". if i set a playcounter with

Code: Select all

UPDATE [Songs] SET [PlayCounter]=9 WHERE [ID]=10409
the value seems to be updated correctly in the database

Code: Select all

SELECT ID, AlbumArtist, Songtitle, PlayCounter FROM [Songs] WHERE [ID]=10409
shows "9". But the GUI still shows the old value "0", and it will be reset to "old value" +1 after the next playthrough.

Guess i'm doing it wrong?

Top