Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00%
0 / 1
0.00%
0 / 3
CRAP
0.00%
0 / 23
MySql
0.00%
0 / 1
0.00%
0 / 3
30
0.00%
0 / 23
 cleanup()
0.00%
0 / 1
6
0.00%
0 / 8
 sqlQuery($query)
0.00%
0 / 1
2
0.00%
0 / 6
 select($column, $table, array $criteria)
0.00%
0 / 1
6
0.00%
0 / 9
<?php
namespace Codeception\Util\Driver;
class MySql extends Db
{
public function cleanup() {
$this->dbh->exec('SET FOREIGN_KEY_CHECKS=0;');
$res = $this->dbh->query('show tables')->fetchAll();
foreach ($res as $row) {
$this->dbh->exec('drop table `' . $row[0] . '`');
}
$this->dbh->exec('SET FOREIGN_KEY_CHECKS=1;');
}
protected function sqlQuery($query)
{
$this->dbh->exec('SET FOREIGN_KEY_CHECKS=0;');
parent::sqlQuery($query);
$this->dbh->exec('SET FOREIGN_KEY_CHECKS=1;');
}
public function select($column, $table, array $criteria) {
$query = "select %s from `%s` where %s";
$params = array();
foreach ($criteria as $k => $v) {
$params[] = "`$k` = ? ";
}
$params = implode('AND ', $params);
return sprintf($query, $column, $table, $params);
}
}