简体   繁体   English

sailsjs框架不支持事务

[英]sailsjs framework doesn't support transaction

The sails.js framework doesn't support transaction. sails.js框架不支持事务。 In the GitHub issues, they talk about transaction() . 在GitHub问题中,他们谈论了transaction() But it's not suitable to code multiple queries in a transaction. 但是不适合在一个事务中编码多个查询。

So I think one solution that use node-mysql module. 因此,我认为一种使用node-mysql模块的解决方案。 But I think that if I create new connection to MySQL and use still sails.js framework connecting to database by waterline, the performance could be diminished. 但是我认为,如果我创建与MySQL的新连接并仍然使用sails.js框架通过水线连接到数据库,则性能可能会降低。

Is it true? 是真的吗

You don't have to open a separate sails-mysql connection. 您不必打开单独的sails-mysql连接。 You can use the query method of the adapter to gain access to the underlying MySQL node driver and perform arbitrary queries, including transactions. 您可以使用适配器的query方法来访问底层的MySQL节点驱动程序并执行任意查询,包括事务。 See this answer for an example. 有关示例,请参见此答案

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

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