Skip to content

Commit

Permalink
feat: MySQL allows non-SSL connections
Browse files Browse the repository at this point in the history
  • Loading branch information
3003h committed Aug 25, 2024
1 parent 29555de commit 8f3f004
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
27 changes: 14 additions & 13 deletions lib/store/mysql/mysql.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class FeMySql {
userName: connectionInfo.userName,
password: connectionInfo.password,
databaseName: connectionInfo.databaseName,
secure: false,
);

try {
Expand All @@ -63,9 +64,9 @@ class FeMySql {
Future<bool> testConnect() async {
await _initCompleter?.future;
final result = await _conn.execute('SELECT 1');
result.rows.forEach((element) {
for (final element in result.rows) {
logger.d(element.assoc());
});
}
return result.rows.isNotEmpty;
}

Expand Down Expand Up @@ -301,48 +302,48 @@ class FeMySql {
}

final list = <({String gid, int time})>[];
result.rows.forEach((element) {
for (final element in result.rows) {
final row = element.typedAssoc();
list.add(
(
gid: row['gid'] as String? ?? '',
time: row['time'] as int? ?? 0,
),
);
});
}

return list;
}

Future<List<({String gid, int time, String json})>> getHistoryList(
List<String> subList,
) async {
final _list = <({String gid, int time, String json})>[];
final resultList = <({String gid, int time, String json})>[];

final _splitList = EHUtils.splitList(subList, 50);
for (final _subSubList in _splitList) {
logger.t('_subSubList $_subSubList');
final splitList = EHUtils.splitList(subList, 50);
for (final subSubList in splitList) {
logger.t('subSubList $subSubList');

final result = await _conn.execute(
'SELECT gid, time, json FROM fe_history WHERE gid IN (${_subSubList.join(',')})');
'SELECT gid, time, json FROM fe_history WHERE gid IN (${subSubList.join(',')})');

final rows = result.rows;
logger.d('rows ${rows.length}');

if (rows.isNotEmpty) {
rows.forEach((element) {
for (final element in rows) {
final row = element.typedAssoc();
_list.add(
resultList.add(
(
gid: row['gid'] as String? ?? '',
time: row['time'] as int? ?? 0,
json: row['json'] as String? ?? '',
),
);
});
}
}
}

return _list;
return resultList;
}
}
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1004,10 +1004,10 @@ packages:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: "9d98bd47ef9d34e803d438f17fd32b116d31009f534a6fa5ce3a1167f189a6de"
sha256: "9ee02950848f61c4129af3d6ec84a1cfc0e47931abc746b03e7a3bc3e8ff6eda"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.21"
version: "2.0.22"
flutter_rating_bar:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1955,10 +1955,10 @@ packages:
dependency: transitive
description:
name: shared_preferences_android
sha256: a7e8467e9181cef109f601e3f65765685786c1a738a83d7fbbde377589c0d974
sha256: "480ba4345773f56acda9abf5f50bd966f581dac5d514e5fc4a18c62976bbba7e"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.1"
version: "2.3.2"
shared_preferences_foundation:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ dependencies:
# google_ml_kit: ^0.18.0
google_mlkit_barcode_scanning: ^0.12.0
# google_mlkit_translation: ^0.3.0
# google_mlkit_language_id 在iOS上有问题。会闪退或者应用卡死
google_mlkit_language_id: 0.11.0
flutter_custom_license_page: ^0.0.3
flutter_list_view: ^1.1.18
Expand Down

0 comments on commit 8f3f004

Please sign in to comment.