levo

Building a Desktop Solution with a Database

Saving changes and protecting the data

  • 3 things to know
  • A2 Unit 2
Start revising · £5/month

Overview

Optimistic concurrency and pessimistic concurrency.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

Why should a save of several related tables run inside a transaction?

Key term

What must be done to protect the data before the solution is handed over?

Key term

What happens when a user presses Save on a bound form?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What happens when a user presses Save on a bound form?

    Model answer

    The current edit is ended so the control writes its value, the data set is validated, the adaptor is asked to update, and if that succeeds the changes are accepted so the rows count as unchanged again.

  2. 2

    Why must the changes be accepted only after a successful save?

    Model answer

    Accepting marks every row unchanged and discards the record of what it was, so accepting before the save succeeds would lose the changes the adaptor still had to send.

  3. 3

    Why should a save of several related tables run inside a transaction?

    Model answer

    Because the tables must agree: saving an order without its lines, or lines without their order, leaves the database in a state the design forbids. A transaction makes all the changes take effect or none.

  4. 4

    In what order are related tables saved, and why?

    Model answer

    Parents are inserted before children and children are deleted before parents, so a foreign key never points at a row that does not exist yet or has already gone.

  5. 5

    What is optimistic concurrency?

    Model answer

    Optimistic concurrency allows several users to read the same row and detects a clash only when a change is saved, by requiring the row still to hold the values it had when it was read.

  6. 6

    What is pessimistic concurrency?

    Model answer

    Pessimistic concurrency locks a row when a user starts editing it, so nobody else can change it until the lock is released. It prevents clashes but holds locks for as long as a user takes to type.

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A null is the of one.
absencepresencetype

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Building a Desktop Solution with a Database, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.