From f176bb0a39676d47d347b1b5b81a6a0753fb66f1 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 9 Feb 2018 11:24:35 +0000 Subject: [PATCH 01/14] FIX Add nested transaction support --- code/SQLite3Database.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index 44f83a0..dbb64b1 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -50,6 +50,11 @@ class SQLite3Database extends Database */ protected $livesInMemory = false; + /** + * @var bool + */ + protected $transactionNesting = 0; + /** * List of default pragma values * @@ -448,7 +453,12 @@ class SQLite3Database extends Database public function transactionStart($transaction_mode = false, $session_characteristics = false) { - $this->query('BEGIN'); + if ($this->transactionNesting > 0) { + $this->transactionSavepoint('NESTEDTRANSACTION' . $this->transactionNesting); + } else { + $this->query('BEGIN'); + } + ++$this->transactionNesting; } public function transactionSavepoint($savepoint) @@ -461,13 +471,22 @@ class SQLite3Database extends Database if ($savepoint) { $this->query("ROLLBACK TO $savepoint;"); } else { - $this->query('ROLLBACK;'); + --$this->transactionNesting; + if ($this->transactionNesting > 0) { + $this->transactionRollback('NESTEDTRANSACTION' . $this->transactionNesting); + } else { + $this->query('ROLLBACK;'); + } } } public function transactionEnd($chain = false) { - $this->query('COMMIT;'); + --$this->transactionNesting; + if ($this->transactionNesting <= 0) { + $this->transactionNesting = 0; + $this->query('COMMIT;'); + } } public function clearTable($table) From 34648b9c053b1edfb23f73f7e52f24a4b8cd91db Mon Sep 17 00:00:00 2001 From: Mike Cochrane Date: Tue, 13 Feb 2018 14:18:48 +1300 Subject: [PATCH 02/14] Missing 'n' --- code/SQLite3Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index 02d5082..b390fb0 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -348,7 +348,7 @@ class SQLite3Database extends Database "(Title LIKE '%$relevanceKeywords%' OR MenuTitle LIKE '%$relevanceKeywords%'" . " OR Content LIKE '%$relevanceKeywords%' OR MetaDescription LIKE '%$relevanceKeywords%')" . " + (Title LIKE '%$htmlEntityRelevanceKeywords%' OR MenuTitle LIKE '%$htmlEntityRelevanceKeywords%'" - . " OR Content LIKE '%$htmlEntityRelevanceKeywords%' OR MetaDescriptio " + . " OR Content LIKE '%$htmlEntityRelevanceKeywords%' OR MetaDescription " . " LIKE '%$htmlEntityRelevanceKeywords%')"; $relevance[$fileClass] = "(Name LIKE '%$relevanceKeywords%' OR Title LIKE '%$relevanceKeywords%')"; } else { From 978c3718205cf520bf106326fc9b250ea6579b11 Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Mon, 12 Mar 2018 14:04:43 +0100 Subject: [PATCH 03/14] return 0 for non iterable results If there are no columns, it's not a iterable result set and we can return 0. This fixes issues with things like CREATE statement. --- code/SQLite3Query.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/SQLite3Query.php b/code/SQLite3Query.php index e29a88d..2d77d31 100644 --- a/code/SQLite3Query.php +++ b/code/SQLite3Query.php @@ -58,6 +58,11 @@ class SQLite3Query extends Query */ public function numRecords() { + // Some queries are not iterable using fetchArray like CREATE statement + if (!$this->handle->numColumns()) { + return 0; + } + $this->handle->reset(); $c=0; while ($this->handle->fetchArray()) { From d315c61ea0b9cb3b76aea4213e21c7e5714f4a3b Mon Sep 17 00:00:00 2001 From: Dylan Wagstaff Date: Fri, 15 Jun 2018 17:49:06 +1200 Subject: [PATCH 04/14] Add supported module badge to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c742a43..4aafe3f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # SQLite3 Module [![Build Status](https://travis-ci.org/silverstripe-labs/silverstripe-sqlite3.png?branch=master)](https://travis-ci.org/silverstripe-labs/silverstripe-sqlite3) +[![SilverStripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/) ## Maintainer Contact From 4167d9fd1a7f7f8399d38217f6bce959d6136576 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Wed, 20 Jun 2018 12:33:47 +0100 Subject: [PATCH 05/14] FIX Make sure nested transactions get reset on implicit commits --- code/SQLite3Database.php | 66 +++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index ad50e49..006bc54 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -485,25 +485,77 @@ class SQLite3Database extends Database public function transactionRollback($savepoint = false) { + // Named transaction if ($savepoint) { $this->query("ROLLBACK TO $savepoint;"); - } else { - --$this->transactionNesting; - if ($this->transactionNesting > 0) { - $this->transactionRollback('NESTEDTRANSACTION' . $this->transactionNesting); - } else { - $this->query('ROLLBACK;'); - } + return true; } + + // Fail if transaction isn't available + if (!$this->transactionNesting) { + return false; + } + + --$this->transactionNesting; + if ($this->transactionNesting > 0) { + $this->transactionRollback('NESTEDTRANSACTION' . $this->transactionNesting); + } else { + $this->query('ROLLBACK;'); + } + return true; + } + + public function transactionDepth() + { + return $this->transactionNesting; } public function transactionEnd($chain = false) { + // Fail if transaction isn't available + if (!$this->transactionNesting) { + return false; + } --$this->transactionNesting; if ($this->transactionNesting <= 0) { $this->transactionNesting = 0; $this->query('COMMIT;'); } + return true; + } + + /** + * In error condition, set transactionNesting to zero + */ + protected function resetTransactionNesting() + { + $this->transactionNesting = 0; + } + + public function query($sql, $errorLevel = E_USER_ERROR) + { + $this->inspectQuery($sql); + return parent::query($sql, $errorLevel); + } + + public function preparedQuery($sql, $parameters, $errorLevel = E_USER_ERROR) + { + $this->inspectQuery($sql); + return parent::preparedQuery($sql, $parameters, $errorLevel); + } + + /** + * Inspect a SQL query prior to execution + * + * @param string $sql + */ + protected function inspectQuery($sql) + { + // Any DDL discards transactions. + $isDDL = $this->getConnector()->isQueryDDL($sql); + if ($isDDL) { + $this->resetTransactionNesting(); + } } public function clearTable($table) From 418c1178a19a05d587d7eefad5e1a04b5581ad49 Mon Sep 17 00:00:00 2001 From: NightjarNZ Date: Mon, 8 Oct 2018 23:09:24 +1300 Subject: [PATCH 06/14] FIX preserve enum values with correct escaping Enum values are themselves enumerated in sqlite as they are not supported as a type. This leads to values being stored in their own table, and a regular TEXT field being used in a MySQL ENUM's stead. The default value for this field was being escaped with custom string replacement, and erroneously relacing the backslash (a redundant operation). This lead to invalid Fully Qualified Class Names in SilverStripe 4, which is a required trait for polymorphic relationships. As a result any polymorphic relationship not set on first write would then proceed to cause an execution error the next time the dataobject with the relationship was fetched from the database. By using the PHP supplied escape function for SQLite3 we can avoid this, and restore functionality. Relevant section of SQLite documentation to justify the removal of escaping various characters, such as the backslash: A string constant is formed by enclosing the string in single quotes ('). A single quote within the string can be encoded by putting two single quotes in a row - as in Pascal. C-style escapes using the backslash character are not supported because they are not standard SQL. https://www.sqlite.org/lang_expr.html --- code/SQLite3SchemaManager.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/code/SQLite3SchemaManager.php b/code/SQLite3SchemaManager.php index 91c47eb..041a841 100644 --- a/code/SQLite3SchemaManager.php +++ b/code/SQLite3SchemaManager.php @@ -2,10 +2,11 @@ namespace SilverStripe\SQLite; +use Exception; use SilverStripe\Control\Director; use SilverStripe\Dev\Debug; use SilverStripe\ORM\Connect\DBSchemaManager; -use Exception; +use SQLite3; /** * SQLite schema manager class @@ -540,7 +541,18 @@ class SQLite3SchemaManager extends DBSchemaManager // Set default if (!empty($values['default'])) { - $default = str_replace(array('"', "'", "\\", "\0"), "", $values['default']); + /* + On escaping strings: + + https://www.sqlite.org/lang_expr.html + "A string constant is formed by enclosing the string in single quotes ('). A single quote within + the string can be encoded by putting two single quotes in a row - as in Pascal. C-style escapes + using the backslash character are not supported because they are not standard SQL." + + Also, there is a nifty PHP function for this. However apparently one must still be cautious of + the null character ('\0' or 0x0), as per https://bugs.php.net/bug.php?id=63419 + */ + $default = SQLite3::escapeString(str_replace("\0", "", $values['default'])); return "TEXT DEFAULT '$default'"; } else { return 'TEXT'; From 0efd40e5c280f018bbf6a0aa14afdecfc747d6cb Mon Sep 17 00:00:00 2001 From: NightjarNZ Date: Tue, 9 Oct 2018 22:22:53 +1300 Subject: [PATCH 07/14] FIX correct handwritten logic for transactions to use new API instead Code in the field alteration logic had a queries defiend as strings to begin and commit transactions involve with changing table or column names. This was causing fatal errors as BEGIN is not a valid keyword within a trasaction (see SQLite documentation excerpt below). A new api has been introduced to deal with transactions programmatically, and this module was updated to support this a few months ago. This is a tidy up of some missed portions - consuming this API which correctly uses SAVEPOINT when a nested transaction is required automatically. https://www.sqlite.org/lang_transaction.html Transactions created using BEGIN...COMMIT do not nest. For nested transactions, use the SAVEPOINT and RELEASE commands. --- code/SQLite3SchemaManager.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/code/SQLite3SchemaManager.php b/code/SQLite3SchemaManager.php index 91c47eb..a993dc7 100644 --- a/code/SQLite3SchemaManager.php +++ b/code/SQLite3SchemaManager.php @@ -275,21 +275,22 @@ class SQLite3SchemaManager extends DBSchemaManager } $queries = array( - "BEGIN TRANSACTION", "CREATE TABLE \"{$tableName}_alterfield_{$fieldName}\"(" . implode(',', $newColsSpec) . ")", "INSERT INTO \"{$tableName}_alterfield_{$fieldName}\" SELECT {$fieldNameList} FROM \"$tableName\"", "DROP TABLE \"$tableName\"", "ALTER TABLE \"{$tableName}_alterfield_{$fieldName}\" RENAME TO \"$tableName\"", - "COMMIT" ); // Remember original indexes $indexList = $this->indexList($tableName); // Then alter the table column - foreach ($queries as $query) { - $this->query($query.';'); - } + $database = $this->database; + $database->withTransaction(function() use ($database, $queries, $indexList) { + foreach ($queries as $query) { + $database->query($query . ';'); + } + }); // Recreate the indexes foreach ($indexList as $indexName => $indexSpec) { @@ -318,21 +319,22 @@ class SQLite3SchemaManager extends DBSchemaManager $oldColsStr = implode(',', $oldCols); $newColsSpecStr = implode(',', $newColsSpec); $queries = array( - "BEGIN TRANSACTION", "CREATE TABLE \"{$tableName}_renamefield_{$oldName}\" ({$newColsSpecStr})", "INSERT INTO \"{$tableName}_renamefield_{$oldName}\" SELECT {$oldColsStr} FROM \"$tableName\"", "DROP TABLE \"$tableName\"", "ALTER TABLE \"{$tableName}_renamefield_{$oldName}\" RENAME TO \"$tableName\"", - "COMMIT" ); // Remember original indexes $oldIndexList = $this->indexList($tableName); // Then alter the table column - foreach ($queries as $query) { - $this->query($query.';'); - } + $database = $this->database; + $database->withTransaction(function() use ($database, $queries) { + foreach ($queries as $query) { + $database->query($query . ';'); + } + }); // Recreate the indexes foreach ($oldIndexList as $indexName => $indexSpec) { From 62ef14f7118f6557637b428508569dc60cfdac6e Mon Sep 17 00:00:00 2001 From: NightjarNZ Date: Thu, 11 Oct 2018 00:02:12 +1300 Subject: [PATCH 08/14] FIX correct nesting level mismatches causing errors Transactions that used more than one level would cause errors if there were consecutive calls to start a transaction - because each query executed would clear the flag indicating that a transaction was already in progress. The comment for the logic to reset the nesting level on a query was indicating that DDL (data definition language) would not work within a transaction. This is untrue, and the module itself uses a transaction to alter table or field names. So this function has been converted to a no-op, deprecated to be removed in version 3 of this module. It is also no longer called upon each query. There have been some maintenance tidyups around this area also by abstracting the nested transaction flag manipulations into protected functions. --- code/SQLite3Database.php | 61 ++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index 006bc54..a85a6a3 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -470,12 +470,12 @@ class SQLite3Database extends Database public function transactionStart($transaction_mode = false, $session_characteristics = false) { - if ($this->transactionNesting > 0) { - $this->transactionSavepoint('NESTEDTRANSACTION' . $this->transactionNesting); + if ($this->transactionDepth()) { + $this->transactionSavepoint($this->getTransactionSavepointName()); } else { $this->query('BEGIN'); } - ++$this->transactionNesting; + $this->transactionDepthIncrease(); } public function transactionSavepoint($savepoint) @@ -483,6 +483,18 @@ class SQLite3Database extends Database $this->query("SAVEPOINT \"$savepoint\""); } + /** + * Fetch the name of the current savepoint + * {@see transactionDepth} should be greater than zero + * or the name will be invalid (because there are none). + * + * @return string + */ + protected function getTransactionSavepointName() + { + return 'NESTEDTRANSACTION' . $this->transactionDepth(); + } + public function transactionRollback($savepoint = false) { // Named transaction @@ -492,13 +504,13 @@ class SQLite3Database extends Database } // Fail if transaction isn't available - if (!$this->transactionNesting) { + if (!$this->transactionDepth()) { return false; } - --$this->transactionNesting; - if ($this->transactionNesting > 0) { - $this->transactionRollback('NESTEDTRANSACTION' . $this->transactionNesting); + $this->transactionDepthDecrease(); + if ($this->transactionDepth()) { + $this->transactionRollback($this->getTransactionSavepointName()); } else { $this->query('ROLLBACK;'); } @@ -513,17 +525,30 @@ class SQLite3Database extends Database public function transactionEnd($chain = false) { // Fail if transaction isn't available - if (!$this->transactionNesting) { + if (!$this->transactionDepth()) { return false; } - --$this->transactionNesting; - if ($this->transactionNesting <= 0) { - $this->transactionNesting = 0; - $this->query('COMMIT;'); - } + $this->query('COMMIT;'); + $this->transactionDepthDecrease(); return true; } + /** + * Increase the nested transaction level by one + */ + protected function transactionDepthIncrease() + { + ++$this->transactionNesting; + } + + /** + * Decrease the nested transaction level by one + */ + protected function transactionDepthDecrease() + { + --$this->transactionNesting; + } + /** * In error condition, set transactionNesting to zero */ @@ -534,28 +559,22 @@ class SQLite3Database extends Database public function query($sql, $errorLevel = E_USER_ERROR) { - $this->inspectQuery($sql); return parent::query($sql, $errorLevel); } public function preparedQuery($sql, $parameters, $errorLevel = E_USER_ERROR) { - $this->inspectQuery($sql); return parent::preparedQuery($sql, $parameters, $errorLevel); } /** * Inspect a SQL query prior to execution - * + * @deprecated 2..3 * @param string $sql */ protected function inspectQuery($sql) { - // Any DDL discards transactions. - $isDDL = $this->getConnector()->isQueryDDL($sql); - if ($isDDL) { - $this->resetTransactionNesting(); - } + // no-op } public function clearTable($table) From 0fa6b0fde778a1c68c74abbef80cd2e157ef74f4 Mon Sep 17 00:00:00 2001 From: NightjarNZ Date: Thu, 11 Oct 2018 21:51:32 +1300 Subject: [PATCH 09/14] FIX transaction depth related errors with invalid savepoint names The logic for cancelling a savepoint was incorrect, as the behaviour the logic was modelled on was for a different RDBMS - where a COMMIT would always close the most recently opened transaction. SQLite on contrast will commit the entire transaction, not just the most recent savepoint marker until current execution point. The correct manner to deal with a 'partial' commit is to call RELEASE . This revealed an error in the savepoint logic, in that if someone had supplied a savepoint name instead of relying on generated ones, the rollback command did not factor for this and always assumed generated savepoint names - again causing error. For this reason a new class member field has been introduced to track savepoint names in a stack fashion. --- code/SQLite3Database.php | 66 ++++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index a85a6a3..07942ca 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -65,6 +65,11 @@ class SQLite3Database extends Database */ protected $transactionNesting = 0; + /** + * @var array + */ + protected $transactionSavepoints = []; + /** * List of default pragma values * @@ -471,28 +476,27 @@ class SQLite3Database extends Database public function transactionStart($transaction_mode = false, $session_characteristics = false) { if ($this->transactionDepth()) { - $this->transactionSavepoint($this->getTransactionSavepointName()); + $this->transactionSavepoint('NESTEDTRANSACTION' . $this->transactionDepth()); } else { $this->query('BEGIN'); + $this->transactionDepthIncrease(); } - $this->transactionDepthIncrease(); } public function transactionSavepoint($savepoint) { $this->query("SAVEPOINT \"$savepoint\""); + $this->transactionDepthIncrease($savepoint); } /** - * Fetch the name of the current savepoint - * {@see transactionDepth} should be greater than zero - * or the name will be invalid (because there are none). + * Fetch the name of the most recent savepoint * * @return string */ protected function getTransactionSavepointName() { - return 'NESTEDTRANSACTION' . $this->transactionDepth(); + return end($this->transactionSavepoints); } public function transactionRollback($savepoint = false) @@ -500,6 +504,7 @@ class SQLite3Database extends Database // Named transaction if ($savepoint) { $this->query("ROLLBACK TO $savepoint;"); + $this->transactionDepthDecrease(); return true; } @@ -508,11 +513,11 @@ class SQLite3Database extends Database return false; } - $this->transactionDepthDecrease(); - if ($this->transactionDepth()) { + if ($this->transactionIsNested()) { $this->transactionRollback($this->getTransactionSavepointName()); } else { $this->query('ROLLBACK;'); + $this->transactionDepthDecrease(); } return true; } @@ -528,24 +533,60 @@ class SQLite3Database extends Database if (!$this->transactionDepth()) { return false; } - $this->query('COMMIT;'); - $this->transactionDepthDecrease(); + + if ($this->transactionIsNested()) { + $savepoint = $this->getTransactionSavepointName(); + $this->query('RELEASE ' . $savepoint); + $this->transactionDepthDecrease(); + } else { + $this->query('COMMIT;'); + $this->resetTransactionNesting(); + } + + if ($chain) { + $this->transactionStart(); + } + return true; } /** - * Increase the nested transaction level by one + * Indicate whether or not the current transaction is nested + * Returns false if there are no transactions, or the open + * transaction is the 'outer' transaction, i.e. not nested. + * + * @return bool */ - protected function transactionDepthIncrease() + protected function transactionIsNested() + { + return $this->transactionNesting > 1; + } + + /** + * Increase the nested transaction level by one + * savepoint tracking is optional because BEGIN + * opens a transaction, but is not a named reference + * + * @param string $savepoint + */ + protected function transactionDepthIncrease($savepoint = null) { ++$this->transactionNesting; + if ($savepoint) { + array_push($this->transactionSavepoints, $savepoint); + } } /** * Decrease the nested transaction level by one + * and reduce the savepoint tracking if we are + * nesting, as the last one is no longer valid */ protected function transactionDepthDecrease() { + if ($this->transactionIsNested()) { + array_pop($this->transactionSavepoints); + } --$this->transactionNesting; } @@ -555,6 +596,7 @@ class SQLite3Database extends Database protected function resetTransactionNesting() { $this->transactionNesting = 0; + $this->transactionSavepoints = []; } public function query($sql, $errorLevel = E_USER_ERROR) From 5eacbe7842bd6cd7936d1e329022d29b457a1e83 Mon Sep 17 00:00:00 2001 From: NightjarNZ Date: Tue, 16 Oct 2018 21:57:51 +1300 Subject: [PATCH 10/14] FIX convert index definitions to reflect actual support It is not uncommon for an index to be defined as e.g. 'fulltext' which SQLite3 does not support without a module to create a virtual table (rather than an index on an existing one). The code already in place sees that definitions be updated to 'index' on the fly during creation and later inspection (indexList) - which causes issue when comparing existing table definitions to what SilverStripe expects by DataObject configuration. This discrepency leads to tables constantly being marked to update, although effectively nothing actually changes. We can save these CPU cycles and a bit of head scratching by converting to a supported index type. --- code/SQLite3Database.php | 2 +- code/SQLite3SchemaManager.php | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index 07942ca..b6cbd9a 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -491,7 +491,7 @@ class SQLite3Database extends Database /** * Fetch the name of the most recent savepoint - * + * * @return string */ protected function getTransactionSavepointName() diff --git a/code/SQLite3SchemaManager.php b/code/SQLite3SchemaManager.php index a993dc7..119085b 100644 --- a/code/SQLite3SchemaManager.php +++ b/code/SQLite3SchemaManager.php @@ -286,7 +286,7 @@ class SQLite3SchemaManager extends DBSchemaManager // Then alter the table column $database = $this->database; - $database->withTransaction(function() use ($database, $queries, $indexList) { + $database->withTransaction(function () use ($database, $queries, $indexList) { foreach ($queries as $query) { $database->query($query . ';'); } @@ -330,7 +330,7 @@ class SQLite3SchemaManager extends DBSchemaManager // Then alter the table column $database = $this->database; - $database->withTransaction(function() use ($database, $queries) { + $database->withTransaction(function () use ($database, $queries) { foreach ($queries as $query) { $database->query($query . ';'); } @@ -431,6 +431,15 @@ class SQLite3SchemaManager extends DBSchemaManager return $this->buildSQLiteIndexName($table, $index); } + protected function convertIndexSpec($indexSpec) + { + $supportedIndexTypes = ['index', 'unique']; + if (isset($indexSpec['type']) && !in_array($indexSpec['type'], $supportedIndexTypes)) { + $indexSpec['type'] = 'index'; + } + return parent::convertIndexSpec($indexSpec); + } + public function indexList($table) { $indexList = array(); From c2569099cea317d6f2cefd281a3153e8671670a1 Mon Sep 17 00:00:00 2001 From: NightjarNZ Date: Thu, 18 Oct 2018 22:12:06 +1300 Subject: [PATCH 11/14] correct @deprecated docblock to be Draft PSR-5 compliant --- code/SQLite3Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index b6cbd9a..0575019 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -611,7 +611,7 @@ class SQLite3Database extends Database /** * Inspect a SQL query prior to execution - * @deprecated 2..3 + * @deprecated 2.2.0:3.0.0 * @param string $sql */ protected function inspectQuery($sql) From e919bdffd9756b1a2331c8d9c155b0c72f7eb1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sam=20Minn=C3=A9e?= Date: Fri, 19 Oct 2018 11:54:37 +1300 Subject: [PATCH 12/14] Correct travis badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4aafe3f..1aa76bc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SQLite3 Module -[![Build Status](https://travis-ci.org/silverstripe-labs/silverstripe-sqlite3.png?branch=master)](https://travis-ci.org/silverstripe-labs/silverstripe-sqlite3) +[![Build Status](https://travis-ci.org/silverstripe/silverstripe-sqlite3.png?branch=master)](https://travis-ci.org/silverstripe/silverstripe-sqlite3) [![SilverStripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/) ## Maintainer Contact From 1589089f5b4364320a2c4613169ad014ab7120a4 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 19 Oct 2018 12:10:39 +1300 Subject: [PATCH 13/14] FIX: Better travis matrix - Test PHP 7.2 and 7.3 - Test against all 4.x minor releases --- .travis.yml | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 609eb90..e639a37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,33 +6,51 @@ cache: directories: - $HOME/.composer/cache/files -php: - - 5.6 - - 7.0 - - 7.1 - env: global: - DB=SQLITE - - PDO=1 matrix: fast_finish: true include: + - php: 5.6 - env: PDO=0 PHPCS_TEST=1 + env: + - CORE_VERSION=1.0.x-dev + - PDO=0 + + - php: 7.0 + env: + - CORE_VERSION=1.1.x-dev + - PDO=1 + + - php: 7.1 + env: + - CORE_VERSION=4.2.x-dev + - PDO=0 + + - php: 7.2 + env: + - CORE_VERSION=4.3.x-dev + - PDO=0 + + - php: 7.3 + env: + - CORE_VERSION=4.x-dev + - PDO=1 + - PHPCS_TEST=1 before_script: # Init PHP - phpenv rehash - - phpenv config-rm xdebug.ini + - phpenv config-rm xdebug.ini || true - export PATH=~/.composer/vendor/bin:$PATH - echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini # Install composer dependencies - composer validate - - composer require --no-update silverstripe/recipe-cms:1.0.x-dev - - composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile + - composer require --no-update silverstripe/recipe-cms:$CORE_VERSION + - composer install --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile - if [[ $PHPCS_TEST ]]; then composer global require squizlabs/php_codesniffer:^3 --prefer-dist --no-interaction --no-progress --no-suggest -o; fi script: From 3c8a06f5b9fc2aa652826ddda3f0e80ce0f752e7 Mon Sep 17 00:00:00 2001 From: Mark Cameron Date: Wed, 9 Jan 2019 10:59:28 +1300 Subject: [PATCH 14/14] Added quotes to values in connectors.yml --- _config/connectors.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/_config/connectors.yml b/_config/connectors.yml index 0178a62..7d79295 100644 --- a/_config/connectors.yml +++ b/_config/connectors.yml @@ -5,28 +5,28 @@ SilverStripe\Core\Injector\Injector: SQLite3PDODatabase: class: SilverStripe\SQLite\SQLite3Database properties: - connector: %$PDOConnector - schemaManager: %$SQLite3SchemaManager - queryBuilder: %$SQLite3QueryBuilder + connector: '%$PDOConnector' + schemaManager: '%$SQLite3SchemaManager' + queryBuilder: '%$SQLite3QueryBuilder' SQLite3Database: class: SilverStripe\SQLite\SQLite3Database properties: - connector: %$SQLite3Connector - schemaManager: %$SQLite3SchemaManager - queryBuilder: %$SQLite3QueryBuilder + connector: '%$SQLite3Connector' + schemaManager: '%$SQLite3SchemaManager' + queryBuilder: '%$SQLite3QueryBuilder' # Legacy connector names SQLiteDatabase: class: SilverStripe\SQLite\SQLite3Database properties: - connector: %$SQLite3Connector - schemaManager: %$SQLite3SchemaManager - queryBuilder: %$SQLite3QueryBuilder + connector: '%$SQLite3Connector' + schemaManager: '%$SQLite3SchemaManager' + queryBuilder: '%$SQLite3QueryBuilder' SQLitePDODatabase: class: SilverStripe\SQLite\SQLite3Database properties: - connector: %$SQLite3Connector - schemaManager: %$SQLite3SchemaManager - queryBuilder: %$SQLite3QueryBuilder + connector: '%$SQLite3Connector' + schemaManager: '%$SQLite3SchemaManager' + queryBuilder: '%$SQLite3QueryBuilder' SQLite3Connector: class: SilverStripe\SQLite\SQLite3Connector type: prototype