@@ -4,6 +4,7 @@ import 'package:flutter/material.dart' as material;
44import 'package:mysql_client/mysql_client.dart' ;
55import 'package:querya_desktop/core/database/mysql_connection.dart' ;
66import 'package:querya_desktop/core/database/mysql_service.dart' ;
7+ import 'package:querya_desktop/core/database/result_row_string_convert.dart' ;
78import 'package:querya_desktop/core/storage/local_db.dart' ;
89import 'package:querya_desktop/features/mysql/mysql_sql_editor_dialog.dart' ;
910import 'package:querya_desktop/features/mysql/mysql_table_utils.dart' ;
@@ -144,15 +145,20 @@ class _MysqlTableViewState extends material.State<MysqlTableView> {
144145 return rs.cols.map ((c) => c.name.isNotEmpty ? c.name : 'col' ).toList ();
145146 }
146147
147- List <List <String >> _resultRows (IResultSet rs) {
148+ Future < List <List <String >>> _resultRowsAsync (IResultSet rs) async {
148149 final out = < List <String >> [];
150+ var n = 0 ;
149151 for (final row in rs.rows) {
150152 out.add (
151153 List .generate (
152154 row.numOfColumns,
153- (i) => row.colAt (i) ?? 'NULL' ,
155+ (i) => resultCellToDisplayString ( row.colAt (i)) ,
154156 ),
155157 );
158+ n++ ;
159+ if (n % kResultStringConvertYieldEvery == 0 ) {
160+ await Future <void >.delayed (Duration .zero);
161+ }
156162 }
157163 return out;
158164 }
@@ -186,7 +192,7 @@ class _MysqlTableViewState extends material.State<MysqlTableView> {
186192 if (! mounted) return ;
187193
188194 final colNames = _resultColumns (result);
189- final stringRows = _resultRows (result);
195+ final stringRows = await _resultRowsAsync (result);
190196
191197 setState (() {
192198 _columnNames = colNames;
@@ -223,9 +229,10 @@ class _MysqlTableViewState extends material.State<MysqlTableView> {
223229 try {
224230 final result = await conn.execute (sql);
225231 if (! mounted) return ;
232+ final stringRows = await _resultRowsAsync (result);
226233 setState (() {
227234 _columnNames = _resultColumns (result);
228- _rows = _resultRows (result) ;
235+ _rows = stringRows ;
229236 _rowsOnPage = _rows.length;
230237 _totalRowCount = null ;
231238 _loading = false ;
0 commit comments