I'm trying to replace all my q3f history w/ q3w history, but failing.
Querying works:
sqlite3 places.sqlite "select url from moz_places where url like '%quake3forum%'"
(big list of q3f URLs)
But updating does not:
sqlite3 places.sqlite "update moz_places set url=replace(url,'quake3forum','quake3world') where url like '%quake3forum%'"
That fails w/ this error message:
SQL error: column url is not unique
I'm guessing there's a unique index on URL, and that update would cause a integrity violation. Does anyone know of a way to make sqlite ignore errors on a per row basis and continue on with the reset of the result set?
FF history & sqlite
-
- Posts: 4022
- Joined: Sat Mar 12, 2005 6:24 pm
Re: FF history & sqlite
Check it out, Fender: http://www.sqlite.org/lang_conflict.html
Re: FF history & sqlite
That would be awesome if it worked. I tried:
update on conflict replace moz_places set url=replace(url,'quake3forum','quake3world') where url like '%quake3forum%'
update moz_places on conflict replace set url=replace(url,'quake3forum','quake3world') where url like '%quake3forum%'
update moz_places set url=replace(url,'quake3forum','quake3world') on conflict replace where url like '%quake3forum%'
update moz_places set url=replace(url,'quake3forum','quake3world') where url like '%quake3forum%' on conflict replace
And they all gave me: SQL error: near "on": syntax error
This will probably work:
sqlite3 places.sqlite "update or replace moz_places set url=replace(url,'quake3forum','quake3world') where url like '%quake3forum%'"
Actually, I'll probably use the ignore clause, then delete all the quake3forum URLs that are left behind.
But I have to close my browser to run it and I have a web based build running that takes 15 minutes in our old crappy system. Takes 34 seconds in my CI environment.
/me waits impatiently
update on conflict replace moz_places set url=replace(url,'quake3forum','quake3world') where url like '%quake3forum%'
update moz_places on conflict replace set url=replace(url,'quake3forum','quake3world') where url like '%quake3forum%'
update moz_places set url=replace(url,'quake3forum','quake3world') on conflict replace where url like '%quake3forum%'
update moz_places set url=replace(url,'quake3forum','quake3world') where url like '%quake3forum%' on conflict replace
And they all gave me: SQL error: near "on": syntax error
This will probably work:
sqlite3 places.sqlite "update or replace moz_places set url=replace(url,'quake3forum','quake3world') where url like '%quake3forum%'"
Actually, I'll probably use the ignore clause, then delete all the quake3forum URLs that are left behind.
But I have to close my browser to run it and I have a web based build running that takes 15 minutes in our old crappy system. Takes 34 seconds in my CI environment.
/me waits impatiently
Re: FF history & sqlite
Awesome. All my q3f history has been replaced w/ q3w. 

-
- Posts: 4022
- Joined: Sat Mar 12, 2005 6:24 pm
Re: FF history & sqlite
The link I posted doesn't mention it explicitly but the UPDATE OR REPLACE syntax is what you want.
-
- Posts: 4022
- Joined: Sat Mar 12, 2005 6:24 pm
Re: FF history & sqlite
Heh. I start typing a post, bring some stuff to the kitchen, come back and hit submit and look what happens...