mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 17:05:37 +02:00
Compare commits
4 Commits
2
...
3.0.0-beta
Author | SHA1 | Date | |
---|---|---|---|
|
83feb62e63 | ||
|
d45ec79b07 | ||
|
b614fb6133 | ||
|
25304fa8aa |
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@ -14,3 +14,21 @@ 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 +0,0 @@
|
||||
<?php
|
0
_config/config.yml
Normal file
0
_config/config.yml
Normal file
@ -5,7 +5,6 @@ namespace SilverStripe\SQLite;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Core\Config\Configurable;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\ORM\Connect\Database;
|
||||
use SilverStripe\ORM\DataList;
|
||||
@ -120,16 +119,6 @@ class SQLite3Database extends Database
|
||||
*/
|
||||
public function connect($parameters)
|
||||
{
|
||||
if (!empty($parameters['memory'])) {
|
||||
Deprecation::notice(
|
||||
'1.4.0',
|
||||
"\$databaseConfig['memory'] is deprecated. Use \$databaseConfig['path'] = ':memory:' instead.",
|
||||
Deprecation::SCOPE_GLOBAL
|
||||
);
|
||||
unset($parameters['memory']);
|
||||
$parameters['path'] = ':memory:';
|
||||
}
|
||||
|
||||
//We will store these connection parameters for use elsewhere (ie, unit tests)
|
||||
$this->parameters = $parameters;
|
||||
$this->schemaManager->flushCache();
|
||||
@ -540,7 +529,7 @@ class SQLite3Database extends Database
|
||||
return $this->transactionNesting;
|
||||
}
|
||||
|
||||
public function transactionEnd($chain = false)
|
||||
public function transactionEnd(): bool|null
|
||||
{
|
||||
// Fail if transaction isn't available
|
||||
if (!$this->transactionDepth()) {
|
||||
@ -556,10 +545,6 @@ class SQLite3Database extends Database
|
||||
$this->resetTransactionNesting();
|
||||
}
|
||||
|
||||
if ($chain) {
|
||||
$this->transactionStart();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -622,16 +607,6 @@ class SQLite3Database extends Database
|
||||
return parent::preparedQuery($sql, $parameters, $errorLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inspect a SQL query prior to execution
|
||||
* @deprecated 2.2.0:3.0.0
|
||||
* @param string $sql
|
||||
*/
|
||||
protected function inspectQuery($sql)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
public function clearTable($table)
|
||||
{
|
||||
$this->query("DELETE FROM \"$table\"");
|
||||
@ -652,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';
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ namespace SilverStripe\SQLite;
|
||||
|
||||
use SilverStripe\ORM\Connect\Query;
|
||||
use SQLite3Result;
|
||||
use Traversable;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@ -72,12 +63,10 @@ class SQLite3Query extends Query
|
||||
return $c;
|
||||
}
|
||||
|
||||
public function nextRecord()
|
||||
public function getIterator(): Traversable
|
||||
{
|
||||
if ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
|
||||
return $data;
|
||||
} else {
|
||||
return false;
|
||||
while ($data = $this->handle->fetchArray(SQLITE3_ASSOC)) {
|
||||
yield $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ class SQLite3SchemaManager extends DBSchemaManager
|
||||
return (bool)$this->preparedQuery(
|
||||
'SELECT "name" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?',
|
||||
array('table', $tableName)
|
||||
)->first();
|
||||
)->record();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -715,7 +715,7 @@ class SQLite3SchemaManager extends DBSchemaManager
|
||||
$classnameinfo = $this->preparedQuery(
|
||||
"SELECT EnumList FROM SQLiteEnums WHERE TableColumn = ?",
|
||||
array($tablefield)
|
||||
)->first();
|
||||
)->record();
|
||||
if ($classnameinfo) {
|
||||
$valueList = $classnameinfo['EnumList'];
|
||||
$this->enum_map[$tablefield] = $valueList;
|
||||
|
@ -14,11 +14,12 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"silverstripe/framework": "~4.0",
|
||||
"silverstripe/vendor-plugin": "^1.0"
|
||||
"silverstripe/framework": "^5",
|
||||
"silverstripe/vendor-plugin": "^2"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "^3"
|
||||
"squizlabs/php_codesniffer": "^3",
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"autoload": {
|
||||
"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