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

next in thread | previous in thread | raw e-mail | index | archive | help
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. :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150214023305.fab9370d.freebsd>