31 lines
938 B
PHP
31 lines
938 B
PHP
|
<?php
|
||
|
|
||
|
use PDOSqlsrvPerfTest\PDOSqlsrvUtil;
|
||
|
/**
|
||
|
* @BeforeMethods({"connect"})
|
||
|
* @AfterMethods({"disconnect"})
|
||
|
*/
|
||
|
class PDOCreateDbTableProcBench{
|
||
|
private $conn;
|
||
|
|
||
|
public function connect(){
|
||
|
$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.
|
||
|
* Not that, execDirect function are used to execute all the queries.
|
||
|
*/
|
||
|
public function benchCreateDbTableProc(){
|
||
|
$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 );
|
||
|
}
|
||
|
|
||
|
public function disconnect(){
|
||
|
PDOSqlsrvUtil::disconnect( $this->conn );
|
||
|
}
|
||
|
}
|