# Attempt to find the most recent existing IP address for the client
#
alloc_existing = "\
- WITH cte AS (
+ WITH cte AS ( \
SELECT TOP(1) address, expiry_time, gateway \
FROM ${ippool_table} WITH (xlock rowlock readpast) \
JOIN fr_ippool_status ON ${ippool_table}.status_id = fr_ippool_status.status_id \
# Determine whether the requested IP address is available
#
alloc_requested = "\
- WITH cte AS (
+ WITH cte AS ( \
SELECT TOP(1) address, expiry_time, gateway \
FROM ${ippool_table} WITH (xlock rowlock readpast) \
JOIN fr_ippool_status ON ${ippool_table}.status_id = fr_ippool_status.status_id \
# find a free address
#
alloc_find = "\
- WITH cte AS (
+ WITH cte AS ( \
SELECT TOP(1) address, expiry_time, gateway, owner \
FROM ${ippool_table} WITH (xlock rowlock readpast) \
JOIN fr_ippool_status ON ${ippool_table}.status_id = fr_ippool_status.status_id \
) \
UPDATE cte \
SET expiry_time = DATEADD(SECOND,${offer_duration},CURRENT_TIMESTAMP), \
- gateway = '${gateway}' \
+ gateway = '${gateway}', \
owner = '${owner}' \
OUTPUT INSERTED.address \
FROM ${ippool_table}"