Compare commits

..

No commits in common. "2ea23eb237b3828a0cd108a204004215652ba0bc" and "d45ec79b07d7cbf8ad78a61e61de0071d35e3e57" have entirely different histories.

8 changed files with 24 additions and 38 deletions

View File

@ -14,21 +14,3 @@ jobs:
# Only run cron on the silverstripe account
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
with:
# set phpunit to false to prevent automatic generation of mysql phpunit jobs
phpunit: false
preserve_vendor_tests: true
extra_jobs: |
- php: 8.1
db: sqlite3
composer_args: --prefer-lowest
phpunit: true
phpunit_suite: all
- php: 8.1
db: sqlite3
phpunit: true
phpunit_suite: all
- php: 8.2
db: sqlite3
phpunit: true
phpunit_suite: all

1
_config.php Normal file
View File

@ -0,0 +1 @@
<?php

View File

View File

@ -627,9 +627,9 @@ class SQLite3Database extends Database
// GLOB uses asterisks as wildcards.
// Replace them in search string, without replacing escaped percetage signs.
$comp = 'GLOB';
$value = preg_replace('/^%([^\\\\])/', '*$1', $value ?? '');
$value = preg_replace('/([^\\\\])%$/', '$1*', $value ?? '');
$value = preg_replace('/([^\\\\])%/', '$1*', $value ?? '');
$value = preg_replace('/^%([^\\\\])/', '*$1', $value);
$value = preg_replace('/([^\\\\])%$/', '$1*', $value);
$value = preg_replace('/([^\\\\])%/', '$1*', $value);
} else {
$comp = 'LIKE';
}

View File

@ -4,7 +4,6 @@ namespace SilverStripe\SQLite;
use SilverStripe\ORM\Connect\Query;
use SQLite3Result;
use Traversable;
/**
* A result-set from a SQLite3 database.
@ -44,6 +43,16 @@ class SQLite3Query extends Query
}
}
public function seek($row)
{
$this->handle->reset();
$i=0;
while ($i <= $row && $result = @$this->handle->fetchArray(SQLITE3_ASSOC)) {
$i++;
}
return $result;
}
/**
* @todo This looks terrible but there is no SQLite3::get_num_rows() implementation
*/
@ -53,7 +62,7 @@ class SQLite3Query extends Query
if (!$this->handle->numColumns()) {
return 0;
}
$this->handle->reset();
$c=0;
while ($this->handle->fetchArray()) {
@ -63,10 +72,13 @@ class SQLite3Query extends Query
return $c;
}
public function getIterator(): Traversable
#[\ReturnTypeWillChange]
public function getIterator()
{
while ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
yield $data;
if ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
return $data;
} else {
return false;
}
}
}

View File

@ -692,7 +692,7 @@ class SQLite3SchemaManager extends DBSchemaManager
return (bool)$this->preparedQuery(
'SELECT "name" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?',
array('table', $tableName)
)->record();
)->first();
}
/**
@ -715,7 +715,7 @@ class SQLite3SchemaManager extends DBSchemaManager
$classnameinfo = $this->preparedQuery(
"SELECT EnumList FROM SQLiteEnums WHERE TableColumn = ?",
array($tablefield)
)->record();
)->first();
if ($classnameinfo) {
$valueList = $classnameinfo['EnumList'];
$this->enum_map[$tablefield] = $valueList;

View File

@ -18,8 +18,7 @@
"silverstripe/vendor-plugin": "^2"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3",
"phpunit/phpunit": "^9.5"
"squizlabs/php_codesniffer": "^3"
},
"autoload": {
"psr-4": {

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuites>
<testsuite name="framework">
<directory>vendor/silverstripe/framework/tests/php</directory>
</testsuite>
</testsuites>
</phpunit>