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

36 lines
1 KiB
PHP
Raw Normal View History

2017-05-06 02:32:09 +02:00
<?php
use PDOSqlsrvPerfTest\PDOSqlsrvUtil;
2017-08-23 01:15:33 +02:00
include_once __DIR__ . "/../../lib/CRUDBaseBenchmark.php";
2017-05-06 02:32:09 +02:00
/**
* @BeforeMethods({"connect"})
* @AfterMethods({"disconnect"})
*/
2017-08-23 01:15:33 +02:00
class PDOCreateDbTableProcBench extends CRUDBaseBenchmark
{
2017-05-06 02:32:09 +02:00
private $conn;
2017-08-23 01:15:33 +02:00
public function connect()
{
2017-05-06 02:32:09 +02:00
$this->conn = PDOSqlsrvUtil::connect();
}
/*
* Each iteration creates a database, a table and a stored procedure in that database and drops the database at the end.
* Note that, execDirect function are used to execute all the queries.
2017-05-06 02:32:09 +02:00
*/
2017-08-23 01:15:33 +02:00
public function benchCreateDbTableProc()
{
2017-05-06 02:32:09 +02:00
$randomNum = rand();
$databaseName = "test_db_$randomNum";
$tableName = "test_table_$randomNum";
$procName = "test_proc_$randomNum";
PDOSqlsrvUtil::createDbTableProc( $this->conn, $databaseName, $tableName, $procName );
PDOSqlsrvUtil::dropDatabase( $this->conn, $databaseName );
}
2017-08-23 01:15:33 +02:00
public function disconnect()
{
2017-05-06 02:32:09 +02:00
PDOSqlsrvUtil::disconnect( $this->conn );
}
}