+ printf("<br>\n");
+ foreach ($arr_ip as $i) {
+ $cmp = int2four(ip2int($i) & 0xffffff00);
+ $msk = int2four(0xffffff00);
+ $cmp_que = sprintf("SELECT * FROM test_ip WHERE (ip & %d = %d);", $msk, $cmp);
+ if (($cmp_pg = $bdb->query($cmp_que)) == FALSE) {
+ printf("%s<br>\n", $bdb->last_error());
+ fail("SELECT * FROM test_ip");
+ break;
+ }
+ succ($cmp_que);
+
+ for ($r = 0 ; $r < pg_numrows($cmp_pg) ; $r++) {
+ $cmp_obj = pg_fetch_object($cmp_pg, $r);
+
+ if ($ip_obj->ip & $msk != $cmp) {
+ fail(sprintf(" Expected: %s, retrieved: %s", int2ip($cmp), int2ip($ip_obj->ip & $msk)));
+ }
+ else {
+ succ(sprintf(" Expected: %s (%s)", int2ip($cmp), int2ip($cmp_obj->ip)));
+ }
+ // printf("RET IP: %d IP: %s<br>\n", $ip_obj->ip, $v));
+ }
+ }
+ printf("<br>\n");