mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 17:05:37 +02:00
ENH Add CMS5 compatibility and re-enable builds (#69)
This commit is contained in:
parent
d45ec79b07
commit
83feb62e63
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@ -14,3 +14,21 @@ jobs:
|
|||||||
# Only run cron on the silverstripe account
|
# Only run cron on the silverstripe account
|
||||||
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
|
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
|
||||||
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
|
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 +0,0 @@
|
|||||||
<?php
|
|
0
_config/config.yml
Normal file
0
_config/config.yml
Normal file
@ -627,9 +627,9 @@ class SQLite3Database extends Database
|
|||||||
// GLOB uses asterisks as wildcards.
|
// GLOB uses asterisks as wildcards.
|
||||||
// Replace them in search string, without replacing escaped percetage signs.
|
// Replace them in search string, without replacing escaped percetage signs.
|
||||||
$comp = 'GLOB';
|
$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 {
|
} else {
|
||||||
$comp = 'LIKE';
|
$comp = 'LIKE';
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace SilverStripe\SQLite;
|
|||||||
|
|
||||||
use SilverStripe\ORM\Connect\Query;
|
use SilverStripe\ORM\Connect\Query;
|
||||||
use SQLite3Result;
|
use SQLite3Result;
|
||||||
|
use Traversable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A result-set from a SQLite3 database.
|
* A result-set from a SQLite3 database.
|
||||||
@ -43,16 +44,6 @@ 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
|
* @todo This looks terrible but there is no SQLite3::get_num_rows() implementation
|
||||||
*/
|
*/
|
||||||
@ -72,13 +63,10 @@ class SQLite3Query extends Query
|
|||||||
return $c;
|
return $c;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[\ReturnTypeWillChange]
|
public function getIterator(): Traversable
|
||||||
public function getIterator()
|
|
||||||
{
|
{
|
||||||
if ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
|
while ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
|
||||||
return $data;
|
yield $data;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -692,7 +692,7 @@ class SQLite3SchemaManager extends DBSchemaManager
|
|||||||
return (bool)$this->preparedQuery(
|
return (bool)$this->preparedQuery(
|
||||||
'SELECT "name" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?',
|
'SELECT "name" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?',
|
||||||
array('table', $tableName)
|
array('table', $tableName)
|
||||||
)->first();
|
)->record();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -715,7 +715,7 @@ class SQLite3SchemaManager extends DBSchemaManager
|
|||||||
$classnameinfo = $this->preparedQuery(
|
$classnameinfo = $this->preparedQuery(
|
||||||
"SELECT EnumList FROM SQLiteEnums WHERE TableColumn = ?",
|
"SELECT EnumList FROM SQLiteEnums WHERE TableColumn = ?",
|
||||||
array($tablefield)
|
array($tablefield)
|
||||||
)->first();
|
)->record();
|
||||||
if ($classnameinfo) {
|
if ($classnameinfo) {
|
||||||
$valueList = $classnameinfo['EnumList'];
|
$valueList = $classnameinfo['EnumList'];
|
||||||
$this->enum_map[$tablefield] = $valueList;
|
$this->enum_map[$tablefield] = $valueList;
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
"silverstripe/vendor-plugin": "^2"
|
"silverstripe/vendor-plugin": "^2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"squizlabs/php_codesniffer": "^3"
|
"squizlabs/php_codesniffer": "^3",
|
||||||
|
"phpunit/phpunit": "^9.5"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
8
phpunit.xml.dist
Normal file
8
phpunit.xml.dist
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?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>
|
Loading…
Reference in New Issue
Block a user