Private GIT

Skip to content
Snippets Groups Projects
Unverified Commit 3ebfa8d2 authored by Gary Allan's avatar Gary Allan
Browse files

Bugfix: Fixup search SQL queries

SQL search queries for subnets and ip_addr are string comparisons and not
integer comparisons. To obtain expected search results left pad with zeros
to cover whole IPv6 address space, LDAP(ip,39,0).

MySQL/MariaDB compare strings left to right until a difference is encountered.
The 1st character "9" is greater than the 1st charcter "1", not the expected result.

	MariaDB [phpipam]> SELECT "9" > "10", 9 > 10, LPAD("9",39,0) > LPAD("10",39,0);
	+------------+--------+----------------------------------+
	| "9" > "10" | 9 > 10 | LPAD("9",39,0) > LPAD("10",39,0) |
	+------------+--------+----------------------------------+
	|          1 |      0 |                                0 |
	+------------+--------+----------------------------------+
parent f3e151bc
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment