Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Feb 2015 14:59:24 +0100
From:      Rolf Nielsen <rmg1970swe@gmail.com>
To:        Polytropon <freebsd@edvax.de>
Cc:        User questions <freebsd-questions@freebsd.org>
Subject:   Re: Batch editing an SQLite db
Message-ID:  <54E0A63C.4080504@gmail.com>
In-Reply-To: <20150214023305.fab9370d.freebsd@edvax.de>
References:  <54DE6371.4070609@gmail.com> <20150214023305.fab9370d.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 2015-02-14 02:33, Polytropon wrote:
> On Fri, 13 Feb 2015 21:49:53 +0100, Rolf Nielsen wrote:
>> I recently changed from one ROM to another on my Android phone.
>> The old one and the new one use different mount points for the
>> external SD card, and because of this the music playlists I've
>> painstakingly created are utterly useless. The player refuses to
>> even open them, because the files in them are non-existent. These
>> are SQLite database files, and I've been able to open them with
>> the SQLiteEditor app for Android, but I've not found an option to
>> replace all occurances of a string with something else. I have
>> eight playlists with some 500 songs each, so editing them
>> manually would be tedious. Is there something in the ports tree
>> that can do this? SQL isn't a language I speak fluently, so I'd
>> need some pointers as well. Basically I need to substitute
>> "sdcard1" for "extSdcard".
> 
> Do you have r/w access to the database file and a SQLite 
> installation you can use? Then you can use its replace() function
> with an UPDATE command:
> 
> UPDATE <tableneme> SET <entry> = replace(<entry>, 'sdcard1',
> 'extSdcard') WHERE <entry> LIKE '%sdcard1%';
> 
> Here <tablename> is the name of the table which contains the
> playlist entries, and <entry> is the "column name" under which
> playlist entriy paths are stored.
> 
> "Sadly", I don't have to mess with SQL regularly anymore. So not
> tested. :-)
> 
> 

I have now tried, and I'm happy to report that you saved not only my
day or even week, but my whole year. Thanks. :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJU4KYuAAoJEPJMW41Co4Jg1ukQAJDvYTt1pM603GDS4JX5VHku
EvEmxfwFC06oCkOM8d10qZJJu36t5JbHNZ8QGvRJHWjFwIBCq4eKust6r2U85cFi
skkw65C1O/6prHRRTzLuIaknmcyyrj/chBFt/11qOhYuheeSC93CMUQUBxGHpY0i
O7e8X6KZcTDA2CGBRIfqCl+GugBvtqKffoDjGcKzmVdtfWo7DY+tY+9MHNEG0Qag
xhv5jZq4Bq+XzTROOG93tNQemrEFcMwYATCjjaS44KPSdrLbh1AWpEVO+eHrQ6+D
epSBt24o6JR/9dMXeFdRP4hoQjItcObrL7+B2fnJSLqaVlwcDOJSs07ps75x/wer
oeqV38tfvcsEpUeXb5S0FN8pWc9JJ3Q87WBIHv8CBZw3cszV/cte3xvHJI8v7Unp
LNctS1+vGsFt5GENqKomZdKTn91v/xSiGsEgWAqwRp2EOl9wA5vweGHy468hpHX2
UaXqaBHejA5Av0GjYCjgJB+vyQzESXY7oruQmjkLeIKjrXR/KGQntKK2P214aGAN
FN4a8SVeWGs1TVtypluOuHrAkcrdQmURGzO1MqFy7HE+k1jE9G0E9kyB9yjnxG5L
JMi5NGBUrclMTWqjyxQ3Yoi/w43V8SuknoMQ6D9Wn72+SXTGiKEhNNYIKwrSPfb6
lBHOsMU2b2yfWHZx3scC
=vO/v
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54E0A63C.4080504>