if (isset($body->_order)) { if (is_object($body->_order)) { $args[] = $base->order($body->_order->col, strtoupper($body->_order->order)); } else { $args[] = $base->order($body->_order); } } if (isset($body->_limit)) { if (is_object($body->_limit)) { $args[] = $base->limit($body->_limit->limit, $body->_limit->offset); } else { $args[] = $base->limit($body->_limit); } } if (isset($body->_distinct)) { $args[] = $base->distinct(); } try { $results = $base->{$schema}->__call($function, $args); } catch (PgProcFunctionNotAvailableException $e) { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); echo $e->getMessage(); exit; } catch (PgProcException $e) { header($_SERVER["SERVER_PROTOCOL"] . " 400 Bad Request"); echo $e->getMessage(); exit; } catch (Exception $e) { header($_SERVER["SERVER_PROTOCOL"] . " 400 Bad Request"); echo $e->getMessage(); exit;
public function testDistinct() { $in = array(1, 3, 2, 3, 4); $out = self::$base->pgtests->test_integer_array_arg($in, PgProcedures2::distinct(), PgProcedures2::order('test_integer_array_arg')); $this->assertSame(array(1, 2, 3, 4), $out); }