SQLite: Locating and restoring custom-defined cards

etm001

状元
Hi,

I'd like to revert all my custom-defined cards that have been linked to a dictionary entry back to their custom definitions. In SQLite, I used this command to locate these cards:

  • SELECT * FROM pleco_flash_cards WHERE pleco_flash_cards.defn NOTNULL AND pleco_flash_cards.dictid!=-1
This returned 487 results. I'd like to confirm this command is correct. If so, I'd like to confirm the SQL command to revert the cards to their original definitions. From what I can tell, custom cards by default have a value of -1 for dictcreator, dictid and dictentry, but I'm not sure if it's as simple as updating those values to -1.

Thanks!
 

mikelove

皇帝
Staff member
It is that simple, yes.

Any particular reason why you changed your mind about linking them? Asking because this will be a lot harder in future revisions of our database and I'd like to make sure the relevant need is covered somehow.
 

etm001

状元
Any particular reason why you changed your mind about linking them?

I'd like to keep the custom-defined cards as they were originally created (they usually are definitions provided in textbooks, etc.)

I should note that, given my current learning style, I'm 100% OK with creating duplicate cards. In this post the other day, I asked about adding duplicate cards when an existing custom card existed. I noted:
So I duplicated my issue, but I believe Pleco is working as designed. I found a custom-defined flashcard that only existed once in my database. I then searched for that term (曾參) which returned two results; one result was tagged with the category label assigned to the custom card, the other result was not. Selecting a dictionary entiry for the non-tagged result created a duplicate card, and the custom-defined card remained unaltered. Selecting to add a new card from the tagged result created a duplicate card, but the custom-defined card was also updated (the icon was the + sign with a dotted box around it, meaning a flashcard card exists but not in the current default category if I recall correctly).

And then asked:
Is it possible to choose a dictionary entry in a tagged result, create the duplicate card, and not have it change the custom-defined card?

I have both "Duplicate (in cat)" and "Duplicate (not cat)" set to "Create new card" in flashcard settings.

It's not the end of the world if a custom card is linked to a dictionary entry - I just reset the definition as I encounter these cards, but given my huge pool of cards and/or how I focus on subsets of my pool, I might not come across one of these cards for a very long time.
 

Shun

状元
Hi,

currently I achieve the same thing by importing the custom-defined flashcard from a text file and enabling "Store in user dict". Since you can switch your flashcards back and forth between user dictionaries and other dictionaries (or return them all to user dictionary definitions using Batch), you never have to worry about losing custom definitions.

Since I use the system a lot, allow me to make a gedankenexperiment about the next version:

In a future release of Pleco, I think user dictionaries will still be possible, but they will be create-once, read-only and very fast. If you only have a "monolithic flashcard database" with parts of it acting as a dictionary, what would perhaps be needed is a way to protect cards with custom definitions inside those directories in the database from accidental edits (from the [+] button, or later imports). If you have this structure,

Flashc. structure.png


the distinction between protected and unprotected shouldn't come into play when a user edits a card directly. But when a user tries to add a card from a regular dictionary using the [+] button or imports a card that already exists in the protected part, there should be a mechanism preventing this. Then, the newly added card will have to be saved as a duplicate in the unprotected part. If the card isn't a duplicate, they should easily be able to import new custom definitions into the protected part. If a card in the protected part only links to a regular dictionary, it should also be replaceable without warning. Did I think it through correctly, or am I missing something?

I think this is the most important need, that custom data entered by the user are never obscured and remain easily accessible.
 
Last edited:

mikelove

皇帝
Staff member
@etm001 - Sorry, I somehow missed this the first time I read that message from you but I think this actually is a bug; the old definition should not be changed in this case.

@Shun - Yes, in the new system it should be even harder to delete custom data by accident.
 

etm001

状元
Sorry, I somehow missed this the first time I read that message from you but I think this actually is a bug; the old definition should not be changed in this case.

I'm still experiencing this problem in the latest version of Pleco. I don't mind running an SQL command to reset the custom definitions, but will this bug ever get fixed?
 

mikelove

皇帝
Staff member
It's proven to be a bit hairier to fix than we'd like - it'll certainly go away in 4.0 but not sure if we'll manage to fix it before then since AFAIK you're the only person who's experienced it so far.

There's actually a batch command to do to this fix now - 'restore hidden custom definitions' in Edit / Batch - so that might save a little time at least.
 
Top