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
9 changes: 7 additions & 2 deletions lib/core/database/mysql_connection.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:mysql_client/mysql_client.dart';
import 'package:querya_desktop/core/storage/local_db.dart';

Expand Down Expand Up @@ -192,7 +193,9 @@ class MysqlConnection {
if (c != null && c.connected) {
await c.close();
}
} catch (_) {}
} catch (e) {
debugPrint('MysqlConnection.disconnect: $e');
}
}

/// Best-effort close. The `mysql_client` driver may not allow graceful [close]
Expand All @@ -206,7 +209,9 @@ class MysqlConnection {
if (c.connected) {
await c.close();
}
} catch (_) {}
} catch (e) {
debugPrint('MysqlConnection.forceClose: $e');
}
}

/// Session hint for read-only browsing (MySQL 8+ / MariaDB — semantics differ from PostgreSQL).
Expand Down
18 changes: 14 additions & 4 deletions lib/core/database/postgres_connection.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'dart:io' show SecurityContext;

import 'package:flutter/foundation.dart';
import 'package:postgres/postgres.dart';
import 'package:querya_desktop/core/storage/local_db.dart';

Expand Down Expand Up @@ -197,7 +199,9 @@ class PostgresConnection {
_conn = null;
try {
await c?.close();
} catch (_) {}
} catch (e) {
debugPrint('PostgresConnection.disconnect: $e');
}
}

/// Drops the TCP session immediately (kills pending client I/O). Used when
Expand All @@ -208,7 +212,9 @@ class PostgresConnection {
_conn = null;
try {
await c?.close(force: true);
} catch (_) {}
} catch (e) {
debugPrint('PostgresConnection.forceClose: $e');
}
}

/// Session-level default for transactions (browse vs SQL editor).
Expand Down Expand Up @@ -419,14 +425,18 @@ class PostgresConnection {
"SELECT extract(epoch from (now() - pg_postmaster_start_time()))::bigint",
);
stats['uptime_seconds'] = uptime.first[0];
} catch (_) {}
} catch (e) {
debugPrint('PostgresConnection.getServerStats uptime: $e');
}

try {
final dbSize = await _conn!.execute(
"SELECT pg_database_size(current_database())",
);
stats['current_db_size'] = dbSize.first[0];
} catch (_) {}
} catch (e) {
debugPrint('PostgresConnection.getServerStats database size: $e');
}

return stats;
}
Expand Down
5 changes: 4 additions & 1 deletion lib/core/database/redis_connection.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:redis/redis.dart' as redis;

/// Redis connection using the Dart redis package (no Java/JRE).
Expand Down Expand Up @@ -333,7 +334,9 @@ class RedisConnectionTestFake extends RedisConnection {
_command = null;
try {
await c?.close();
} catch (_) {}
} catch (e) {
debugPrint('RedisConnection.disconnect: $e');
}
}

@override
Expand Down
6 changes: 5 additions & 1 deletion lib/core/database/sqlite_connection.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:querya_desktop/core/storage/local_db.dart';

Expand Down Expand Up @@ -62,7 +64,9 @@ class SqliteConnection {
_db = null;
try {
await d?.close();
} catch (_) {}
} catch (e) {
debugPrint('SqliteConnection.disconnect: $e');
}
}

Future<void> forceClose() => disconnect();
Expand Down
8 changes: 6 additions & 2 deletions lib/core/storage/folders_storage.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:path_provider/path_provider.dart';

import 'local_db.dart';
Expand All @@ -25,7 +26,8 @@ class FoldersStorage {
try {
await _migrateFromLegacyIfNeeded();
_folders = await LocalDb.instance.getFolders();
} catch (_) {
} catch (e) {
debugPrint('FoldersStorage.load: $e');
_folders = [];
}
_loaded = true;
Expand Down Expand Up @@ -56,7 +58,9 @@ class FoldersStorage {
}
}
await file.delete();
} catch (_) {}
} catch (e) {
debugPrint('FoldersStorage._migrateFromLegacyIfNeeded: $e');
}
}

Future<void> save(List<String> folders) async {
Expand Down
Loading