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
6 changes: 0 additions & 6 deletions Plugins/BigQueryDriverPlugin/BigQueryAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ private final class ImpersonatedServiceAccountDelegate: @unchecked Sendable, Big
}

private func fetchImpersonatedToken() async throws -> String {
// Get source token
let sourceToken = try await sourceProvider.accessToken()

// Exchange for impersonated token
Expand Down Expand Up @@ -649,7 +648,6 @@ internal final class OAuthBrowserAuthProvider: @unchecked Sendable, BigQueryAuth

let redirectUri = "http://127.0.0.1:\(port)"

// Build authorization URL
var components = URLComponents(string: Self.authEndpoint)
components?.queryItems = [
URLQueryItem(name: "client_id", value: clientId),
Expand All @@ -665,7 +663,6 @@ internal final class OAuthBrowserAuthProvider: @unchecked Sendable, BigQueryAuth
throw BigQueryError.authFailed("Failed to build OAuth authorization URL")
}

// Open browser
Self.logger.info("Opening browser for OAuth authorization")
await NSWorkspace.shared.open(authUrl)

Expand All @@ -680,13 +677,10 @@ internal final class OAuthBrowserAuthProvider: @unchecked Sendable, BigQueryAuth

Self.logger.info("Received OAuth authorization code")

// Exchange auth code for tokens
let tokens = try await exchangeAuthCode(code, redirectUri: redirectUri)

// Store refresh token
lock.withLock { _refreshToken = tokens.refreshToken }

// Cache access token
let newToken = CachedToken(
token: tokens.accessToken,
expiresAt: Date().addingTimeInterval(Double(tokens.expiresIn))
Expand Down
4 changes: 0 additions & 4 deletions Plugins/BigQueryDriverPlugin/BigQueryConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ internal final class BigQueryConnection: @unchecked Sendable {
_session = urlSession
}

// Test connectivity
do {
_ = try await executeQuery("SELECT 1")
} catch {
Expand Down Expand Up @@ -428,7 +427,6 @@ internal final class BigQueryConnection: @unchecked Sendable {
_currentJobLocation = jobRef.location
}

// Poll for completion if not done
let finalJobResponse: BQJobResponse
if let state = jobResponse.status?.state, state != "DONE" {
finalJobResponse = try await pollJobCompletion(
Expand All @@ -441,7 +439,6 @@ internal final class BigQueryConnection: @unchecked Sendable {
finalJobResponse = jobResponse
}

// Extract DML affected rows from job statistics
let dmlAffectedRows: Int
if let numStr = finalJobResponse.statistics?.query?.numDmlAffectedRows {
dmlAffectedRows = Int(numStr) ?? 0
Expand All @@ -453,7 +450,6 @@ internal final class BigQueryConnection: @unchecked Sendable {
let totalBytesBilled = finalJobResponse.statistics?.query?.totalBytesBilled
let cacheHit = finalJobResponse.statistics?.query?.cacheHit

// Fetch first page of results
let firstPage = try await getQueryResults(
jobId: jobId, location: jobRef.location, auth: auth, session: session
)
Expand Down
1 change: 0 additions & 1 deletion Plugins/BigQueryDriverPlugin/BigQueryOAuthServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ internal final class BigQueryOAuthServer: @unchecked Sendable {
func waitForAuthCode() async throws -> String {
try await withCheckedThrowingContinuation { cont in
lock.withLock { continuation = cont }
// Start 2-minute timeout
let task = Task {
try? await Task.sleep(nanoseconds: 120_000_000_000)
self.lock.withLock {
Expand Down
3 changes: 0 additions & 3 deletions Plugins/BigQueryDriverPlugin/BigQueryPluginDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,10 @@ internal final class BigQueryPluginDriver: PluginDatabaseDriver, @unchecked Send
)
}

// Tagged browsing queries
if BigQueryQueryBuilder.isTaggedQuery(trimmed) {
return try await executeTaggedQuery(trimmed, conn: conn, startTime: startTime)
}

// Regular GoogleSQL
let dataset = lock.withLock { _currentDataset }
let result: BQExecuteResult
do {
Expand Down Expand Up @@ -871,7 +869,6 @@ internal final class BigQueryPluginDriver: PluginDatabaseDriver, @unchecked Send
let typeNames = BigQueryTypeMapper.columnTypeNames(from: schema)
let rows = BigQueryTypeMapper.flattenRows(from: result.queryResponse, schema: schema)

// Update column cache
lock.withLock { _columnCache["\(params.dataset).\(params.table)"] = colNames }

return PluginQueryResult(
Expand Down
3 changes: 0 additions & 3 deletions Plugins/BigQueryDriverPlugin/BigQueryQueryBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ internal struct BigQueryQueryBuilder {
var sql = "SELECT * FROM \(fqTable)"
var whereClauses: [String] = []

// Filters
if let filters = params.filters, !filters.isEmpty {
let rawMode = params.logicMode ?? "AND"
let logicMode = (rawMode.uppercased() == "OR") ? "OR" : "AND"
Expand All @@ -183,7 +182,6 @@ internal struct BigQueryQueryBuilder {
}
}

// Search
if let searchText = params.searchText, !searchText.isEmpty {
let searchCols = params.searchColumns?.isEmpty == false
? params.searchColumns!
Expand All @@ -201,7 +199,6 @@ internal struct BigQueryQueryBuilder {
sql += " WHERE " + whereClauses.joined(separator: " AND ")
}

// Sort
if let sortColumns = params.sortColumns, !sortColumns.isEmpty {
let orderClauses = sortColumns.compactMap { sort -> String? in
guard sort.columnIndex < columns.count else { return nil }
Expand Down
3 changes: 0 additions & 3 deletions Plugins/CassandraDriverPlugin/CassandraConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ actor CassandraConnectionActor {

let startTime = Date()

// Prepare
let prepareFuture = cass_session_prepare(session, cql)
guard let prepareFuture else {
throw CassandraPluginError.queryFailed("Failed to prepare statement")
Expand All @@ -307,7 +306,6 @@ actor CassandraConnectionActor {
}
defer { cass_prepared_free(prepared) }

// Bind parameters
let statement = cass_prepared_bind(prepared)
guard let statement else {
throw CassandraPluginError.queryFailed("Failed to bind prepared statement")
Expand All @@ -331,7 +329,6 @@ actor CassandraConnectionActor {
}
}

// Execute
let future = cass_session_execute(session, statement)
guard let future else {
throw CassandraPluginError.queryFailed("Failed to execute prepared statement")
Expand Down
3 changes: 0 additions & 3 deletions Plugins/CassandraDriverPlugin/CassandraPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ internal final class CassandraPluginDriver: PluginDatabaseDriver, @unchecked Sen
"""
let result = try await execute(query: query)

// Parse and sort by kind order then position before mapping to PluginColumnInfo
struct RawColumn {
let name: String
let dataType: String
Expand Down Expand Up @@ -390,7 +389,6 @@ internal final class CassandraPluginDriver: PluginDatabaseDriver, @unchecked Sen
let kind = row[safe: 1]?.asText ?? "COMPOSITES"
let options = row[safe: 2]?.asText ?? ""

// Extract target column from options map
var targetColumns: [String] = []
if let targetRange = options.range(of: "target: ") {
let target = String(options[targetRange.upperBound...])
Expand Down Expand Up @@ -419,7 +417,6 @@ internal final class CassandraPluginDriver: PluginDatabaseDriver, @unchecked Sen
func fetchTableDDL(table: String, schema: String?) async throws -> String {
let ks = resolveKeyspace(schema)

// Build DDL from schema metadata
let columns = try await fetchColumns(table: table, schema: ks)

let partitionKeys = columns.filter(\.isPrimaryKey)
Expand Down
1 change: 0 additions & 1 deletion Plugins/DuckDBDriverPlugin/DuckDBPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@
await loadQuackExtension()

if !token.isEmpty {
try await connectionActor.executeQuery(QuackConnectBuilder.secretSQL(token: token))

Check warning on line 265 in Plugins/DuckDBDriverPlugin/DuckDBPlugin.swift

View workflow job for this annotation

GitHub Actions / macOS App Tests

result of call to 'executeQuery' is unused
}

try await connectionActor.executeQuery(QuackConnectBuilder.attachSQL(host: host, port: port, alias: alias))

Check warning on line 268 in Plugins/DuckDBDriverPlugin/DuckDBPlugin.swift

View workflow job for this annotation

GitHub Actions / macOS App Tests

result of call to 'executeQuery' is unused
try await connectionActor.executeQuery(QuackConnectBuilder.useSQL(alias: alias))

Check warning on line 269 in Plugins/DuckDBDriverPlugin/DuckDBPlugin.swift

View workflow job for this annotation

GitHub Actions / macOS App Tests

result of call to 'executeQuery' is unused

stateLock.lock()
_currentSchema = "main"
Expand Down Expand Up @@ -616,7 +616,6 @@
if let firstRow = nativeResult.rows.first, let sql = firstRow[0].asText {
var ddl = sql.hasSuffix(";") ? sql : sql + ";"

// Append index definitions
let indexes = try await fetchIndexes(table: table, schema: schemaName)
for index in indexes where !index.isPrimary {
let uniqueStr = index.isUnique ? "UNIQUE " : ""
Expand Down
2 changes: 0 additions & 2 deletions Plugins/DynamoDBDriverPlugin/DynamoDBItemFlattener.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ struct DynamoDBItemFlattener {
}
}

// Collect all other attribute names across all items
var remaining = Set<String>()
for item in items {
for key in item.keys where !seen.contains(key) {
remaining.insert(key)
}
}

// Append remaining sorted alphabetically
ordered.append(contentsOf: remaining.sorted())

return ordered
Expand Down
4 changes: 0 additions & 4 deletions Plugins/DynamoDBDriverPlugin/DynamoDBPartiQLParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,20 @@ internal struct DynamoDBPartiQLParser {

switch firstUpper {
case "SELECT":
// Find FROM keyword and take the next token
if let fromIndex = tokens.firstIndex(where: { $0.uppercased() == "FROM" }),
fromIndex + 1 < tokens.count
{
return normalizeIdentifierToken(tokens[fromIndex + 1])
}
case "INSERT":
// INSERT INTO "table" ...
if tokens.count >= 3, tokens[1].uppercased() == "INTO" {
return normalizeIdentifierToken(tokens[2])
}
case "UPDATE":
// UPDATE "table" ...
if tokens.count >= 2 {
return normalizeIdentifierToken(tokens[1])
}
case "DELETE":
// DELETE FROM "table" ...
if tokens.count >= 3, tokens[1].uppercased() == "FROM" {
return normalizeIdentifierToken(tokens[2])
}
Expand Down
13 changes: 0 additions & 13 deletions Plugins/DynamoDBDriverPlugin/DynamoDBPluginDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,10 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
)
}

// Check for tagged browsing queries
if DynamoDBQueryBuilder.isTaggedQuery(trimmed) {
return try await executeTaggedQuery(trimmed, conn: conn, startTime: startTime)
}

// Execute as PartiQL
return try await executePartiQL(trimmed, conn: conn, startTime: startTime)
}

Expand All @@ -137,12 +135,10 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send

let trimmed = query.trimmingCharacters(in: .whitespacesAndNewlines)

// If no parameters, fall back to regular execute
guard !parameters.isEmpty else {
return try await execute(query: trimmed)
}

// Convert parameters to DynamoDB attribute value dictionaries
let dynamoParams: [[String: Any]] = parameters.map { param -> [String: Any] in
switch param {
case .null:
Expand Down Expand Up @@ -278,7 +274,6 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
let tableDesc = try await cachedDescribeTable(table, conn: conn)
var indexes: [PluginIndexInfo] = []

// Primary key
if let keySchema = tableDesc.KeySchema {
let columns = keySchema.map(\.AttributeName)
indexes.append(PluginIndexInfo(
Expand All @@ -290,7 +285,6 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
))
}

// Global Secondary Indexes
if let gsis = tableDesc.GlobalSecondaryIndexes {
for gsi in gsis {
let columns = (gsi.KeySchema ?? []).map(\.AttributeName)
Expand All @@ -305,7 +299,6 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
}
}

// Local Secondary Indexes
if let lsis = tableDesc.LocalSecondaryIndexes {
for lsi in lsis {
let columns = (lsi.KeySchema ?? []).map(\.AttributeName)
Expand Down Expand Up @@ -353,7 +346,6 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
lines.append("ARN: \(arn)")
}

// Key Schema
if let keySchema = tableDesc.KeySchema {
lines.append("")
lines.append("Key Schema:")
Expand All @@ -365,7 +357,6 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
}
}

// Attribute Definitions
if let attrs = tableDesc.AttributeDefinitions {
lines.append("")
lines.append("Attribute Definitions:")
Expand All @@ -374,7 +365,6 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
}
}

// Billing Mode
let billingMode = tableDesc.BillingModeSummary?.BillingMode ?? "PROVISIONED"
lines.append("")
lines.append("Billing Mode: \(billingMode)")
Expand All @@ -384,7 +374,6 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
lines.append("Write Capacity: \(throughput.WriteCapacityUnits ?? 0)")
}

// Item Count and Size
if let itemCount = tableDesc.ItemCount {
lines.append("")
lines.append("Item Count: \(itemCount)")
Expand All @@ -393,7 +382,6 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
lines.append("Table Size: \(formatBytes(sizeBytes))")
}

// Global Secondary Indexes
if let gsis = tableDesc.GlobalSecondaryIndexes, !gsis.isEmpty {
lines.append("")
lines.append("Global Secondary Indexes:")
Expand All @@ -407,7 +395,6 @@ internal final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Send
}
}

// Local Secondary Indexes
if let lsis = tableDesc.LocalSecondaryIndexes, !lsis.isEmpty {
lines.append("")
lines.append("Local Secondary Indexes:")
Expand Down
2 changes: 0 additions & 2 deletions Plugins/EtcdDriverPlugin/EtcdPluginDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ final class EtcdPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
)
}

// Check for tagged browsing queries
if EtcdQueryBuilder.isTaggedQuery(trimmed) {
return try await executeTaggedQuery(trimmed, client: client, startTime: startTime)
}
Expand Down Expand Up @@ -927,7 +926,6 @@ final class EtcdPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
}
}

// Apply pagination
let total = kvs.count
guard offset < total else {
return emptyResult(startTime: startTime)
Expand Down
1 change: 0 additions & 1 deletion Plugins/MSSQLDriverPlugin/MSSQLPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ final class MSSQLPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
query: query, parameters: parameters.map { $0.asText }
)

// If no placeholders were found, execute the query as-is
guard !paramDecls.isEmpty else {
return try await execute(query: query)
}
Expand Down
1 change: 0 additions & 1 deletion Plugins/RedisDriverPlugin/RedisCommandParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,6 @@ struct RedisCommandParser {
if knownFlags.contains(upper) {
flags.append(upper)
if upper == "LIMIT" {
// LIMIT requires offset and count
guard i + 2 < args.count else {
throw RedisParseError.missingArgument("LIMIT requires offset and count")
}
Expand Down
2 changes: 0 additions & 2 deletions Plugins/RedisDriverPlugin/RedisPluginDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ final class RedisPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
throw RedisPluginError.notConnected
}

// Parse key counts from INFO keyspace
let result = try await conn.executeCommand(["INFO", "keyspace"])
var keyCounts: [String: Int] = [:]
if let info = result.stringValue {
Expand All @@ -149,7 +148,6 @@ final class RedisPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
}
}

// Get total database count from CONFIG GET databases
let configResult = try await conn.executeCommand(["CONFIG", "GET", "databases"])
var maxDatabases = 16
if let array = configResult.arrayValue, array.count >= 2, let count = Int(redisReplyToString(array[1])) {
Expand Down
3 changes: 0 additions & 3 deletions Plugins/RedisDriverPlugin/RedisStatementGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ struct RedisStatementGenerator {
}
}

// Batch deletes into a single DEL command
if !deleteKeys.isEmpty {
let keyList = deleteKeys.map { escapeArgument($0) }.joined(separator: " ")
let cmd = "DEL \(keyList)"
Expand Down Expand Up @@ -168,7 +167,6 @@ struct RedisStatementGenerator {

var statements: [(statement: String, parameters: [PluginCellValue])] = []

// Check for key rename
if let keyChange = change.cellChanges.first(where: { $0.columnName == "Key" }),
let newKey = keyChange.newValue.asText, newKey != key {
let renameCmd = "RENAME \(escapeArgument(key)) \(escapeArgument(newKey))"
Expand All @@ -183,7 +181,6 @@ struct RedisStatementGenerator {
return key
}()

// Determine the Redis type from the original row data
let redisType: String? = {
guard let ti = typeColumnIndex,
let originalRow = change.originalRow,
Expand Down
Loading
Loading