Transaction Question

  • ID ID_User ID_Order ID_Room Date

    1 1 1 1 2010-01-01

    2 1 1 1 2010-01-01

    3 1 1 1 2010-01-02

    4 1 1 2 2010-01-01

    5 1 NULL 1 2010-01-01

    6 1 NULL 1 2010-01-02

    7 1 NULL 2 2010-01-01

    8 2 NULL 2 2010-01-02

    9 2 NULL 1 2010-01-02

    10 2 NULL 2 2010-01-01

    ..

    This is simpliefied table for room order. Rows with filled ID_Order is confirmed and rows with NULL in ID_Order is order in procces.

    Each room can have max 2 confirmed people for a date.

    When User 1 confirm his order in process (rows with ID 5,6,7), update dont finnish because row ID 5 not correspond with condition "ma 2 confirmed people for a date", but when I delete row 5 then update finished succesfuly.

    This table will be modify with many users at the same time.

    I need help with script, i think that i must you use transaction, but how and what isolation level?

    When one user start script other user must wait?

  • The question(s) you are asking cannot be answered properly without looking at the system design or an overall document describing the functional requirements of the system.

    One can't even be sure that the table shown here is an adequate element of a solution to the problem or to accomplish what you want to accomplish. Sorry, wish I could be of more help.

    The probability of survival is inversely proportional to the angle of arrival.

  • Will you ever have part of an order confirmed but the other part isn't? That seems illogical to me, but that's what this table allows.

    If an order will be confirmed all at once, then I'd move the confirmed column to the Orders table, out of this table.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • My first idea was that I store unfinnished records in another table, ok no problem.

    But still i have problem with inserting data from Unfinished table to FinnishedTable.

    I dont know how I need check condition 2 people in one room, and I am affraid concurency users.

    Sorry for my English

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply