Created
May 27, 2010 05:49
-
-
Save lukesutton/415513 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dolt.procedure do | |
name :get_jammy | |
single_parition true | |
partition_info "Reservation.FlightInfo", 0 | |
sql :number_of_seats, %{ | |
SELECT NumOfSeats, COUNT(ReserveID) AS SeatsInUse | |
FROM Flight AS F, Reservation AS R | |
WHERE F.FlightID=R.FlightID AND R.FlightID = ?; | |
} | |
run do | |
queue :number_of_seats, :flight_id | |
execute | |
abort_if_empty! | |
set :seats, table(0, 0, "NumOfSeats") | |
set :in_use, table(0, 0, "SeatsInUse") | |
returns subtract(:in_use).from(:seats) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stack = [] | |
stack << [:queue, :number_of_seats, :flight_id] | |
stack << [:execute] | |
stack << [:abort_on_empty] | |
stack << [:returns, [:subtract, [:table, 0, 0, "SeatsInUse"], [:table, 0, 0, "NumOfSeats"]]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment