#
update_update = "\
UPDATE ${ippool_table} \
- SET expiry_time = DATEADD(SECOND,${lease_duration},CURRENT_TIMESTAMP) \
+ SET \
+ expiry_time = DATEADD(SECOND,${lease_duration},CURRENT_TIMESTAMP), \
+ counter = counter + 1 \
WHERE pool_name = '%{control:${pool_name}}' \
AND pool_key = '${pool_key}' \
AND framedipaddress = '%{%{DHCP-Requested-IP-Address}:-%{DHCP-Client-IP-Address}}'"
gateway varchar(15) NOT NULL default '',
expiry_time DATETIME NOT NULL default CURRENT_TIMESTAMP,
status_id int NOT NULL default 1,
+ counter int NOT NULL default 0,
CONSTRAINT fk_status_id FOREIGN KEY (status_id) REFERENCES dhcpstatus (status_id),
PRIMARY KEY (id)
)
#
update_update = "\
UPDATE ${ippool_table} \
- SET expiry_time = 'now'::timesheet(0) + '${lease_duration} second'::interval \
+ SET \
+ expiry_time = NOW() + INTERVAL ${lease_duration} SECOND, \
+ counter = counter + 1 \
WHERE pool_name = '%{control:${pool_name}}' \
AND pool_key = '${pool_key}' \
AND framedipaddress = '%{%{DHCP-Requested-IP-Address}:-%{DHCP-Client-IP-Address}}'"
# Table structure for table 'dhcpippool'
#
CREATE TABLE dhcpippool (
- id int(11) unsigned NOT NULL auto_increment,
+ id int unsigned NOT NULL auto_increment,
pool_name varchar(30) NOT NULL,
framedipaddress varchar(15) NOT NULL DEFAULT '',
pool_key varchar(30) NOT NULL DEFAULT '',
gateway varchar(15) NOT NULL DEFAULT '',
expiry_time DATETIME NOT NULL DEFAULT NOW(),
status ENUM('dynamic', 'static', 'declined', 'disabled') DEFAULT 'dynamic',
+ counter int unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (id),
KEY dhcpippool_poolname_expire (pool_name, expiry_time),
KEY framedipaddress (framedipaddress),
update_begin = "commit"
update_update = "\
UPDATE ${ippool_table} \
- SET expiry_time = current_timestamp + INTERVAL '${lease_duration}' second(1) \
+ SET \
+ expiry_time = current_timestamp + INTERVAL '${lease_duration}' second(1), \
+ counter = counter + 1 \
WHERE pool_name = '%{control:${pool_name}}' \
AND pool_key = '${pool_key}' \
AND framedipaddress = '%{%{DHCP-Requested-IP-Address}:-%{DHCP-Client-IP-Address}}'"
gateway VARCHAR(15) NOT NULL,
expiry_time TIMESTAMP(0) NOT NULL,
status_id INT DEFAULT 1,
+ counter INT DEFAULT 0,
FOREIGN KEY (status_id) REFERENCES dhcpstatus(status_id)
);
#
update_update = "\
UPDATE ${ippool_table} \
- SET expiry_time = 'now'::timestamp(0) + '${lease_duration} second'::interval \
+ SET \
+ expiry_time = 'now'::timestamp(0) + '${lease_duration} second'::interval, \
+ counter = counter + 1 \
WHERE pool_name = '%{control:${pool_name}}' \
AND pool_key = '${pool_key}' \
AND framedipaddress = '%{%{DHCP-Requested-IP-Address}:-%{DHCP-Client-IP-Address}}'"
pool_key VARCHAR(64) NOT NULL default '0',
gateway VARCHAR(16) NOT NULL default '',
expiry_time TIMESTAMP(0) without time zone NOT NULL default NOW(),
- status dhcp_status DEFAULT 'dynamic'
+ status dhcp_status DEFAULT 'dynamic',
+ counter INT NOT NULL DEFAULT 0
);
CREATE INDEX dhcpippool_poolname_expire ON dhcpippool USING btree (pool_name, expiry_time);
#
update_update = "\
UPDATE ${ippool_table} \
- SET expiry_time = datetime(strftime('%%s', 'now') + ${lease_duration}, 'unixepoch') \
+ SET \
+ expiry_time = datetime(strftime('%%s', 'now') + ${lease_duration}, 'unixepoch'), \
+ counter = counter + 1 \
WHERE pool_name = '%{control:${pool_name}}' \
AND pool_key = '${pool_key}' \
AND framedipaddress = '%{%{DHCP-Requested-IP-Address}:-%{DHCP-Client-IP-Address}}'"
gateway varchar(15) NOT NULL DEFAULT '',
expiry_time DATETIME NOT NULL default (DATETIME('now')),
status_id int NOT NULL DEFAULT 1,
+ counter int NOT NULL DEFAULT 0,
FOREIGN KEY(status_id) REFERENCES dhcpstatus(status_id)
);