mirror of
https://github.com/dg/dibi.git
synced 2025-08-30 17:29:53 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7fa05f381b | ||
|
3a962de553 | ||
|
96e370b8fe | ||
|
ec0455ae00 | ||
|
b61737311e |
6
.github/workflows/coding-style.yml
vendored
6
.github/workflows/coding-style.yml
vendored
@@ -7,7 +7,7 @@ jobs:
|
||||
name: Nette Code Checker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.0
|
||||
@@ -21,11 +21,11 @@ jobs:
|
||||
name: Nette Coding Standard
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.0
|
||||
coverage: none
|
||||
|
||||
- run: composer create-project nette/coding-standard temp/coding-standard ^3 --no-progress --ignore-platform-reqs
|
||||
- run: composer create-project nette/coding-standard temp/coding-standard ^3 --no-progress
|
||||
- run: php temp/coding-standard/ecs check
|
||||
|
2
.github/workflows/static-analysis.yml
vendored
2
.github/workflows/static-analysis.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
name: PHPStan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.0
|
||||
|
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
|
||||
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
|
||||
|
||||
fail-fast: false
|
||||
|
||||
@@ -89,7 +89,7 @@ jobs:
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
@@ -106,7 +106,7 @@ jobs:
|
||||
- run: composer install --no-progress --prefer-dist
|
||||
- run: vendor/bin/tester -p phpdbg tests -s -C --coverage ./coverage.xml --coverage-src ./src
|
||||
- if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: output
|
||||
path: tests/**/output
|
||||
|
@@ -34,7 +34,7 @@ Install Dibi via Composer:
|
||||
composer require dibi/dibi
|
||||
```
|
||||
|
||||
The Dibi 4.2 requires PHP version 7.2 and supports PHP up to 8.1.
|
||||
The Dibi 4.2 requires PHP version 7.2 and supports PHP up to 8.2.
|
||||
|
||||
|
||||
Usage
|
||||
|
@@ -159,7 +159,7 @@ class Panel implements Tracy\IBarPanel
|
||||
return '<style> #tracy-debug td.tracy-DibiProfiler-sql { background: white !important }
|
||||
#tracy-debug .tracy-DibiProfiler-source { color: #999 !important }
|
||||
#tracy-debug tracy-DibiProfiler tr table { margin: 8px 0; max-height: 150px; overflow:auto } </style>
|
||||
<h1>Queries:\u{a0}' . count($this->events)
|
||||
<h1>Queries:' . "\u{a0}" . count($this->events)
|
||||
. ($totalTime === null ? '' : ", time:\u{a0}" . number_format($totalTime * 1000, 1, '.', "\u{202f}") . "\u{202f}ms") . ', '
|
||||
. htmlspecialchars($this->getConnectionName($singleConnection)) . '</h1>
|
||||
<div class="tracy-inner tracy-DibiProfiler">
|
||||
|
@@ -292,7 +292,8 @@ class SqliteDriver implements Dibi\Driver
|
||||
callable $rowCallback,
|
||||
callable $agrCallback,
|
||||
int $numArgs = -1
|
||||
): void {
|
||||
): void
|
||||
{
|
||||
$this->connection->createAggregate($name, $rowCallback, $agrCallback, $numArgs);
|
||||
}
|
||||
}
|
||||
|
@@ -70,7 +70,11 @@ class Event
|
||||
|
||||
$dibiDir = dirname((new \ReflectionClass('dibi'))->getFileName()) . DIRECTORY_SEPARATOR;
|
||||
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $row) {
|
||||
if (isset($row['file']) && is_file($row['file']) && strpos($row['file'], $dibiDir) !== 0) {
|
||||
if (
|
||||
isset($row['file'])
|
||||
&& preg_match('~\.(php.?|phtml)$~', $row['file'])
|
||||
&& substr($row['file'], 0, strlen($dibiDir)) !== $dibiDir
|
||||
) {
|
||||
$this->source = [$row['file'], (int) $row['line']];
|
||||
break;
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ namespace Dibi;
|
||||
* Lazy cached storage.
|
||||
* @internal
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
abstract class HashMapBase
|
||||
{
|
||||
/** @var callable */
|
||||
|
@@ -13,6 +13,7 @@ namespace Dibi;
|
||||
/**
|
||||
* Result set single row.
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
class Row implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
{
|
||||
public function __construct(array $arr)
|
||||
|
@@ -109,7 +109,7 @@ final class Translator
|
||||
(\?) ## 11) placeholder
|
||||
)/xs
|
||||
XX
|
||||
,
|
||||
,
|
||||
[$this, 'cb'],
|
||||
substr($arg, $toSkip)
|
||||
);
|
||||
@@ -448,7 +448,7 @@ XX
|
||||
:(\S*?:)([a-zA-Z0-9._]?)
|
||||
)/sx
|
||||
XX
|
||||
,
|
||||
,
|
||||
[$this, 'cb'],
|
||||
substr($value, $toSkip)
|
||||
);
|
||||
|
@@ -44,8 +44,7 @@ class dibi
|
||||
IDENTIFIER = 'n';
|
||||
|
||||
/** version */
|
||||
public const
|
||||
VERSION = '4.2.6';
|
||||
public const VERSION = '4.2.6';
|
||||
|
||||
/** sorting order */
|
||||
public const
|
||||
|
21
tests/dibi/Event.source.phpt
Normal file
21
tests/dibi/Event.source.phpt
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Tester\Assert;
|
||||
|
||||
require __DIR__ . '/bootstrap.php';
|
||||
|
||||
|
||||
$conn = new Dibi\Connection($config);
|
||||
|
||||
$event = new Dibi\Event($conn, Dibi\Event::CONNECT);
|
||||
Assert::same([__FILE__, __LINE__ - 1], $event->source);
|
||||
|
||||
eval('$event = new Dibi\Event($conn, Dibi\Event::CONNECT);');
|
||||
Assert::same([__FILE__, __LINE__ - 1], $event->source);
|
||||
|
||||
array_map(function () use ($conn) {
|
||||
$event = new Dibi\Event($conn, Dibi\Event::CONNECT);
|
||||
Assert::same([__FILE__, __LINE__ - 1], $event->source);
|
||||
}, [null]);
|
@@ -51,7 +51,7 @@ function test(string $title, Closure $function): void
|
||||
/** Replaces [] with driver-specific quotes */
|
||||
function reformat($s)
|
||||
{
|
||||
global $config;
|
||||
$config = $GLOBALS['config'];
|
||||
if (is_array($s)) {
|
||||
if (isset($s[$config['system']])) {
|
||||
return $s[$config['system']];
|
||||
@@ -72,7 +72,7 @@ function reformat($s)
|
||||
|
||||
function num($n)
|
||||
{
|
||||
global $config;
|
||||
$config = $GLOBALS['config'];
|
||||
if (substr($config['dsn'] ?? '', 0, 5) === 'odbc:') {
|
||||
$n = is_float($n) ? "$n.0" : (string) $n;
|
||||
}
|
||||
|
Reference in New Issue
Block a user