irm-1.6-b3/MDB/Common.php
/**
     * Execute a prepared query statement.
     *
     * @param int $prepared_query argument is a handle that was returned by
     *       the function prepareQuery()
     * @param array $types array that contains the types of the columns in the
     *       result set
     * @return mixed a result handle or MDB_OK on success, a MDB error on failure
     * @access public
     */
Execute a prepared query statement.
@param int $prepared_query argument is a handle that was returned by
the function prepareQuery()
@param array $types array that contains the types of the columns in the
result set
@return mixed a result handle or MDB_OK on success, a MDB error on failure
@access public
Execute a prepared query statement . @param int $prepared_query argument is a handle that was returned by the function prepareQuery () @param array $types array that contains the types of the columns in the result set @return mixed a result handle or MDB_OK on success a MDB error on failure @access public
function executeQuery($prepared_query, $types = NULL)
    {
        $result = $this->_validatePreparedQuery($prepared_query);
        if (MDB::isError($result)) {
            return($result);
        }
        $index = $prepared_query-1;
        $success = MDB_OK;
        $this->clobs[$prepared_query] = $this->blobs[$prepared_query] = array();
        $query = '';
        for($last_position = $position = 0;
            $position < count($this->prepared_queries[$index]['Positions']);
            $position++) {
            if (!isset($this->prepared_queries[$index]['Values'][$position])) {
                return($this->raiseError(MDB_ERROR_NEED_MORE_DATA, NULL, NULL,
                    'Execute query: it was not defined query argument '.($position + 1)));
            }
            $current_position = $this->prepared_queries[$index]['Positions'][$position];
            $query .= substr($this->prepared_queries[$index]['Query'], $last_position, $current_position - $last_position);
            $value = $this->prepared_queries[$index]['Values'][$position];
            if ($this->prepared_queries[$index]['IsNULL'][$position]) {
                $query .= $value;
            } else {
                switch ($this->prepared_queries[$index]['Types'][$position]) {
                    case 'clob':
                        if (!MDB::isError($success = $this->getClobValue($prepared_query, $position + 1, $value))) {
                            $this->clobs[$prepared_query][$position + 1] = $success;
                            $query .= $this->clobs[$prepared_query][$position + 1];
                        }
                        break;
                    case 'blob':
                        if (!MDB::isError($success = $this->getBlobValue($prepared_query, $position + 1, $value))) {
                            $this->blobs[$prepared_query][$position + 1] = $success;
                            $query .= $this->blobs[$prepared_query][$position + 1];
                        }
                        break;
                    default:
                        $query .= $value;
                        break;
                }
            }
            $last_position = $current_position + 1;
        }
        if (!MDB::isError($success)) {
            $query .= substr($this->prepared_queries[$index]['Query'], $last_position);
            if ($this->selected_row_limit > 0) {
                $this->prepared_queries[$index]['First'] = $this->first_selected_row;
                $this->prepared_queries[$index]['Limit'] = $this->selected_row_limit;
            }
            if (isset($this->prepared_queries[$index]['Limit'])
                && $this->prepared_queries[$index]['Limit'] > 0
            ) {
                $this->first_selected_row = $this->prepared_queries[$index]['First'];
                $this->selected_row_limit = $this->prepared_queries[$index]['Limit'];
            } else {
                $this->first_selected_row = $this->selected_row_limit = 0;
            }
            $success = $this->_executePreparedQuery($prepared_query, $query, $types);
        }
        for(reset($this->clobs[$prepared_query]), $clob = 0;
            $clob < count($this->clobs[$prepared_query]);
            $clob++, next($this->clobs[$prepared_query])) {
            $this->freeClobValue($prepared_query, key($this->clobs[$prepared_query]), $this->clobs[$prepared_query][key($this->clobs[$prepared_query])], $success);
        }
        unset($this->clobs[$prepared_query]);
        for(reset($this->blobs[$prepared_query]), $blob = 0;
            $blob < count($this->blobs[$prepared_query]);
            $blob++, next($this->blobs[$prepared_query])) {
            $this->freeBlobValue($prepared_query, key($this->blobs[$prepared_query]), $this->blobs[$prepared_query][key($this->blobs[$prepared_query])], $success);
        }
        unset($this->blobs[$prepared_query]);
        return($success);
    }
