levo

Building a Desktop Solution with a Database

Saving changes and protecting the data

  • 3 things to know
  • A2 Unit 2

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.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

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

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A null is the of one.
absencepresencetype

Blank Blitz makes facts automatic

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

AA null means no value has been recorded.
BZero and an empty string are values.
CA null is the absence of a value.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

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.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

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