On 5/24/07, Ed Murphy <[EMAIL PROTECTED]> wrote:
root wrote:

> On 5/24/07, Ed Murphy <[EMAIL PROTECTED]> wrote:
>> root wrote:
>>
>> > On 5/24/07, comex <[EMAIL PROTECTED]> wrote:
>> >> On 5/24/07, Ian Kelly <[EMAIL PROTECTED]> wrote:
>> >> > BEGIN TRANSACTION;
>> >> >
>> >> > UPDATE RULE 106
>> >> > SET TEXT = 'SQL script'
>> >> > WHERE TEXT = 'document';
>> >> >
>> >> > COMMIT TRANSACTION;
>> >>
>> >> Query OK, 0 rules affected (0.00 sec)
>> >> Rules matched: 0  Changed: 0  Warnings: 0
>> >
>> > I beg to differ; you seem to be assuming a different database
>> > organization. It seems more useful to me in this context to have rules
>> > be modeled as tables rather than rows.
>>
>> Why?  Are cursors around the corner?
>
> Mainly because it allows for the above syntax rather than having to
> resort to all sorts of messy string manipulations.

What messy string manipulations?

update rules
set text = replace(text,'old','new')
where number = 106

Well, that wasn't a good example.

update rules
set text = replace(replace(replace(replace(replace(replace(text,
'old', 'new'), 'Old', 'New'), 'long paragraph that takes up several
lines', 'even longer replacement paragraph'), 'foo.', 'foo. BobTHJ
wins the game.'), 'random text', 'more random text designed to hide
the fact that BobTHJ wins the game'), ...)
where number = 106

Granted, you could still do that with a series of statements if you so
desired, but my way pretty much forces it. I see this as a good thing.

Also, imagine if somebody were to mistakenly (or not) leave off the
where clause, and nobody noticed.

-root

Reply via email to