mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 17:05:37 +02:00
Merge remote-tracking branch 'origin/1.4' into 2.0
# Conflicts: # .travis.yml # code/SQLite3Database.php # composer.json
This commit is contained in:
commit
e8f4e55b8a
@ -178,7 +178,8 @@ class SQLite3Database extends Database
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPath() {
|
||||
public function getPath()
|
||||
{
|
||||
if ($this->getLivesInMemory()) {
|
||||
return null;
|
||||
}
|
||||
@ -278,9 +279,19 @@ class SQLite3Database extends Database
|
||||
* @param bool $invertedMatch
|
||||
* @return PaginatedList DataObjectSet of result pages
|
||||
*/
|
||||
public function searchEngine($classesToSearch, $keywords, $start, $pageLength, $sortBy = "Relevance DESC",
|
||||
$extraFilter = "", $booleanSearch = false, $alternativeFileFilter = "", $invertedMatch = false
|
||||
public function searchEngine(
|
||||
$classesToSearch,
|
||||
$keywords,
|
||||
$start,
|
||||
$pageLength,
|
||||
$sortBy = "Relevance DESC",
|
||||
$extraFilter = "",
|
||||
$booleanSearch = false,
|
||||
$alternativeFileFilter = "",
|
||||
$invertedMatch = false
|
||||
) {
|
||||
$start = (int)$start;
|
||||
$pageLength = (int)$pageLength;
|
||||
$keywords = $this->escapeString(str_replace(array('*','+','-','"','\''), '', $keywords));
|
||||
$htmlEntityKeywords = htmlentities(utf8_decode($keywords));
|
||||
|
||||
@ -307,7 +318,7 @@ class SQLite3Database extends Database
|
||||
$extraFilters[$fileClass] .= " AND ShowInSearch <> 0";
|
||||
}
|
||||
|
||||
$limit = $start . ", " . (int) $pageLength;
|
||||
$limit = $start . ", " . $pageLength;
|
||||
|
||||
$notMatch = $invertedMatch ? "NOT " : "";
|
||||
if ($keywords) {
|
||||
@ -464,7 +475,12 @@ class SQLite3Database extends Database
|
||||
$this->query("DELETE FROM \"$table\"");
|
||||
}
|
||||
|
||||
public function comparisonClause($field, $value, $exact = false, $negate = false, $caseSensitive = null,
|
||||
public function comparisonClause(
|
||||
$field,
|
||||
$value,
|
||||
$exact = false,
|
||||
$negate = false,
|
||||
$caseSensitive = null,
|
||||
$parameterised = false
|
||||
) {
|
||||
if ($exact && !$caseSensitive) {
|
||||
|
@ -74,7 +74,6 @@ class SQLite3SchemaManager extends DBSchemaManager
|
||||
$databases = array();
|
||||
if ($files !== false) {
|
||||
foreach ($files as $file) {
|
||||
|
||||
// Filter non-files
|
||||
if (!is_file("$directory/$file")) {
|
||||
continue;
|
||||
@ -173,8 +172,14 @@ class SQLite3SchemaManager extends DBSchemaManager
|
||||
return $table;
|
||||
}
|
||||
|
||||
public function alterTable($tableName, $newFields = null, $newIndexes = null, $alteredFields = null,
|
||||
$alteredIndexes = null, $alteredOptions = null, $advancedOptions = null
|
||||
public function alterTable(
|
||||
$tableName,
|
||||
$newFields = null,
|
||||
$newIndexes = null,
|
||||
$alteredFields = null,
|
||||
$alteredIndexes = null,
|
||||
$alteredOptions = null,
|
||||
$advancedOptions = null
|
||||
) {
|
||||
if ($newFields) {
|
||||
foreach ($newFields as $fieldName => $fieldSpec) {
|
||||
@ -345,8 +350,10 @@ class SQLite3SchemaManager extends DBSchemaManager
|
||||
|
||||
$fieldList = array();
|
||||
if ($sqlCreate && $sqlCreate['sql']) {
|
||||
preg_match('/^[\s]*CREATE[\s]+TABLE[\s]+[\'"]?[a-zA-Z0-9_\\\]+[\'"]?[\s]*\((.+)\)[\s]*$/ims',
|
||||
$sqlCreate['sql'], $matches
|
||||
preg_match(
|
||||
'/^[\s]*CREATE[\s]+TABLE[\s]+[\'"]?[a-zA-Z0-9_\\\]+[\'"]?[\s]*\((.+)\)[\s]*$/ims',
|
||||
$sqlCreate['sql'],
|
||||
$matches
|
||||
);
|
||||
$fields = isset($matches[1])
|
||||
? preg_split('/,(?=(?:[^\'"]*$)|(?:[^\'"]*[\'"][^\'"]*[\'"][^\'"]*)*$)/x', $matches[1])
|
||||
@ -425,7 +432,6 @@ class SQLite3SchemaManager extends DBSchemaManager
|
||||
|
||||
// Enumerate each index and related fields
|
||||
foreach ($this->query("PRAGMA index_list(\"$table\")") as $index) {
|
||||
|
||||
// The SQLite internal index name, not the actual Silverstripe name
|
||||
$indexName = $index["name"];
|
||||
$indexType = $index['unique'] ? 'unique' : 'index';
|
||||
|
Loading…
Reference in New Issue
Block a user