corley/dbal-influxdb

dev-master 2015-07-01 19:04 UTC

This package is not auto-updated.

Last update: 2024-12-21 19:05:51 UTC


README

Circle CI Code Coverage Scrutinizer Code Quality

InfluxDB driver for Doctrine DBAL (Abstraction Layer)

Query builder

$qb = $conn->createQueryBuilder();

$qb->select("*")
    ->from("cpu_load_short")
    ->where("time = ?")
    ->setParameter(0, 1434055562000000000);

$data = $qb->execute();
foreach ($data->fetchAll() as $element) {
    // Use your element
}

Create a connection

$config = new \Doctrine\DBAL\Configuration();
//..
$connectionParams = array(
    'dbname' => 'mydb',
    'user' => 'root',
    'password' => 'root',
    'host' => 'localhost',
    'port' => 8086,
    "driverClass" => "Corley\\DBAL\\Driver\\InfluxDB",
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);