Commit 5cde4dd5 authored by Francis Dupont's avatar Francis Dupont

[393-global-search-through-leases-by-mac-or-hostname-w-o-specifying-a-subnet-id] Addressed comments

parent fab3f89f
...@@ -65,7 +65,7 @@ This library provides the following commands: ...@@ -65,7 +65,7 @@ This library provides the following commands:
- ``lease4-get-by-client-id`` - return all IPv4 leases with the specified - ``lease4-get-by-client-id`` - return all IPv4 leases with the specified
client id. client id.
- ``lease6-get-by-duid`` - returns all IPv6 leases with the specified duid. - ``lease6-get-by-duid`` - returns all IPv6 leases with the specified DUID.
- ``lease4-get-by-hostname`` - return all IPv4 leases with the specified - ``lease4-get-by-hostname`` - return all IPv4 leases with the specified
hostname. hostname.
......
...@@ -321,7 +321,7 @@ public: ...@@ -321,7 +321,7 @@ public:
/// @brief lease4-get-by-hostname and lease6-get-by-hostname commands /// @brief lease4-get-by-hostname and lease6-get-by-hostname commands
/// handler /// handler
/// ///
/// Thesecommands attempt to retrieve all IPv4 or Ipv6 leases with /// These commands attempt to retrieve all IPv4 or Ipv6 leases with
/// a particular hostname. /// a particular hostname.
/// ///
/// Example command for v4: /// Example command for v4:
......
...@@ -145,7 +145,7 @@ PgSqlTaggedStatement tagged_statements[] = { ...@@ -145,7 +145,7 @@ PgSqlTaggedStatement tagged_statements[] = {
"fqdn_fwd, fqdn_rev, hostname, " "fqdn_fwd, fqdn_rev, hostname, "
"state, user_context " "state, user_context "
"FROM lease4 " "FROM lease4 "
"WHERE hostname = $1"}, "WHERE lower(hostname) = $1"},
// GET_LEASE4_EXPIRE // GET_LEASE4_EXPIRE
{ 3, { OID_INT8, OID_TIMESTAMP, OID_INT8 }, { 3, { OID_INT8, OID_TIMESTAMP, OID_INT8 },
...@@ -247,7 +247,7 @@ PgSqlTaggedStatement tagged_statements[] = { ...@@ -247,7 +247,7 @@ PgSqlTaggedStatement tagged_statements[] = {
"hwaddr, hwtype, hwaddr_source, " "hwaddr, hwtype, hwaddr_source, "
"state, user_context " "state, user_context "
"FROM lease6 " "FROM lease6 "
"WHERE hostname = $1"}, "WHERE lower(hostname) = $1"},
// GET_LEASE6_EXPIRE // GET_LEASE6_EXPIRE
{ 3, { OID_INT8, OID_TIMESTAMP, OID_INT8 }, { 3, { OID_INT8, OID_TIMESTAMP, OID_INT8 },
......
...@@ -896,11 +896,11 @@ CREATE INDEX hosts_by_hostname ON hosts (lower(hostname)) ...@@ -896,11 +896,11 @@ CREATE INDEX hosts_by_hostname ON hosts (lower(hostname))
WHERE hostname IS NOT NULL; WHERE hostname IS NOT NULL;
-- Create a hostname index for lease4. -- Create a hostname index for lease4.
CREATE INDEX lease4_by_hostname ON lease4 (hostname) CREATE INDEX lease4_by_hostname ON lease4 (lower(hostname))
WHERE hostname IS NOT NULL; WHERE hostname IS NOT NULL;
-- Create a hostname index for lease6. -- Create a hostname index for lease6.
CREATE INDEX lease6_by_hostname ON lease6 (hostname) CREATE INDEX lease6_by_hostname ON lease6 (lower(hostname))
WHERE hostname IS NOT NULL; WHERE hostname IS NOT NULL;
-- Set 6.0 schema version. -- Set 6.0 schema version.
......
...@@ -25,20 +25,22 @@ CREATE INDEX hosts_by_hostname ON hosts (lower(hostname)) ...@@ -25,20 +25,22 @@ CREATE INDEX hosts_by_hostname ON hosts (lower(hostname))
WHERE hostname IS NOT NULL; WHERE hostname IS NOT NULL;
-- Create a hostname index for lease4. -- Create a hostname index for lease4.
CREATE INDEX lease4_by_hostname ON lease4 (hostname) CREATE INDEX lease4_by_hostname ON lease4 (lower(hostname))
WHERE hostname IS NOT NULL; WHERE hostname IS NOT NULL;
-- Create a hostname index for lease6. -- Create a hostname index for lease6.
CREATE INDEX lease6_by_hostname ON lease6 (hostname) CREATE INDEX lease6_by_hostname ON lease6 (lower(hostname))
WHERE hostname IS NOT NULL; WHERE hostname IS NOT NULL;
-- Move to lower case hostnames in lease4 table. -- Move to lower case hostnames in lease4 table.
UPDATE lease4 SET hostname = lower(hostname) -- Not required so in comment
WHERE lower(hostname) != hostname; -- UPDATE lease4 SET hostname = lower(hostname)
-- WHERE lower(hostname) != hostname;
-- Move to lower case hostnames in lease6 table. -- Move to lower case hostnames in lease6 table.
UPDATE lease6 SET hostname = lower(hostname) -- Not required so in comment
WHERE lower(hostname) != hostname; -- UPDATE lease6 SET hostname = lower(hostname)
-- WHERE lower(hostname) != hostname;
-- Set 6.0 schema version. -- Set 6.0 schema version.
UPDATE schema_version UPDATE schema_version
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment