Page 10 of 17
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Mon Oct 20, 2008 7:51 am
by Bex
Actually, I've read somewhere in the SQLite documentation that "Beatles" doesn't mean exactly the same as 'Beatles' I don't remember the exact difference but if it is a text string you're having then the proper syntax is 'Beatles'. If you're having a ' in your text string simply escape it an extra ' like this: 'Mark O''Connor'
Both syntaxes give the same result but "Beatles" can sometimes be much slower.
LIKE should only be used together with % or _ otherwise = should be used:
LIKE 'Beatles' gives the same result as = 'Beatles'
LIKE '% Beatles' gives both Beatles and The Beatles
= is always
much faster than LIKE since it can use indexes which LIKE can't
Lots of great editors in the middle of the page here:
http://www.mediamonkey.com/wiki/index.p ... %26_Tricks
I use Crimson editor since I'm used to it, but it's not as good as the others.
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Mon Oct 20, 2008 8:29 am
by Owyn
Thanks for the info.
I will test out the search criteria carefully as the same criteria will also be used on Original Artist and Composer in the script.
Just added a note to my pseudo code to sanitize search string. Not just eliminate prefix.
FYI: Did a quick scan of the editors and decided on:
Notepad++
Programmers Editor
http://www.download.com/Notepad-/3000-2 ... d=10800351
http://notepad-plus.sourceforge.net/uk/site.htm
FOSS, lightweight, and seems to have the basic features I need to munch VBScript code.
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Mon Oct 20, 2008 5:04 pm
by Big_Berny
I also use Notepad++ for my scripts as it works great for VBS-coding.
And I strongly recommend the addon "Function List" which shows the different Functions and Subroutines in a list so that you easily can jump to them in the code. Long sentence... Maybe it's easier to have a look at the screenshot.

EDIT: Sorry for talking off-topic. Didn't saw that the topic is SQL-Viewer.
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Mon Oct 20, 2008 5:07 pm
by nynaevelan
Hi Bex:
I am having trouble with a simple update statement, any idea why it won't work?
Code: Select all
UPDATE Songs SET Lyrics ='' WHERE Lyrics = '[Lyrics Test]'
Nyn
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Mon Oct 20, 2008 6:53 pm
by Owyn
Big_Berny wrote:EDIT: Sorry for talking off-topic. Didn't saw that the topic is SQL-Viewer.
No problem as far as I am concerned. That was a good tip about the Function Lister plugin.
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Mon Oct 20, 2008 9:15 pm
by Bex
nynaevelan wrote:Hi Bex:
I am having trouble with a simple update statement, any idea why it won't work?
Code: Select all
UPDATE Songs SET Lyrics ='' WHERE Lyrics = '[Lyrics Test]'
Nyn
That looks good to me. In what way doesn't it work?
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Tue Oct 21, 2008 5:03 am
by nynaevelan
It doesn't do anything, it flashes for a second but it doesn't update the field.
Nyn
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Tue Oct 21, 2008 5:14 am
by Bex
Then you don't have any lyrics = [Lyrics Test]
What does this give you:
Code: Select all
SELECT ID, SongTitle, Artist, Lyrics FROM Songs WHERE Lyrics = '[Lyrics Test]'
Btw, when you run Update statements (Update, Drop, Insert, etc) use the button "Execute DDL/DML tatement"
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Tue Oct 21, 2008 12:32 pm
by nynaevelan
Bex wrote:Then you don't have any lyrics = [Lyrics Test]
What does this give you:
Code: Select all
SELECT ID, SongTitle, Artist, Lyrics FROM Songs WHERE Lyrics = '[Lyrics Test]'
That is working.
Bex wrote:Btw, when you run Update statements (Update, Drop, Insert, etc) use the button "Execute DDL/DML tatement"
This is probably why I wasn't getting anything. As soon as I used the right button, I was getting the results I was expecting. Thanks again...
Nyn
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Tue Oct 21, 2008 1:19 pm
by Bex
Yeah, I've sen that some DML statements (Data Manipulation Language) works with the SELECT button but always use the other one for these.
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Tue Oct 21, 2008 5:37 pm
by Mizery_Made
Went into Tagging Inconsistencies a little bit ago and realized there were a few tracks that slipped through your earlier Update Playcount statement, Bex. It seems your statement didn't account for tracks which have a playcount, but have no entry in the Played table. TI is showing 8 tracks which have a playcount of 1, that is off by 1, and 3 which show a playcount of 2 with a difference of 2. Got something that would easily do these?
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Tue Oct 21, 2008 5:47 pm
by Bex
That's actually another problem (it's the opposite). But install my Add/Remove Playstat Script and use the function "Add Plays". It can create the missing history plays for you. It works on single tracks only so you have to do it eight times.
http://www.mediamonkey.com/forum/viewto ... =2&t=31809
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Fri Dec 12, 2008 3:35 pm
by Owyn
Bex:
Ludek is raising some issues about whether the SQL Viewer script is stable in 3.1.
See in this beta
topic.
I don't think there is a problem, but, you could make a better call than I can.
Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Fri Dec 12, 2008 11:33 pm
by Bex
Download link fixed!

Re: SQL-Viewer 2.3 [Script] 2008-05-15 [MM3]
Posted: Fri Dec 12, 2008 11:37 pm
by Bex
Owyn wrote:Bex:
Ludek is raising some issues about whether the SQL Viewer script is stable in 3.1.
See in this beta
topic.
I don't think there is a problem, but, you could make a better call than I can.
There is no problem with this script in 3.1 (or in 3.0 for that matter). It simply only does what you tell it to do, just as any other SQL-tool.
I have a look in the other thread...