| | 321 | * function getUuidArray |
| | 322 | * Gets an array of uuids for a given tabledefuuid and list of ids. Will not |
| | 323 | * give a uuid more than once and may not return an array of the same count |
| | 324 | * as the count of the $ids array. |
| | 325 | * |
| | 326 | * @param object $db |
| | 327 | * @param string $tabledefuuid |
| | 328 | * @param array $ids |
| | 329 | * |
| | 330 | * @return array Array of Uuids for the $ids in no particular order. Count |
| | 331 | * (length) of this array is less than or equal to the $ids array. Returns false |
| | 332 | * if $ids is of length 0. |
| | 333 | */ |
| | 334 | |
| | 335 | function getUuidArray($db, $tabledefuuid, $ids){ |
| | 336 | |
| | 337 | if(!count($ids)) |
| | 338 | return false; |
| | 339 | |
| | 340 | $querystatement = " |
| | 341 | SELECT |
| | 342 | `maintable` |
| | 343 | FROM |
| | 344 | `tabledefs` |
| | 345 | WHERE |
| | 346 | `uuid` = '".$tabledefuuid."'"; |
| | 347 | |
| | 348 | $queryresult = $db->query($querystatement); |
| | 349 | |
| | 350 | $tablerecord = $db->fetchArray($queryresult); |
| | 351 | |
| | 352 | $whereclause = ""; |
| | 353 | foreach($ids as $id) |
| | 354 | $whereclause .= " OR `id` = '".(int)$id."'"; |
| | 355 | |
| | 356 | $whereclause = substr($whereclause, 4); |
| | 357 | |
| | 358 | $querystatement = " |
| | 359 | SELECT |
| | 360 | `uuid` |
| | 361 | FROM |
| | 362 | `".$tablerecord["maintable"]."` |
| | 363 | WHERE |
| | 364 | ".$whereclause; |
| | 365 | |
| | 366 | $queryresult = $db->query($querystatement); |
| | 367 | |
| | 368 | $thereturn = array(); |
| | 369 | if($db->numRows($queryresult)) |
| | 370 | while($therecord = $db->fetchArray($queryresult)) |
| | 371 | $thereturn[] = $therecord["uuid"]; |
| | 372 | |
| | 373 | return $thereturn; |
| | 374 | |
| | 375 | }//end function --getUuidArray-- |
| | 376 | |
| | 377 | |
| | 378 | /** |