mysql1_dart icon indicating copy to clipboard operation
mysql1_dart copied to clipboard

Invalid value: Not in inclusive range 0..5

Open sankarmartha97 opened this issue 3 years ago • 3 comments

//db connection function(mysql version 8) Future<MySqlConnection> createConnection() async { print("createConnection......"); final conn = await MySqlConnection.connect(ConnectionSettings( host: 'localhost', port: 3306, user: 'root', password: 'admin', db: 'my_test_db' )); print("createConnection......"); print(conn); return conn; }

Future<Results> getUserDetails(req, dbcon, userId) async { var dbcon = await ref.read(connPoolProvider).createConnection(); print("getStoreDetails"); var query ="SELECT * from store where user_Id= ? and is_active = 1 and is_delete = 0 ;";

var result = await dbcon.query(query,userId);
await dbcon.close();
return result;

}

Invalid value: Not in inclusive range 0..5

sankarmartha97 avatar Jul 05 '22 09:07 sankarmartha97

I have had the same issues with queries. I get, RangeError (RangeError (byteOffset): Invalid value: Not in inclusive range 0..5: 7)

eamonsuo avatar Aug 23 '22 05:08 eamonsuo

I encountered the same issue.

And I found that if you put some delay between establishing the connection and making the query, everything is fine. So I ended up connecting the database on application launch, and making queries on requests.

Of course it's still an issue with this library. It fails to ensure an usable connection when it's returned. And delaying queries is a workaround only. I'm expecting a proper fix too.

fengzee avatar Oct 08 '22 04:10 fengzee

I encountered the same issue.

And I found that if you put some delay between establishing the connection and making the query, everything is fine. So I ended up connecting the database on application launch, and making queries on requests.

Of course it's still an issue with this library. It fails to ensure an usable connection when it's returned. And delaying queries is a workaround only. I'm expecting a proper fix too.

Bless you... Added a delay and things started working

snipcodeit avatar Nov 02 '23 03:11 snipcodeit