On Thu, Nov 1, 2012 at 11:21 AM, Gnome <[email protected]> wrote:
> After doing some cleaning in 'default.db_media' i have renamed one
> directory. Can I just search and replace the path name in 'default.db',
> after taking backup of course?

I ran into a similar problem: on ~150 flashcards, I had written
"<sound src=" rather than "<audio src=". Too many to fix by hand. I
think the following `sqlite3 default.db` transcript illustrates how
one could successfully update a deck:

    sqlite> .table
     card_types        data_for_fact     global_variables  partnerships
     cards             fact_views        log               tags
     criteria          facts             media             tags_for_card
    sqlite>
    sqlite> .schema cards
     CREATE TABLE cards(
             _id integer primary key,
             id text,
             card_type_id text,
             _fact_id integer,
             fact_view_id text,

             question text,
             answer text,
             tags text,

             grade integer,
             next_rep integer,
             last_rep integer,
             easiness real,
             acq_reps integer,
             ret_reps integer,
             lapses integer,
             acq_reps_since_lapse integer,
             ret_reps_since_lapse integer,
             creation_time integer,
             modification_time integer,
             extra_data text default "",
             scheduler_data integer default 0,
             active boolean default 1
         );
     CREATE INDEX i_cards on cards (id);
     CREATE INDEX i_cards_2 on cards (fact_view_id);
     CREATE INDEX i_cards_3 on cards (_fact_id);
    sqlite>
    sqlite> SELECT question FROM cards WHERE question like '%<sound %';
     <small><small>define:</small></small> extant (adj.) <sound
src="english/extant_1.ogg"/><sound src="english/extant_2.ogg"/><sound
src="english/extant_3.ogg"/><sound src="english/extant_4.ogg"/><sound
src="english/extant_5.ogg"/>

     <small><small>define:</small></small> gamut <sound
src="english/gamut_1.ogg"/><sound src="english/gamut_2.ogg"/><sound
src="english/gamut_3.ogg"/><sound src="english/gamut_4.ogg"/>

     <small><small>define:</small></small> glabrous
(<i>/'glæbɹəs/</i>; adj.) <sound src="english/glabrous_1.ogg"/><sound
src="english/glabrous_2.ogg"/><sound src="english/glabrous_3.ogg"/>
     ...
    sqlite>
    sqlite> UPDATE cards SET question = replace(question, '<sound', '<audio');
    sqlite> SELECT question FROM cards WHERE question like '%<sound%';
    sqlite>
    sqlite> UPDATE cards SET answer = replace(answer, '<sound', '<audio');
    sqlite> SELECT answer FROM cards WHERE answer like '%<sound%';

-- 
gwern
http://www.gwern.net

-- 
You received this message because you are subscribed to the Google Groups 
"mnemosyne-proj-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to