Ich versuche, mehr IP-Adressen IPv4 und IPv6 von 86.120.51.222 bis 1450718174. Derzeit zu konvertieren versuchen, die Abfrage zu erstellen, weiß aber nicht viel SQLConvert IPv4- und IPv6-Adressen zu Integer
TABLE ip_city_country_location
+----+---------+---------------+-------------+
| ID | ip_from | ip_to | city |
+----+---------+---------------+-------------+
| 1 | 1.2.3.4 | 1.255.255.255 | city_name_1 |
| 2 | 1.3.4.4 | 1.6.0.0 | city_name_2 |
| 3. | 1.0.0.0 | 1.5.5.5 | city_name_3 |
+----+---------+---------------+-------------+
Was ich denke an
UPDATE ip_city_country_location SET ip_from = INET_ATON(SELECT ip_from FROm ip_city_country_location), ip_to = INET_ATON(SELECT ip_to FROm ip_city_country_location);
Hinweis kann auch mit CASE
und WHEN
uNDerfolgen, aber brauche eine andere eine Lösung, die automatisch konvertiert, weil dies ein dbs 5 Millionen Zeilen ist und es von Shell (Xampp) ausführen müssen. Erstellen Sie eine Funktion in SQL oder SMTP.
erwartete Ausgabe
+----+---------+---------------+-------------+
| ID | ip_from | ip_to | city |
+----+---------+---------------+-------------+
| 1 | 16909060 | 33554431 | city_name_1 |
| 2 | 16974852 | 17170432 | city_name_2 |
| 3. | 16777216 | 17106181 | city_name_3 |
+----+---------+---------------+-------------+
Warum Sie nicht wie dieses 'UPDATE ip_city_country_location SET verwenden ip_from = INET_ATON (ip_from), ip_to = INET_ATON (ip_to);'? – 1000111