Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Filtering a table now updates the row count and page count in the bottom-right to match the filtered result, instead of showing the whole-table totals.
- Reopening a table now restores the filter you had applied, instead of clearing it. Filters are remembered per connection. (#1347)
- Importing connections from TablePlus brings over saved passwords again. A recent release looked under the wrong keychain name, so connections imported with no passwords and no warning.
- Importing an SSH connection from TablePlus no longer fills in a fake private key path such as `~/.ssh/Import a private key...` when no key was selected. Empty TLS certificate paths are skipped too.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ public protocol PluginDatabaseDriver: AnyObject, Sendable {
limit: Int,
offset: Int
) -> String?
// Filtered row count (optional, for NoSQL plugins; SQL plugins use COUNT(*) WHERE)
func fetchFilteredRowCount(
table: String,
filters: [(column: String, op: String, value: String)],
logicMode: String
) async throws -> Int?

// Statement generation (optional, for NoSQL plugins)
func generateStatements(
Expand Down Expand Up @@ -299,6 +305,11 @@ public extension PluginDatabaseDriver {
limit: Int,
offset: Int
) -> String? { nil }
func fetchFilteredRowCount(
table: String,
filters: [(column: String, op: String, value: String)],
logicMode: String
) async throws -> Int? { nil }

func generateStatements(
table: String,
Expand Down
4 changes: 2 additions & 2 deletions Plugins/BigQueryDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<key>TableProMinAppVersion</key>
<string>0.42.0</string>
<key>TableProPluginKitVersion</key>
<integer>15</integer>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Plugins/CSVExportPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesExportFormatIds</key>
<array>
<string>csv</string>
Expand Down
2 changes: 1 addition & 1 deletion Plugins/CassandraDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>NSPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).CassandraPlugin</string>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Plugins/ClickHouseDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesDatabaseTypeIds</key>
<array>
<string>ClickHouse</string>
Expand Down
4 changes: 2 additions & 2 deletions Plugins/CloudflareD1DriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<key>TableProMinAppVersion</key>
<string>0.42.0</string>
<key>TableProPluginKitVersion</key>
<integer>15</integer>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Plugins/DuckDBDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
</dict>
</plist>
4 changes: 2 additions & 2 deletions Plugins/DynamoDBDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<key>TableProMinAppVersion</key>
<string>0.42.0</string>
<key>TableProPluginKitVersion</key>
<integer>15</integer>
</dict>
</plist>
4 changes: 2 additions & 2 deletions Plugins/EtcdDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<key>TableProMinAppVersion</key>
<string>0.42.0</string>
<key>TableProPluginKitVersion</key>
<integer>15</integer>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Plugins/JSONExportPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesExportFormatIds</key>
<array>
<string>json</string>
Expand Down
4 changes: 2 additions & 2 deletions Plugins/LibSQLDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<key>TableProMinAppVersion</key>
<string>0.42.0</string>
<key>TableProPluginKitVersion</key>
<integer>15</integer>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Plugins/MQLExportPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesExportFormatIds</key>
<array>
<string>mql</string>
Expand Down
2 changes: 1 addition & 1 deletion Plugins/MSSQLDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Plugins/MongoDBDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
</dict>
</plist>
14 changes: 14 additions & 0 deletions Plugins/MongoDBDriverPlugin/MongoDBPluginDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,20 @@ final class MongoDBPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
return Int(count)
}

func fetchFilteredRowCount(
table: String,
filters: [(column: String, op: String, value: String)],
logicMode: String
) async throws -> Int? {
guard let conn = mongoConnection else {
throw MongoDBPluginError.notConnected
}

let filterJson = MongoDBQueryBuilder().buildFilterDocument(from: filters, logicMode: logicMode)
let count = try await conn.countDocuments(database: currentDb, collection: table, filter: filterJson)
return Int(count)
}

func fetchTableDDL(table: String, schema: String?) async throws -> String {
guard let conn = mongoConnection else {
throw MongoDBPluginError.notConnected
Expand Down
2 changes: 1 addition & 1 deletion Plugins/MySQLDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesDatabaseTypeIds</key>
<array>
<string>MySQL</string>
Expand Down
2 changes: 1 addition & 1 deletion Plugins/OracleDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Plugins/PostgreSQLDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesDatabaseTypeIds</key>
<array>
<string>PostgreSQL</string>
Expand Down
2 changes: 1 addition & 1 deletion Plugins/RedisDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>NSPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).RedisPlugin</string>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesDatabaseTypeIds</key>
<array>
<string>Redis</string>
Expand Down
2 changes: 1 addition & 1 deletion Plugins/SQLExportPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesExportFormatIds</key>
<array>
<string>sql</string>
Expand Down
2 changes: 1 addition & 1 deletion Plugins/SQLImportPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesImportFormatIds</key>
<array>
<string>sql</string>
Expand Down
2 changes: 1 addition & 1 deletion Plugins/SQLiteDriverPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesDatabaseTypeIds</key>
<array>
<string>SQLite</string>
Expand Down
3 changes: 3 additions & 0 deletions Plugins/TableProPluginKit/PluginDatabaseDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public protocol PluginDatabaseDriver: AnyObject, Sendable {
// Query building (optional, for NoSQL plugins)
func buildBrowseQuery(table: String, sortColumns: [(columnIndex: Int, ascending: Bool)], columns: [String], limit: Int, offset: Int) -> String?
func buildFilteredQuery(table: String, filters: [(column: String, op: String, value: String)], logicMode: String, sortColumns: [(columnIndex: Int, ascending: Bool)], columns: [String], limit: Int, offset: Int) -> String?
// Filtered row count (optional, for NoSQL plugins; SQL plugins use COUNT(*) WHERE)
func fetchFilteredRowCount(table: String, filters: [(column: String, op: String, value: String)], logicMode: String) async throws -> Int?
// Statement generation (optional, for NoSQL plugins)
func generateStatements(table: String, columns: [String], primaryKeyColumns: [String], changes: [PluginRowChange], insertedRowData: [Int: [PluginCellValue]], deletedRowIndices: Set<Int>, insertedRowIndices: Set<Int>) -> [(statement: String, parameters: [PluginCellValue])]?

Expand Down Expand Up @@ -249,6 +251,7 @@ public extension PluginDatabaseDriver {

func buildBrowseQuery(table: String, sortColumns: [(columnIndex: Int, ascending: Bool)], columns: [String], limit: Int, offset: Int) -> String? { nil }
func buildFilteredQuery(table: String, filters: [(column: String, op: String, value: String)], logicMode: String, sortColumns: [(columnIndex: Int, ascending: Bool)], columns: [String], limit: Int, offset: Int) -> String? { nil }
func fetchFilteredRowCount(table: String, filters: [(column: String, op: String, value: String)], logicMode: String) async throws -> Int? { nil }
func generateStatements(table: String, columns: [String], primaryKeyColumns: [String], changes: [PluginRowChange], insertedRowData: [Int: [PluginCellValue]], deletedRowIndices: Set<Int>, insertedRowIndices: Set<Int>) -> [(statement: String, parameters: [PluginCellValue])]? { nil }

func generateAddColumnSQL(table: String, column: PluginColumnDefinition) -> String? { nil }
Expand Down
2 changes: 1 addition & 1 deletion Plugins/XLSXExportPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>TableProPluginKitVersion</key>
<integer>14</integer>
<integer>15</integer>
<key>TableProProvidesExportFormatIds</key>
<array>
<string>xlsx</string>
Expand Down
2 changes: 2 additions & 0 deletions TablePro/Core/Coordinators/FilterCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ final class FilterCoordinator {
guard let self, confirmed else { return }
guard capturedTabIndex < parent.tabManager.tabs.count else { return }

parent.tabManager.mutate(at: capturedTabIndex) { $0.pagination.reset() }

let tab = parent.tabManager.tabs[capturedTabIndex]
let buffer = parent.tabSessionRegistry.tableRows(for: tab.id)
let newQuery = parent.queryBuilder.buildBaseQuery(
Expand Down
Loading
Loading