model/RdsResultStorage.php
public function getResultByDelivery($delivery, $options = array())
    {
        $returnValue = array();
        $sql = 'SELECT * FROM ' . self::RESULTS_TABLENAME;
        $params = array();


        if (count($delivery) > 0) {
            $sql .= ' WHERE ';
            $inQuery = implode(',', array_fill(0, count($delivery), '?'));
            $sql .= self::DELIVERY_COLUMN . ' IN (' . $inQuery . ')';
            $params = array_merge($params, $delivery);
        }


        if(isset($options['order']) && in_array($options['order'], [self::DELIVERY_COLUMN, self::TEST_TAKER_COLUMN, self::RESULTS_TABLE_ID])){
            $sql .= ' ORDER BY ' . $options['order'];
            if(isset($options['orderdir']) && (strtolower($options['orderdir']) === 'asc' || strtolower($options['orderdir']) === 'desc')) {
                $sql .= ' ' . $options['orderdir'];
            }
        }
        if(isset($options['offset']) || isset($options['limit'])){
            $offset = (isset($options['offset']))?$options['offset']:0;
            $limit = (isset($options['limit']))?$options['limit']:1000;
            $sql = $this->getPersistence()->getPlatForm()->limitStatement($sql, $limit, $offset);
        }
        $results = $this->getPersistence()->query($sql, $params);
        foreach ($results as $value) {
            $returnValue[] = array(
                "deliveryResultIdentifier" => $value[self::RESULTS_TABLE_ID],
                "testTakerIdentifier" => $value[self::TEST_TAKER_COLUMN],
                "deliveryIdentifier" => $value[self::DELIVERY_COLUMN]
            );
        }
        return $returnValue;

    }
public function getResultByDelivery($delivery, $options = array())
    {
        $returnValue = array();
        $sql = 'SELECT * FROM ' . self::RESULTS_TABLENAME;
        $params = array();


        if (count($delivery) > 0) {
            $sql .= ' WHERE ';
            $inQuery = implode(',', array_fill(0, count($delivery), '?'));
            $sql .= self::DELIVERY_COLUMN . ' IN (' . $inQuery . ')';
            $params = array_merge($params, $delivery);
        }


        if(isset($options['order']) && in_array($options['order'], [self::DELIVERY_COLUMN, self::TEST_TAKER_COLUMN, self::RESULTS_TABLE_ID])){
            $sql .= ' ORDER BY ' . $options['order'];
            if(isset($options['orderdir']) && (strtolower($options['orderdir']) === 'asc' || strtolower($options['orderdir']) === 'desc')) {
                $sql .= ' ' . $options['orderdir'];
            }
        }
        if(isset($options['offset']) || isset($options['limit'])){
            $offset = (isset($options['offset']))?$options['offset']:0;
            $limit = (isset($options['limit']))?$options['limit']:1000;
            $sql = $this->getPersistence()->getPlatForm()->limitStatement($sql, $limit, $offset);
        }
        $results = $this->getPersistence()->query($sql, $params);
        foreach ($results as $value) {
            $returnValue[] = array(
                "deliveryResultIdentifier" => $value[self::RESULTS_TABLE_ID],
                "testTakerIdentifier" => $value[self::TEST_TAKER_COLUMN],
                "deliveryIdentifier" => $value[self::DELIVERY_COLUMN]
            );
        }
        return $returnValue;

    }
public function getResultByDelivery ( $ delivery , $ options = array ( ) ) { $ returnValue = array ( ) ; $ sql = 'SELECT * FROM ' . self :: RESULTS_TABLENAME ; $ params = array ( ) ; if ( count ( $ delivery ) > 0 ) { $ sql .= ' WHERE ' ; $ inQuery = implode ( ',' , array_fill ( 0 , count ( $ delivery ) , '?' ) ) ; $ sql .= self :: DELIVERY_COLUMN . ' IN (' . $ inQuery . ')' ; $ params = array_merge ( $ params , $ delivery ) ; } if ( isset ( $ options [ 'order' ] ) && in_array ( $ options [ 'order' ] , [ self :: DELIVERY_COLUMN , self :: TEST_TAKER_COLUMN , self :: RESULTS_TABLE_ID ] ) ) { $ sql .= ' ORDER BY ' . $ options [ 'order' ] ; if ( isset ( $ options [ 'orderdir' ] ) && ( strtolower ( $ options [ 'orderdir' ] ) === 'asc' || strtolower ( $ options [ 'orderdir' ] ) === 'desc' ) ) { $ sql .= ' ' . $ options [ 'orderdir' ] ; } } if ( isset ( $ options [ 'offset' ] ) || isset ( $ options [ 'limit' ] ) ) { $ offset = ( isset ( $ options [ 'offset' ] ) ) ? $ options [ 'offset' ] : 0 ; $ limit = ( isset ( $ options [ 'limit' ] ) ) ? $ options [ 'limit' ] : 1000 ; $ sql = $ this -> getPersistence ( ) -> getPlatForm ( ) -> limitStatement ( $ sql , $ limit , $ offset ) ; } $ results = $ this -> getPersistence ( ) -> query ( $ sql , $ params ) ; foreach ( $ results as $ value ) { $ returnValue [ ] = array ( "deliveryResultIdentifier" => $ value [ self :: RESULTS_TABLE_ID ] , "testTakerIdentifier" => $ value [ self :: TEST_TAKER_COLUMN ] , "deliveryIdentifier" => $ value [ self :: DELIVERY_COLUMN ] ) ; } return $ returnValue ; }
order, orderdir, offset, limit
order orderdir offset limit