Coder Social home page Coder Social logo

mysql_utils's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

odunboye

mysql_utils's Issues

Charset Support for Emoji

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.

Why dependency on Flutter is needed?

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?

Unhandled Exception: Bad state: Cannot write to socket, it is closed

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?

Proposal for simplification

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 );
}

insertId doesn't work on BINARY(16) id

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!

Are you interested in helping porting PHP eloquent to dart?

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

https://laravel.com/docs/5.2/eloquent

Can't connect with no password

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.

Parameter debug is set to true for insertAll by Standard

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 {

[Bug]

table Product:

id description quantity price
1 Bean 3 4.7
2 Rice 5 15
3 Flour 15 2.5

Query

await conn.getAll(table: 'Product', fields: '*', where: {'id': ['>', 1]});

Exepected

id description quantity price
2 Rice 5 15
3 Flour 15 2.5

Getted

id description quantity price
1 Bean 3 4.7

Unhandled Exception: type 'Null' is not a subtype of type 'String'

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});

How can i connect app in multiple pc in network with one pc having database?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.