mirror of
https://github.com/groue/GRDB.swift
synced 2026-12-05 05:18:44 +00:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c541a99b5 | ||
|
|
2cf6c756e1 | ||
|
|
d56223cba1 | ||
|
|
bc4fd8ff58 | ||
|
|
cdb181d9ca | ||
|
|
f4b4035704 | ||
|
|
57a4587b5b | ||
|
|
ae837a3a44 | ||
|
|
c64bc11627 | ||
|
|
de96d5f6f0 | ||
|
|
d3d2a9c4f7 | ||
|
|
f10c74c374 | ||
|
|
fcfdab2f11 | ||
|
|
f441341543 |
No files matched your search
+13
-1
@@ -7,7 +7,7 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
|
||||
|
||||
#### 6.x Releases
|
||||
|
||||
- `6.29.x` Releases - [6.29.0](#6290) - [6.29.1](#6291)
|
||||
- `6.29.x` Releases - [6.29.0](#6290) - [6.29.1](#6291) - [6.29.2](#6292) - [6.29.3](#6293)
|
||||
- `6.28.x` Releases - [6.28.0](#6280)
|
||||
- `6.27.x` Releases - [6.27.0](#6270)
|
||||
- `6.26.x` Releases - [6.26.0](#6260)
|
||||
@@ -127,6 +127,18 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
|
||||
|
||||
---
|
||||
|
||||
## 6.29.3
|
||||
|
||||
Released September 7, 2024
|
||||
|
||||
- **Fixed**: [#1613](https://github.com/groue/GRDB.swift/pull/1613) by [@groue](https://github.com/groue): Avoid SQLite misuse when releasing memory on a closed database connection
|
||||
|
||||
## 6.29.2
|
||||
|
||||
Released August 24, 2024
|
||||
|
||||
- **New**: [#1593](https://github.com/groue/GRDB.swift/pull/1593) by [@mingchen](https://github.com/mingchen): Fix sample code in README
|
||||
|
||||
## 6.29.1
|
||||
|
||||
Released August 7, 2024
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GRDB.swift'
|
||||
s.version = '6.29.1'
|
||||
s.version = '6.29.3'
|
||||
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.summary = 'A toolkit for SQLite databases, with a focus on application development.'
|
||||
|
||||
@@ -124,8 +124,6 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
|
||||
// MARK: - SQLite C API
|
||||
|
||||
// TODO: make it non optional, since one can't get a `Database` instance
|
||||
// after `close()`.
|
||||
/// The raw SQLite connection, suitable for the SQLite C API.
|
||||
///
|
||||
/// The result is nil after the database has been successfully closed with
|
||||
@@ -1577,7 +1575,9 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
/// Frees as much memory as possible.
|
||||
public func releaseMemory() {
|
||||
SchedulingWatchdog.preconditionValidQueue(self)
|
||||
sqlite3_db_release_memory(sqliteConnection)
|
||||
if let sqliteConnection {
|
||||
sqlite3_db_release_memory(sqliteConnection)
|
||||
}
|
||||
schemaCache.clear()
|
||||
internalStatementCache.clear()
|
||||
publicStatementCache.clear()
|
||||
@@ -1923,7 +1923,6 @@ extension Database {
|
||||
/// The SQL for the column type (`"TEXT"`, `"BLOB"`, etc.)
|
||||
public let rawValue: String
|
||||
|
||||
// TODO: GRDB7 make it an failable initializer that returns nil when rawValue is empty (or blank).
|
||||
/// Creates an SQL column type.
|
||||
public init(rawValue: String) {
|
||||
self.rawValue = rawValue
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#if os(Linux)
|
||||
#if canImport(string_h)
|
||||
import string_h
|
||||
#elseif os(Linux)
|
||||
import Glibc
|
||||
#endif
|
||||
|
||||
#if canImport(Darwin)
|
||||
#elseif os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
import Darwin
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import Foundation
|
||||
|
||||
@usableFromInline
|
||||
struct SQLiteDateParser {
|
||||
// swiftlint:disable:next unneeded_synthesized_initializer
|
||||
@usableFromInline
|
||||
init() { }
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ struct SQLRelation {
|
||||
var source: SQLSource
|
||||
var selectionPromise: DatabasePromise<[SQLSelection]>
|
||||
var filterPromise: DatabasePromise<SQLExpression>?
|
||||
var ordering: SQLRelation.Ordering = SQLRelation.Ordering()
|
||||
var ordering = SQLRelation.Ordering()
|
||||
var ctes: OrderedDictionary<String, SQLCTE> = [:] // See also `allCTEs`
|
||||
var children: OrderedDictionary<String, Child> = [:]
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ extension RecordEncoder: SingleValueEncodingContainer {
|
||||
unsupportedSingleValueEncoding()
|
||||
}
|
||||
|
||||
func encode<T>(_ value: T) throws where T : Encodable {
|
||||
func encode<T>(_ value: T) throws where T: Encodable {
|
||||
if let record = value as? EncodableRecord {
|
||||
try record.encode(to: &_persistenceContainer)
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// swift-tools-version:5.7
|
||||
// swift-tools-version:6.0
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import Foundation
|
||||
@@ -34,7 +34,7 @@ let package = Package(
|
||||
name: "GRDB",
|
||||
defaultLocalization: "en", // for tests
|
||||
platforms: [
|
||||
.iOS(.v11),
|
||||
.iOS(.v18),
|
||||
.macOS(.v10_13),
|
||||
.tvOS(.v11),
|
||||
.watchOS(.v4),
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<a href="https://github.com/groue/GRDB.swift/actions/workflows/CI.yml"><img alt="CI Status" src="https://github.com/groue/GRDB.swift/actions/workflows/CI.yml/badge.svg?branch=master"></a>
|
||||
</p>
|
||||
|
||||
**Latest release**: August 7, 2024 • [version 6.29.1](https://github.com/groue/GRDB.swift/tree/v6.29.1) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 5 to GRDB 6](Documentation/GRDB6MigrationGuide.md)
|
||||
**Latest release**: September 7, 2024 • [version 6.29.3](https://github.com/groue/GRDB.swift/tree/v6.29.3) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 5 to GRDB 6](Documentation/GRDB6MigrationGuide.md)
|
||||
|
||||
**Requirements**: iOS 11.0+ / macOS 10.13+ / tvOS 11.0+ / watchOS 4.0+ • SQLite 3.19.3+ • Swift 5.7+ / Xcode 14+
|
||||
|
||||
@@ -5743,9 +5743,7 @@ Open a read-only connection to your resource:
|
||||
// HOW TO open a read-only connection to a database resource
|
||||
|
||||
// Get the path to the database resource.
|
||||
if let dbPath = Bundle.main.path(forResource: "db", ofType: "sqlite")
|
||||
|
||||
if let dbPath {
|
||||
if let dbPath = Bundle.main.path(forResource: "db", ofType: "sqlite") {
|
||||
// If the resource exists, open a read-only connection.
|
||||
// Writes are disallowed because resources can not be modified.
|
||||
var config = Configuration()
|
||||
|
||||
@@ -15,6 +15,7 @@ disabled_rules:
|
||||
- is_disjoint
|
||||
- large_tuple
|
||||
- nesting
|
||||
- non_optional_string_data_conversion
|
||||
- opening_brace
|
||||
- redundant_optional_initialization
|
||||
- syntactic_sugar
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>6.29.1</string>
|
||||
<string>6.29.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -137,7 +137,6 @@ class DatabaseConfigurationTests: GRDBTestCase {
|
||||
}
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
XCTAssertEqual(error.message, "no such column: foo")
|
||||
XCTAssertEqual(error.sql, "SELECT \"foo\" FROM player")
|
||||
}
|
||||
|
||||
@@ -151,10 +150,6 @@ class DatabaseConfigurationTests: GRDBTestCase {
|
||||
}
|
||||
} catch let error as DatabaseError {
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
XCTAssert([
|
||||
"no such column: foo",
|
||||
"table player has no column named foo"]
|
||||
.contains(error.message))
|
||||
XCTAssertEqual(error.sql, "CREATE INDEX i ON player(\"foo\")")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,4 +439,12 @@ class DatabasePoolTests: GRDBTestCase {
|
||||
// In the zombie state, closing is a noop
|
||||
try dbPool.close()
|
||||
}
|
||||
|
||||
// Regression test for <https://github.com/groue/GRDB.swift/issues/1612>
|
||||
func test_releaseMemory_after_close() throws {
|
||||
let dbPool = try makeDatabasePool()
|
||||
try dbPool.read { _ in } // Create a reader
|
||||
try dbPool.close()
|
||||
dbPool.releaseMemory()
|
||||
}
|
||||
}
|
||||
@@ -467,4 +467,11 @@ class DatabaseQueueTests: GRDBTestCase {
|
||||
try db.execute(sql: "SELECT * FROM sqlite_master")
|
||||
}
|
||||
}
|
||||
|
||||
// Regression test for <https://github.com/groue/GRDB.swift/issues/1612>
|
||||
func test_releaseMemory_after_close() throws {
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.close()
|
||||
dbQueue.releaseMemory()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user