php-sqlsrv/test/Performance/benchmark/pdo_sqlsrv/PDOFetchLargeBench.php

38 lines
810 B
PHP
Raw Normal View History

2017-05-06 02:32:09 +02:00
<?php
use PDOSqlsrvPerfTest\PDOSqlsrvUtil;
/**
* @Iterations(1)
2017-05-06 02:32:09 +02:00
* @BeforeMethods({"connect", "setTableName" })
* @AfterMethods({ "disconnect"})
*/
2017-08-23 01:15:33 +02:00
class PDOFetchLargeBench
{
2017-05-06 02:32:09 +02:00
private $conn;
private $tableName;
2017-08-23 01:15:33 +02:00
public function setTableName()
{
2017-05-06 02:32:09 +02:00
//Assumes the table is already populated with data
$this->tableName = "LargeDB.dbo.datatypes";
}
2017-08-23 01:15:33 +02:00
public function connect()
{
2017-05-06 02:32:09 +02:00
$this->conn = PDOSqlsrvUtil::connect();
}
/*
2017-08-26 00:15:24 +02:00
* Each iteration calls prepare, execute and fetch APIs to fetch the already populated data
2017-05-06 02:32:09 +02:00
*/
2017-08-23 01:15:33 +02:00
public function benchFetchWithPrepare()
{
2017-05-06 02:32:09 +02:00
PDOSqlsrvUtil::fetchWithPrepare( $this->conn, $this->tableName );
}
2017-08-23 01:15:33 +02:00
public function disconnect()
{
2017-05-06 02:32:09 +02:00
PDOSqlsrvUtil::disconnect( $this->conn );
}
}