mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 22:26:43 +02:00
cs
This commit is contained in:
@@ -89,8 +89,8 @@ class Panel implements Tracy\IBarPanel
|
|||||||
$totalTime += $event->time;
|
$totalTime += $event->time;
|
||||||
}
|
}
|
||||||
return '<span title="dibi"><svg viewBox="0 0 2048 2048" style="vertical-align: bottom; width:1.23em; height:1.55em"><path fill="' . ($count ? '#b079d6' : '#aaa') . '" d="M1024 896q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0 768q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-384q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-1152q208 0 385 34.5t280 93.5 103 128v128q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-128q0-69 103-128t280-93.5 385-34.5z"/></svg><span class="tracy-label">'
|
return '<span title="dibi"><svg viewBox="0 0 2048 2048" style="vertical-align: bottom; width:1.23em; height:1.55em"><path fill="' . ($count ? '#b079d6' : '#aaa') . '" d="M1024 896q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0 768q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-384q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-1152q208 0 385 34.5t280 93.5 103 128v128q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-128q0-69 103-128t280-93.5 385-34.5z"/></svg><span class="tracy-label">'
|
||||||
. $count . ' queries'
|
. $count . "\u{a0}queries"
|
||||||
. ($totalTime ? ' / ' . number_format($totalTime * 1000, 1, '.', ' ') . ' ms' : '')
|
. ($totalTime ? ' / ' . number_format($totalTime * 1000, 1, '.', "\u{202f}") . "\u{202f}ms" : '')
|
||||||
. '</span></span>';
|
. '</span></span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ class Panel implements Tracy\IBarPanel
|
|||||||
[$connection->onEvent, \dibi::$numOfQueries, \dibi::$totalTime] = $backup;
|
[$connection->onEvent, \dibi::$numOfQueries, \dibi::$totalTime] = $backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
$s .= '<tr><td data-order="' . $event->time . '">' . number_format($event->time * 1000, 3, '.', ' ');
|
$s .= '<tr><td data-order="' . $event->time . '">' . number_format($event->time * 1000, 3, '.', "\u{202f}");
|
||||||
if ($explain) {
|
if ($explain) {
|
||||||
static $counter;
|
static $counter;
|
||||||
$counter++;
|
$counter++;
|
||||||
@@ -155,8 +155,8 @@ class Panel implements Tracy\IBarPanel
|
|||||||
return '<style> #tracy-debug td.tracy-DibiProfiler-sql { background: white !important }
|
return '<style> #tracy-debug td.tracy-DibiProfiler-sql { background: white !important }
|
||||||
#tracy-debug .tracy-DibiProfiler-source { color: #999 !important }
|
#tracy-debug .tracy-DibiProfiler-source { color: #999 !important }
|
||||||
#tracy-debug tracy-DibiProfiler tr table { margin: 8px 0; max-height: 150px; overflow:auto } </style>
|
#tracy-debug tracy-DibiProfiler tr table { margin: 8px 0; max-height: 150px; overflow:auto } </style>
|
||||||
<h1>Queries: ' . count($this->events)
|
<h1>Queries:\u{a0}' . count($this->events)
|
||||||
. ($totalTime === null ? '' : ', time: ' . number_format($totalTime * 1000, 1, '.', ' ') . ' ms') . ', '
|
. ($totalTime === null ? '' : ", time:\u{a0}" . number_format($totalTime * 1000, 1, '.', "\u{202f}") . "\u{202f}ms") . ', '
|
||||||
. htmlspecialchars($this->getConnectionName($singleConnection)) . '</h1>
|
. htmlspecialchars($this->getConnectionName($singleConnection)) . '</h1>
|
||||||
<div class="tracy-inner tracy-DibiProfiler">
|
<div class="tracy-inner tracy-DibiProfiler">
|
||||||
<table class="tracy-sortable">
|
<table class="tracy-sortable">
|
||||||
@@ -172,6 +172,6 @@ class Panel implements Tracy\IBarPanel
|
|||||||
$driver = $connection->getConfig('driver');
|
$driver = $connection->getConfig('driver');
|
||||||
return (is_object($driver) ? get_class($driver) : $driver)
|
return (is_object($driver) ? get_class($driver) : $driver)
|
||||||
. ($connection->getConfig('name') ? '/' . $connection->getConfig('name') : '')
|
. ($connection->getConfig('name') ? '/' . $connection->getConfig('name') : '')
|
||||||
. ($connection->getConfig('host') ? ' @ ' . $connection->getConfig('host') : '');
|
. ($connection->getConfig('host') ? "\u{202f}@\u{202f}" . $connection->getConfig('host') : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ class SqliteDriver implements Dibi\Driver
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$this->connection = new SQLite3($config['database']);
|
$this->connection = new SQLite3($config['database']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
throw new Dibi\DriverException($e->getMessage(), $e->getCode());
|
throw new Dibi\DriverException($e->getMessage(), $e->getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -163,7 +163,7 @@ class dibi
|
|||||||
/**
|
/**
|
||||||
* Strips microseconds part.
|
* Strips microseconds part.
|
||||||
*/
|
*/
|
||||||
public static function stripMicroseconds(\DateTimeInterface $dt): \DateTimeInterface
|
public static function stripMicroseconds(DateTimeInterface $dt): DateTimeInterface
|
||||||
{
|
{
|
||||||
$class = get_class($dt);
|
$class = get_class($dt);
|
||||||
return new $class($dt->format('Y-m-d H:i:s'), $dt->getTimezone());
|
return new $class($dt->format('Y-m-d H:i:s'), $dt->getTimezone());
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Tester\Assert;
|
use Tester\Assert;
|
||||||
|
@@ -60,7 +60,7 @@ test('transaction() fail', function () use ($conn) {
|
|||||||
]);
|
]);
|
||||||
throw new Exception('my exception');
|
throw new Exception('my exception');
|
||||||
});
|
});
|
||||||
}, \Throwable::class, 'my exception');
|
}, Throwable::class, 'my exception');
|
||||||
Assert::same(4, (int) $conn->query('SELECT COUNT(*) FROM [products]')->fetchSingle());
|
Assert::same(4, (int) $conn->query('SELECT COUNT(*) FROM [products]')->fetchSingle());
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ test('nested transaction() call fail', function () use ($conn) {
|
|||||||
throw new Exception('my exception');
|
throw new Exception('my exception');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, \Throwable::class, 'my exception');
|
}, Throwable::class, 'my exception');
|
||||||
Assert::same(5, (int) $conn->query('SELECT COUNT(*) FROM [products]')->fetchSingle());
|
Assert::same(5, (int) $conn->query('SELECT COUNT(*) FROM [products]')->fetchSingle());
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,17 +115,17 @@ test('begin(), commit() & rollback() calls are forbidden in transaction()', func
|
|||||||
$conn->transaction(function (Dibi\Connection $connection) {
|
$conn->transaction(function (Dibi\Connection $connection) {
|
||||||
$connection->begin();
|
$connection->begin();
|
||||||
});
|
});
|
||||||
}, \LogicException::class, Dibi\Connection::class . '::begin() call is forbidden inside a transaction() callback');
|
}, LogicException::class, Dibi\Connection::class . '::begin() call is forbidden inside a transaction() callback');
|
||||||
|
|
||||||
Assert::exception(function () use ($conn) {
|
Assert::exception(function () use ($conn) {
|
||||||
$conn->transaction(function (Dibi\Connection $connection) {
|
$conn->transaction(function (Dibi\Connection $connection) {
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
});
|
});
|
||||||
}, \LogicException::class, Dibi\Connection::class . '::commit() call is forbidden inside a transaction() callback');
|
}, LogicException::class, Dibi\Connection::class . '::commit() call is forbidden inside a transaction() callback');
|
||||||
|
|
||||||
Assert::exception(function () use ($conn) {
|
Assert::exception(function () use ($conn) {
|
||||||
$conn->transaction(function (Dibi\Connection $connection) {
|
$conn->transaction(function (Dibi\Connection $connection) {
|
||||||
$connection->rollback();
|
$connection->rollback();
|
||||||
});
|
});
|
||||||
}, \LogicException::class, Dibi\Connection::class . '::rollback() call is forbidden inside a transaction() callback');
|
}, LogicException::class, Dibi\Connection::class . '::rollback() call is forbidden inside a transaction() callback');
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Dibi\Row;
|
use Dibi\Row;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Dibi\Fluent;
|
use Dibi\Fluent;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Tester\Assert;
|
use Tester\Assert;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Tester\Assert;
|
use Tester\Assert;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Tester\Assert;
|
use Tester\Assert;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Tester\Assert;
|
use Tester\Assert;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Dibi\Helpers;
|
use Dibi\Helpers;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Dibi\Helpers;
|
use Dibi\Helpers;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Dibi\Type;
|
use Dibi\Type;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Tester\Assert;
|
use Tester\Assert;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Tester\Assert;
|
use Tester\Assert;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
// The Nette Tester command-line runner can be
|
// The Nette Tester command-line runner can be
|
||||||
@@ -18,7 +19,7 @@ date_default_timezone_set('Europe/Prague');
|
|||||||
// load connection
|
// load connection
|
||||||
try {
|
try {
|
||||||
$config = Tester\Environment::loadData();
|
$config = Tester\Environment::loadData();
|
||||||
} catch (Exception $e) {
|
} catch (Throwable $e) {
|
||||||
$config = parse_ini_file(__DIR__ . '/../databases.ini', true);
|
$config = parse_ini_file(__DIR__ . '/../databases.ini', true);
|
||||||
$config = reset($config);
|
$config = reset($config);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user