Learn English – Any term for “If you already have it, use it, else, get it / create one”

word-request

Working with databases, I sometimes have to write requests which create data (alias add/insert…) or update it, if it already exists.

… and I never know how I should name such an action.

Isn't there some terms meaning specifically this ?

While it could help, I'm not particularly expecting something specific to database manipulation, but rather a more generic term, like "populate", "Ensure", "assert", or… well, I have no idea what term would have such meaning.

Is there anything meant for this ?

Best Answer

When writing code, I tend to use the word "write" in this case. When I do that, I try to use the word "read" as the opposite (getting information from the database). I've also been known to use "load" and "save", but the problem with "save" is that there is no "save as", so the concept of File / Open and File / Save doesn't always make things clear.

UPDATE:

I went searching and the technical term is "persist", as in you "persist" to a "datastore" (either a database or a file or anything else where data is stored). As far as I know, nobody has (yet) used persist to only mean "update" or "insert". It isn't as common as "save" or "write", and the technical meaning isn't one you'll find in most dictionaries, but at least it is a real English word that native speakers will know and understand.

"write" was used as "update" in file modes: r = read, w = write, a = append.

So I guess I had better go back and change write to persist in the code I wrote yesterday.

Related Topic