php-sqlsrv/test/Performance/benchmark/sqlsrv/SqlsrvFetchLargeBench.php

38 lines
798 B
PHP
Raw Normal View History

2017-05-06 02:32:09 +02:00
<?php
use SqlsrvPerfTest\SqlsrvUtil;
/**
* @Iterations(1)
2017-05-06 02:32:09 +02:00
* @BeforeMethods({"connect", "setTableName" })
* @AfterMethods({ "disconnect"})
*/
2017-08-23 01:15:33 +02:00
class SqlsrvFetchLargeBench
{
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 = SqlsrvUtil::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
SqlsrvUtil::fetchWithPrepare( $this->conn, $this->tableName );
}
2017-08-23 01:15:33 +02:00
public function disconnect()
{
2017-05-06 02:32:09 +02:00
SqlsrvUtil::disconnect( $this->conn );
}
}