Commit Graph

85 Commits

Author SHA1 Message Date
Elliot Sawyer
f9dfa9f34c PHP 8.1 compatibility 2022-07-20 19:17:01 +12:00
Michal Kleiner
22d46a5ef8 Override transaction mode support check method as these are not supported by SQLite 2019-09-16 14:50:16 +12:00
NightjarNZ
c2569099ce correct @deprecated docblock to be Draft PSR-5 compliant 2018-10-18 22:12:06 +13:00
NightjarNZ
5eacbe7842 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.
2018-10-16 21:57:51 +13:00
NightjarNZ
0fa6b0fde7 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 <savepoint>.

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.
2018-10-11 22:07:23 +13:00
NightjarNZ
62ef14f711 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.
2018-10-11 00:02:12 +13:00
Daniel Hensby
4167d9fd1a FIX Make sure nested transactions get reset on implicit commits 2018-07-05 15:31:05 +12:00
Damian Mooyman
a38ab53e33
Merge pull request #39 from dhensby/pulls/2.0/nested-transactions
FIX Add nested transaction support
2018-03-13 09:25:09 +13:00
Mike Cochrane
34648b9c05
Missing 'n' 2018-02-13 14:18:48 +13:00
Daniel Hensby
f176bb0a39
FIX Add nested transaction support 2018-02-09 11:24:35 +00:00
Damian Mooyman
9b00630616
Merge remote-tracking branch 'origin/2.0' into 2.1
# Conflicts:
#	code/SQLite3Database.php
#	code/SQLiteDatabaseConfigurationHelper.php
2017-12-07 16:18:19 +13:00
Damian Mooyman
e8f4e55b8a
Merge remote-tracking branch 'origin/1.4' into 2.0
# Conflicts:
#	.travis.yml
#	code/SQLite3Database.php
#	composer.json
2017-12-07 16:16:11 +13:00
Damian Mooyman
24cf40beaf
Update config / code styles for 4.0
Related https://github.com/silverstripe/silverstripe-framework/issues/7590
2017-11-23 14:11:10 +13:00
Daniel Hensby
4aad42c084
[SS-2017-008] Fix SQL injection in search engine 2017-11-21 16:16:32 +00:00
Mike Cochrane
dd81faac7b Update for latest SS4 changes 2016-10-10 11:13:18 +13:00
Damian Mooyman
6d74fc05cf
BUG Fix errors when 'path' isn't declared explicitly 2016-09-30 15:45:13 +13:00
Damian Mooyman
b710ef04b3 Rename SS_ prefixed classes (#26) 2016-09-09 15:46:48 +12:00
Damian Mooyman
1cb63311d8
Upgrade for silverstripe namespaces 2016-09-08 15:41:17 +12:00
Damian Mooyman
99e6081c42
Update for SilverStripe\CMS namespace 2016-08-12 13:22:58 +12:00
Damian Mooyman
72638cf40e BUG Fix incorrect upgrade / rules 2016-07-05 16:27:01 +12:00
Damian Mooyman
e36e74ab2f API Apply SilverStripe\SQLite namespace to module 2016-06-29 13:55:45 +12:00
helpfulrobot
b2d40ed61e Converted to PSR-2 2015-12-18 07:11:01 +13:00
Damian Mooyman
e76bd4b1a1 API Update master to new major version for 4.0 compat 2015-10-16 11:17:24 +13:00
Damian Mooyman
b3b82810a0 API Upgraded module to use new database ORM
API Use SQLite3::version to directly get connection version
2014-07-11 09:06:33 +12:00
Damian Mooyman
c8235c0f06 BUG Properly deprecate old 'memory' config setting 2014-03-06 10:40:14 +13:00
Sean Harvey
69fee85469 Change database path to allow use of ":memory:"
Instead of using a custom "memory" key in the $databaseConfig
which never really got used this now allows someone to simply enable
in-memory databases by setting the path to ":memory:" or to use the
following environment variable:

define('SS_SQLITE_DATABASE_PATH', ':memory:');
2014-02-18 16:44:00 +13:00
Ingo Schommer
589c35dfdb Defaulting to memory DB if 'path' not specified
Given that we're only using SQLite3 for testing, this is a
reasonable default - and it means we don't need to have a
special _config.php for CI.
2013-03-28 21:01:55 +01:00
Ingo Schommer
069ed7ff52 BUG Normalize index specs to avoid false positives on schema regen 2012-12-11 14:40:49 +01:00
Ingo Schommer
36f15a52b4 BUG Using GLOB for case sensitive matches in SQLite3
As opposed to LIKE, the GLOB operator is case sensitive by default
in SQlite3. It uses "*" instead of "%" for wildcards,
which necessitated a new SearchFilter->getWildcard() method.

SQlite3 doesn't support per-term modifiers,
COLLATE BINARY LIKE is case insensitive by default
unless the field collation is set up accordingly.
There's connection-level modifiers (PRAGMA case_sensitive_like = true),
but that would affect all comparisators in the executed query.
2012-12-11 01:43:37 +01:00
Ingo Schommer
96fdd9178a BUG Removed MetaTitle and MetaKeywords cols from search engine
They have been removed from core in the 3.1 release line.
2012-12-10 23:38:35 +01:00
Normann Lou
583e88b571 MINOR: use framework to replace sapphire for inline document. 2012-07-16 14:45:36 +12:00
Ingo Schommer
7c9156ebaf BUG Ignore col quotes in renameTable() 2012-07-06 14:05:59 +02:00
Ingo Schommer
356872236a Added supportsTimezoneOverride() method 2012-07-06 11:37:11 +02:00
Ingo Schommer
5594036d0c BUGFIX: indexList() returns indexes escaped by double quotes
See a1e7c1f9b in framework for same commit related to MySQLDatabase.
2012-07-05 15:08:01 +02:00
Ingo Schommer
14601368b8 API Don't run in-memory by default.
While the SQLite3 module is predominantly used for testing,
its best to leave this decision to the code using it.
We should default to a conservative setting (slower, but persistent).
Also remove coupling to SapphireTest when setting this value.
Don't bother creating the directory if running in-memory.
2012-07-05 13:43:46 +02:00
Ingo Schommer
7061e7a7c6 BUG Allow backslashes in fieldList() for namespaced classes 2012-07-05 12:16:20 +02:00
Sean Harvey
43433fbe46 BUGFIX Updating SQLite3Database::searchEngine() for SS3 2012-05-08 15:19:28 +12:00
Sean Harvey
ecda380925 ENHANCEMENT Use simpler query syntax for SS3 2012-05-04 10:02:00 +12:00
Sean Harvey
e9edf8b381 MINOR Removing sqlQueryToString as it's not required anymore in SS 3.0, SQLQuery does all the work for us instead. 2012-05-01 12:12:25 +12:00
Sean Harvey
932ffec5b6 BUGFIX Fixing support for SS 3.0 2012-05-01 11:27:22 +12:00
Sam Minnee
bac4aac13f BUGFIX: Updated sqlite3 module to work in SS3 while still supporting SS2.4. 2011-12-17 12:05:42 +13:00
Ingo Schommer
61820b08de MINOR Using new PaginatedList API in searchEngine() (if available) 2011-10-07 11:30:27 +02:00
Ingo Schommer
294c0d5c6d Merge remote-tracking branch 'smindel/master' 2011-09-15 16:06:00 +02:00
Ingo Schommer
1b36c75f0a ENHANCEMENT Optionally filtering by new File.ShowInSearch flag in SQLite3Database->searcnEngine() 2011-09-15 16:03:03 +02:00
Ingo Schommer
2e1dc517e6 BUGFIX Allow omitting FROM clause in sqlQueryToString() 2011-05-19 11:36:39 +12:00
Ingo Schommer
0dfbf538b6 BUGFIX Fixed supportsTransactions() to use version_compare() so it doesn't break on non-scalar versions like '3.7.1' 2011-04-06 14:12:47 +02:00
Ingo Schommer
f7fd2d46da BUGFIX Fixed supportsTransactions() to use version_compare() so it doesn't break on non-scalar versions like '3.7.1' 2011-04-06 22:39:57 +12:00
Stig Lindqvist
b65482f8d1 Added missing method clear_cached_fieldlist existing in tests and at least in MySQLDatabase 2011-03-28 13:18:35 +02:00
Ingo Schommer
a4f4d14eb9 API CHANGE Renamed transactions methods from endTransaction() to transactionEnd(), startTransaction() to transactionStart() to comply with new sapphire trunk API 2011-03-28 12:22:00 +02:00
Ingo Schommer
7205a9861f API CHANGE Renamed transactions methods from endTransaction() to transactionEnd(), startTransaction() to transactionStart() to comply with new sapphire trunk API 2011-03-11 16:37:22 +13:00