Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们可以在.html.erb文件和.rb文件中使用 SQL 查询从 Sonar 数据库中检索数据。如何在 Java 文件中使用 SQL 查询从声纳中检索数据。有没有办法做到这一点。任何例子。 任何帮助,将不胜感激。
您不应该直接查询数据库,因为它不是 API。请改用声纳 API。
我知道目前,一些 Ruby 模板直接通过 Active Record 查询数据库,但这是邪恶的,因为数据库可能会在没有通知的情况下发生变化。因此,我们迟早会删除这个特性,并提供一个真正的 API 来访问 Rails 端的资源。
数据库不是 API。