问题 如何使用Dart连接mysql数据库?


有谁能告诉我如何用Dart连接到mysql数据库?我一直在阅读和搜索天,但找不到任何合适的答案。我只是学习网络编程。谢谢!


3522
2017-08-15 02:41


起源



答案:


您可以使用 SQLJocky 连接到MySQL。加

dependencies:
  sqljocky: 0.0.4

到你的 pubspec.yaml 跑步 酒吧安装。现在你可以像这样连接MySQL

var cnx = new Connection();
cnx.connect(username, password, dbName, port, hostname).then((nothing) {
    // Do something with the connection
    cnx.query("show tables").then((Results results) {
    print("tables");
    for (List row in results) {
      print(row);
    }
  });
});

14
2017-11-03 10:38





我没试过这个,但这里有一个: http://github.com/jamesots/sqljocky


1
2017-08-15 06:27





你可以尝试使用sqljocky - > http://pub.dartlang.org/packages/sqljocky


1
2018-04-24 12:56