biner88 / mysql_utils Goto Github PK
View Code? Open in Web Editor NEWFlutter mysql_client plugin helper, Use mysql_client easily.
License: BSD 3-Clause "New" or "Revised" License
Flutter mysql_client plugin helper, Use mysql_client easily.
License: BSD 3-Clause "New" or "Revised" License
Can you please make a provision for taking mysql database backup programmatically? or is there any way where i can achieve these result?
Greetings,
I get an error when I try to save an emoji to my database or read a saved emoji.
Error:
MySQLServerException [1366]: Incorrect string value: '\xF0\x9F\x98\x87' for column too
.poo
.foo
at row 1
This is because mysql_client uses utf8 by default.
If you use the following option in the connection.dart file in the mysql_client package
await execute(
'SET @@collation_connection=$_collation, @@character_set_client=utf8, @@character_set_connection=utf8, @@character_set_results=utf8',
);
If you change from the above code to the following code, that is, if you change the charsets from utf8 to utf8mb4, the problem will be fixed.
await execute(
'SET @@collation_connection=$_collation, @@character_set_client=utf8mb4, @@character_set_connection=utf8mb4, @@character_set_results=utf8mb4',
);
This problem is on the mysql_client side but I think you can fix it by taking a small parameter.
Have a good day.
This package could be a pure Dart package and then it could be used in both Dart/Flutter projects.
Now there is a dependency on Flutter and one can't use it in pure Dart projects.
Why is that?
am using your package for standalone desktop application with mysql local database.
this works fine when mysql workbench is open but when pc is restarted i'll loose mysql instance and get the error listed above.
Is there any method to programmatically start Mysql connection?
Hey, idk if its fine to ask for features there, but could you please add order by function?
Hi this is not a bug or issue but only a proposal.
I wonder why the method insert does not internally call insertAll (similar to getOne calling getAll).
If you think you can simplify your code a little bit then build method insert similar like this.
Future<int> insert({ required String table, required Map<String, dynamic> insertData, replace = false, debug = false, }) async {
return insertAll( table: table, insertData: [insertData], replace: replace, debug: debug );
}
Hi @biner88 ,
first of all thank you for your contribution!
As the title suggests, I am having a table with an id of type BINARY(16).
The ID was declared as follows:
id BINARY(16) PRIMARY KEY NOT NULL DEFAULT (UUID_TO_BIN(UUID()))
It seems the INSERT into the table fails. However in the returned data the insertId is always 0.
Case reproduction
SQL CODE:
CREATE DATABASE test;
USE test;
CREATE TABLE test_uuid (
id BINARY(16) PRIMARY KEY NOT NULL DEFAULT (UUID_TO_BIN(UUID())),
name VARCHAR(255)
);
FLUTTER CODE:
var db = MysqlUtils(
settings: {
'host': '127.0.0.1',
'port': 3306,
'user': '***',
'password': '***',
'maxConnections': 10,
'secure': true,
'prefix': '',
'pool': true,
'sqlEscape': true,
},
errorLog: (error) {
print(error);
},
sqlLog: (sql) {
print(sql);
},
connectInit: (db1) async {
print('whenComplete');
});
var result = await DB().db.insert(
table: 'test.test_uuid',
debug: true,
insertData: {
'name': 'name1',
},
);
print(result);
I retrieve:
"flutter: MySQLServerException [1046]: No database selected"
I have many schemas in my db. So I need to specify it in the query.
Even if I specify the schema in the settings, the insert result is still 0.
I'm using mysql 8.
Can you help me?
Thanks in advance and have a nice day!
I'm porting Eloquent 5.2 to Dart and for that I implemented a PostgreSQL driver in pure Dart called "dargres" and I wanted to know if you are interested in enabling MySQL support in this port that I'm doing
https://pub.dev/packages/dargres
https://github.com/insinfo/pg8000
https://pub.dev/packages/eloquent
https://github.com/insinfo/eloquent_dart
As I'm working on porting applications made in PHP that use eloquent and PostgreSql to dart, I had to port eloquent, at the moment it already works well with PostgreSQL for the query builder but I would love to have support for MySQl working too
I started using eloquent_dart in a production application, apparently everything is fine
await conn.getAll(table: 'Produto', fields: '*', where: {'id': ['notin', [2, 4, 5]]});
When connecting with password null
or ''
it return this:
MySQLServerException [1045]: Access denied for user 'root'@'localhost' (using password: YES)
But when i create new user with password, it's fine.
Hi I wonder if the parameter debug is supposed to be set to true by standard for function insertAll?
Future<int> insertAll({ required String table, required List<Map<String, dynamic>> insertData, replace = false, debug = true, }) async {
id | description | quantity | price |
---|---|---|---|
1 | Bean | 3 | 4.7 |
2 | Rice | 5 | 15 |
3 | Flour | 15 | 2.5 |
await conn.getAll(table: 'Product', fields: '*', where: {'id': ['>', 1]});
id | description | quantity | price |
---|---|---|---|
2 | Rice | 5 | 15 |
3 | Flour | 15 | 2.5 |
id | description | quantity | price |
---|---|---|---|
1 | Bean | 3 | 4.7 |
am trying to update the table using db.update() function
here is my code
MysqlUtils db = MysqlUtils(
settings: {
'host': 'localhost',
'port': 3306,
'user': 'root',
'password': '***',
'db': '***',
'maxConnections': 10,
'secure': false,
'pool': true,
'collation': 'utf8mb4_general_ci',
},
errorLog: (error) {
print(error);
},
sqlLog: (sql) {
print(sql);
},
connectInit: (db1) async {
print('whenComplete');
}
);
int results=await db.update(table: 'userdetails', updateData: {'username': 'myname'}, where: {'userid': 2});
Hello, I used query to call the stored procedure, but it didn't return. The stored procedure returned last, and it was a selec statement.
Am trying to connect multiple computers in network to one mysql server.
I want the windows applications which uses this package to access single server through local network.
i tried using ip address instead of local host in host property,
but network computers couldn't access data.
Is there any way i could make it work..?
Thanks in advance.
Hello, I used query to call the stored procedure, but it didn't return. The stored procedure returned last, and it was a selec statement.
First thank you so much for the lib.
I am receiving all the int on my database are being returned as String from. Can you check please?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.