<?php
/*
Magic class to make KRDB::i("phone", $prefix8) work
Prefix8 is 8 digits in international phone number: 1 234-567-8
For more details see KRDB_Phone
KRDB::i("phone", $prefix1)->summary << summary for prefix(1+3)
KRDB::i("phone", $prefix4)->summary << summary for prefix(1+3+3)
/rd/bin/dt -t dt.phone --sqlSum='select sum(phones) from %s'
Grand SUM is: 224,121,894
*/
class KRDB_PhoneNS extends KRDB_Namespace {
function KRDB(/*array*/ $key, DB_Parallel &$DB_Parallel = null) {
if (! is_numeric($key))
throw new RunTimeException("Prefix8 must be a number");
$kl = strlen($key);
if ($kl!=8 && $kl!=1 && $kl!=4 && $kl!=7)
throw new RunTimeException("1,4,7,8 digit phone prefix supported");
/*
if (substr($key, 0, 1) != '1')
throw new RunTimeException("Only US phones supported");
*/
}
}