0

我正在使用 olap4php 连接到 Mondrian 的默认 FoodMart XML 模式,我需要对其运行 MDX 查询以查看是否可以使其工作。

我当前的代码如下:-

require_once( 'olap4php/autoload.php' );
use OLAP4PHP\Provider\XMLA\XMLAConnection;
$endpoint = "http://server:8888/myproject/FoodMart.xml";
$properties = array(
XMLAConnection::PROP_CATALOG => 'FoodMart',
XMLAConnection::PROP_DATASOURCE => 'Provider=Mondrian;DataSource=FoodMart'
);
$connection = new XMLAConnection( $endpoint, $properties );
if ($connection) {
    echo "yes";
}

输出为“是”,所以我相信连接正常。现在我想在它上面运行一个 MDX 查询,一些查询比如

SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} ON COLUMNS,
{[Product].members} ON ROWS
FROM [Sales]
WHERE [Time].[1997].[Q2] 
4

1 回答 1

0

入门指南说将您的查询字符串放入 $query 然后:

use OLAP4PHP\Provider\XMLA\XMLAStatement;

$statement = new XMLAStatement( $connection );
$cellSet = $statement->executeOlapQuery( $query );
于 2013-06-13T12:14:49.787 回答