function executeQuery ( $ prepared_query , $ types = NULL ) { $ result = $ this -> _validatePreparedQuery ( $ prepared_query ) ; if ( MDB :: isError ( $ result ) ) { return ( $ result ) ; } $ index = $ prepared_query - 1 ; $ success = MDB_OK ; $ this -> clobs [ $ prepared_query ] = $ this -> blobs [ $ prepared_query ] = array ( ) ; $ query = '' ; for ( $ last_position = $ position = 0 ; $ position < count ( $ this -> prepared_queries [ $ index ] [ 'Positions' ] ) ; $ position ++ ) { if ( ! isset ( $ this -> prepared_queries [ $ index ] [ 'Values' ] [ $ position ] ) ) { return ( $ this -> raiseError ( MDB_ERROR_NEED_MORE_DATA , NULL , NULL , 'Execute query: it was not defined query argument ' . ( $ position + 1 ) ) ) ; } $ current_position = $ this -> prepared_queries [ $ index ] [ 'Positions' ] [ $ position ] ; $ query .= substr ( $ this -> prepared_queries [ $ index ] [ 'Query' ] , $ last_position , $ current_position - $ last_position ) ; $ value = $ this -> prepared_queries [ $ index ] [ 'Values' ] [ $ position ] ; if ( $ this -> prepared_queries [ $ index ] [ 'IsNULL' ] [ $ position ] ) { $ query .= $ value ; } else { switch ( $ this -> prepared_queries [ $ index ] [ 'Types' ] [ $ position ] ) { case 'clob' : if ( ! MDB :: isError ( $ success = $ this -> getClobValue ( $ prepared_query , $ position + 1 , $ value ) ) ) { $ this -> clobs [ $ prepared_query ] [ $ position + 1 ] = $ success ; $ query .= $ this -> clobs [ $ prepared_query ] [ $ position + 1 ] ; } break ; case 'blob' : if ( ! MDB :: isError ( $ success = $ this -> getBlobValue ( $ prepared_query , $ position + 1 , $ value ) ) ) { $ this -> blobs [ $ prepared_query ] [ $ position + 1 ] = $ success ; $ query .= $ this -> blobs [ $ prepared_query ] [ $ position + 1 ] ; } break ; default : $ query .= $ value ; break ; } } $ last_position = $ current_position + 1 ; } if ( ! MDB :: isError ( $ success ) ) { $ query .= substr ( $ this -> prepared_queries [ $ index ] [ 'Query' ] , $ last_position ) ; if ( $ this -> selected_row_limit > 0 ) { $ this -> prepared_queries [ $ index ] [ 'First' ] = $ this -> first_selected_row ; $ this -> prepared_queries [ $ index ] [ 'Limit' ] = $ this -> selected_row_limit ; } if ( isset ( $ this -> prepared_queries [ $ index ] [ 'Limit' ] ) && $ this -> prepared_queries [ $ index ] [ 'Limit' ] > 0 ) { $ this -> first_selected_row = $ this -> prepared_queries [ $ index ] [ 'First' ] ; $ this -> selected_row_limit = $ this -> prepared_queries [ $ index ] [ 'Limit' ] ; } else { $ this -> first_selected_row = $ this -> selected_row_limit = 0 ; } $ success = $ this -> _executePreparedQuery ( $ prepared_query , $ query , $ types ) ; } for ( reset ( $ this -> clobs [ $ prepared_query ] ) , $ clob = 0 ; $ clob < count ( $ this -> clobs [ $ prepared_query ] ) ; $ clob ++ , next ( $ this -> clobs [ $ prepared_query ] ) ) { $ this -> freeClobValue ( $ prepared_query , key ( $ this -> clobs [ $ prepared_query ] ) , $ this -> clobs [ $ prepared_query ] [ key ( $ this -> clobs [ $ prepared_query ] ) ] , $ success ) ; } unset ( $ this -> clobs [ $ prepared_query ] ) ; for ( reset ( $ this -> blobs [ $ prepared_query ] ) , $ blob = 0 ; $ blob < count ( $ this -> blobs [ $ prepared_query ] ) ; $ blob ++ , next ( $ this -> blobs [ $ prepared_query ] ) ) { $ this -> freeBlobValue ( $ prepared_query , key ( $ this -> blobs [ $ prepared_query ] ) , $ this -> blobs [ $ prepared_query ] [ key ( $ this -> blobs [ $ prepared_query ] ) ] , $ success ) ; } unset ( $ this -> blobs [ $ prepared_query ] ) ; return ( $ success ) ; }
Execute a prepared query statement.
Execute a prepared query statement .