Ejemplo n.º 1
0
 /**
  * Closes the connection to the MySQL instance, if connected.
  */
 public static function disconnect()
 {
     if (self::$dl !== null) {
         self::$dl->disconnect();
         self::$dl = null;
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  * 
  */
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     StaticDataLayer::disconnect();
     StaticDataLayer::connect('localhost', 'test', 'test', self::$dataSchema);
     StaticDataLayer::executeNone('alter table `test_data`.`TABLE1` engine=innodb');
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     StaticDataLayer::disconnect();
     StaticDataLayer::connect('localhost', 'test', 'test', self::$dataSchema);
     StaticDataLayer::multiQuery(file_get_contents(__DIR__ . '/config/setup.sql'));
 }
Ejemplo n.º 4
0
 private function runAudit()
 {
     $application = new Application();
     $application->add(new AuditCommand());
     /** @var AuditCommand $command */
     $command = $application->find('audit');
     $command->setRewriteConfigFile(false);
     $commandTester = new CommandTester($command);
     $commandTester->execute(['command' => $command->getName(), 'config file' => __DIR__ . '/config/audit.json']);
     // Reconnect to MySQL.
     StaticDataLayer::disconnect();
     StaticDataLayer::connect('localhost', 'test', 'test', self::$dataSchema);
     return $commandTester->getStatusCode();
 }
Ejemplo n.º 5
0
 protected function tearDown()
 {
     StaticDataLayer::disconnect();
 }
Ejemplo n.º 6
0
foreach ($files as $file) {
    if (file_exists($file)) {
        require $file;
        break;
    }
}
declare (ticks=1);
//----------------------------------------------------------------------------------------------------------------------
function signalHandler()
{
    $GLOBALS['exit'] = true;
}
//----------------------------------------------------------------------------------------------------------------------
$GLOBALS['exit'] = false;
pcntl_signal(SIGUSR1, "signalHandler");
// Set error handler.
$handler = new ErrorHandler();
$handler->register();
StaticDataLayer::connect('localhost', 'test', 'test', 'test_data');
while (true) {
    if ($GLOBALS['exit']) {
        break;
    }
    StaticDataLayer::begin();
    StaticDataLayer::executeNone('insert into TABLE1(c) values(1)');
    StaticDataLayer::executeNone('update TABLE1 set c = 2');
    StaticDataLayer::executeNone('delete from TABLE1 where c = 2');
    StaticDataLayer::commit();
}
StaticDataLayer::disconnect();