OracleDataSource
Introduction #
Although using PDODataSource
can connect to SQL Server. However if for some reasons, you do not have the PDO Driver, you may use the old traditional connection to Oracle using OracleDataSource
.
Settings #
Name | type | default | description |
---|---|---|---|
class | string | Must set to '\koolreport\datasources\OracleDataSource' | |
connection | object | Set the connection object | |
connectionString | string | Connection string, like 'localhost:1521/XE' | |
username | string | Your login username | |
password | string | Your password |
If connection
is set to an existed connection, that connection object will be used.
Otherwise, KoolReport will create a new or use a previously own-created connection object of the same setting.
Methods #
Name | return | description |
---|---|---|
query(string $str_query) | OracleDataSource | This method is used in report's setup() function. It will help to setup query string which will be executed when report is run. |
params(array $params) | OracleDataSource | This method is used to set list of parameters for query statement |
Example #
<?php
class MyReport extends \koolreport\KoolReport
{
public function settings()
{
return array(
"dataSources"=>array(
"oracle_mydb"=>array(
'connectionString' => 'localhost:1521/XE',
'username' => 'sa',
'password' => 'root',
'class' => "\koolreport\datasources\OracleDataSource",
),
)
);
}
public function setup()
{
$this->src('oracle_mydb')
->query("SELECT * FROM tblPurchase where status=:status")
->params(array(":status"=>"completed"))
->pipe(..)
->pipe(..)
->pipe($this->dataStore('purchase_summary'));
}
}
Get started with KoolReport
KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.