简体   繁体   English

SQLJocky内置库'dart:io'在Dartium上不可用

[英]SQLJocky The built-in library 'dart:io' is not available on Dartium

So I kinda want to do so interaction with my MySQL Server using Dart. 因此,我有点想使用Dart与我的MySQL Server进行交互。 I looked up how people did this and I got to get sqljocky. 我查了一下人们是如何做到的,然后得到了sqljocky。 Now I import the sqljocky in my main file, I get the error: The built-in library 'dart:io' is not available on Dartium. 现在,我将sqljocky导入主文件中,出现错误:内置库'dart:io'在Dartium上不可用。 Now what is going wrong around here and why did Google make dart:io when it's not available for Dartium? 现在,这里出了什么问题?当Dartium无法使用dart:io时,Google为什么要制造它?

Thanks in advance! 提前致谢!

The dart:io library is available for server side processes similar to Node.js. dart:io库可用于类似于Node.js的服务器端进程。 It allows developers to have one language on both the client and the server. 它允许开发人员在客户端和服务器上使用一种语言。 It provides capabilities such as creating native sockets, native file i/o etc, that cannot be accomplished client side (in any language) due to the sandboxing restrictions. 它提供了诸如创建本机套接字,本机文件I / O等功能,由于沙箱限制,这些功能无法在客户端(以任何语言)完成。

SQLJockey uses the ability to create native sockets to connect to a MySQL server. SQLJockey使用创建本地套接字的能力来连接到MySQL服务器。 Its not something that can be done client side (or at least not easily at all) and even if it could, it should not be done as once code is client side it's always susceptible to modification by an end user (I can modify the javascript in my browser on any page I hit to behave differently). 它不是可以在客户端(或至少一点都不容易)完成的事情,即使可以,也不应该这样做,因为一旦代码在客户端,它总是容易受到最终用户的修改(我可以修改javascript在浏览器中点击的任何页面上的行为都不同)。 Server-side you can sanitize commands sent to a database and not worry that someone else would be able to change your sanitization rules. 在服务器端,您可以清理发送到数据库的命令,而不必担心其他人将能够更改您的清理规则。 And of course that's not to mention just having username and password for your MySQL in your client-side code for anyone to access and the fact that your MySQL connection would need to accept logins form everywhere not just 'localhost' or a specific server/domain would leave you far too susceptible. 当然,这更不用说在客户端代码中为您的客户端代码提供MySQL的用户名和密码,任何人都可以访问,而且您的MySQL连接需要接受到处登录的形式,而不仅仅是“ localhost”或特定的服务器/域会让你太敏感了。

So the dart:io library is to be run server-side like a Ruby (on Rails, or Sinatra, etc) script, or like PHP or like Node.js. 因此,dart:io库将像Ruby(在Rails或Sinatra等上)脚本,PHP或Node.js之类的服务器端运行。 It's not designed to run client-side as it provides functionality which cannot be implemented in a browser for security reasons (this security is built into the browser not just the languages). 它不是为在客户端运行而设计的,因为它出于安全原因提供了无法在浏览器中实现的功能(此安全性内置于浏览器中,而不仅仅是语言)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM