On 9 Mar 2014, at 10:05pm, Tim Streater <t...@clothears.org.uk> wrote:

> I have a table with one column containing file paths, such as /path/to/file 
> and /path/to/my/otherfile. Now I want to change all entries where the path 
> starts as /path/to/ to /path/from/. Getting a candidate list is easy, and I 
> can then make the changes in PHP and rewrite the rows, but I wondered if 
> there was a clever way to do it all in SQLite in, essentially, one statement.

Check out REPLACE():

<http://www.sqlite.org/lang_corefunc.html>

Technically speaking this might mess up if the string '/path/to/' occurs in the 
middle of the string as well as at its beginning, so you might do some paranoid 
testing if you think this may occur.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to