[sqlite] Question regarding use of REPLACE

2016-01-07 Thread audio muze
I'm trying to get some consistency in the contents of a field in a
table. To do so involves multiple updates using REPLACE.

Is it acceptable to make multiple calls to replace involving the same
field in a single update operation, like so:

UPDATE audio SET
composer = REPLACE( composer, " / ", "\\" ),
composer = REPLACE( composer, " , ", "\\" ),
composer = REPLACE( composer, ", ", "\\" ),
composer = REPLACE( composer, ",", "\\" ),
composer = REPLACE( composer, "\\Jr.\\", ", Jr.\\" ),
composer = REPLACE( composer, "\\Jr\\", ", Jr.\\" )
;


[sqlite] Question regarding use of REPLACE

2016-01-07 Thread Simon Slavin

On 7 Jan 2016, at 4:49pm, audio muze  wrote:

> Is it acceptable to make multiple calls to replace involving the same
> field in a single update operation, like so:
> 
> UPDATE audio SET
>composer = REPLACE( composer, " / ", "\\" ),
>composer = REPLACE( composer, " , ", "\\" ),
>composer = REPLACE( composer, ", ", "\\" ),
>composer = REPLACE( composer, ",", "\\" ),
>composer = REPLACE( composer, "\\Jr.\\", ", Jr.\\" ),
>composer = REPLACE( composer, "\\Jr\\", ", Jr.\\" )
> ;

There is nothing that bans it, but there is no way to know in which order the 
operations are done.  One often sees something like this:

UPDATE audio SET
   composer = REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( composer
, " / ", "\\" ),
, " , ", "\\" ),
, ", ", "\\" ),
, ",", "\\" ),
, "\\Jr.\\", ", Jr.\\" ),
, "\\Jr\\", ", Jr.\\" )
;

Simon.