<?php
	
//	$query =   "CREATE TRIGGER id_create BEFORE INSERT ON cdr FOR EACH ROW SET NEW.id = UUID();";
//	$result = $GLOBALS['db']->query($query); 
	
	$query = "SELECT COUNT(*) FROM `cdr` WHERE `id`=''";
	$result = $GLOBALS['db']->query($query);
	if($result) {
		$row = $GLOBALS['db']->fetchByAssoc($result);
		if($row) {
			for($i=0; $i<$row["COUNT(*)"]; $i++) {
				$query = "UPDATE `cdr` SET `id`='".create_guid()."' WHERE `id`='' LIMIT 1";
				$GLOBALS['db']->query($query);
			} 
		}
	}

	
?>