在Ruby on Rails的存储过程 [英] Stored procedures in Ruby on Rails

查看:238
本文介绍了在Ruby on Rails的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个.NET的家伙有6年工作经验。最近,我开始使用ROR项目,并认识到,存储过程/ SQL函数没有被使用的。在询问它,我才知道,这是常见的做法,在团队一般人都写了一个SQL查询,完成这一切正在使用的ActiveRecord。

我GOOGLE了任何可能的原因,但并没有找到太多的信息。所以,我只是古玩知道

  1. 这是通常的做法是存储过程/ SQL函数并不preferred使用?
  2. 什么是使用存储过程的优点和缺点是什么?
解决方案
  

这是通常的做法是存储过程/ SQL函数并不preferred使用?

这是的非常的普遍,大多数Rails应用将永远不会需要使用比ActiveRecord的任何东西。

一个背后Rails的主要理念是,它更重要的是获得的工作的产品推向市场的今天的比它得到一个快的产品推向市场6个月了。您的产品将几乎肯定永远是人气不足的表现引起人们的关注。如果是的确实的成为一个问题,你可以支撑的东西后表现的一面,但眼前的问题是要能够快速构建一个应用程序,并能够快速重构的部分或全部它针对你的市场。

  

什么是使用存储过程的优点和缺点是什么?

他们慢写,更难以改变,因此前期投入开发成本。然而,它们能够更快的执行。

I am a .net guy with 6 years of experience. Recently I started working on ROR project and realized that stored procedures/sql functions are not being used at all. On inquiring about it I got to know that it is common practice and in general nobody in team writes a sql queries at all, everything is done using ActiveRecord.

I googled about any possible reasons for this but didn't find much information. So I am just curios to know

  1. Is it common practice that stored procedures/sql functions are not preferred to use?
  2. What are pros and cons of using stored procedures?

解决方案

Is it common practice that stored procedures/sql functions are not preferred to use?

It is very common, most Rails apps will never need to use anything more than ActiveRecord.

One of the chief philosophies behind Rails is that it's more important to get a working product to market today than it is to get a "fast" product to market 6 months from now. Your product will almost certainly never be popular enough for performance to be a concern. If that does become a problem, you can shore up the performance side of things later, but the immediate concern is to be able to build an app quickly, and to be able to rapidly refactor some or all of it in response to your market.

What are pros and cons of using stored procedures?

They're slower to write and more difficult to change, and therefore front-load your development costs. However, they can be faster to execute.

这篇关于在Ruby on Rails的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