Is there no real “prepared statement” in the rails?

When we use ActiveRecord, we can use:

User.find(:first, :conditions=>["name=?", name])

It seems that ActiveRecord uses "a prepared statement," but after studying the code, I found that ActiveRecord simply used String.dupand connection.quote()to adjust the content to build the sql, rather than as Java.

So there are no real ones prepared statmentin raiils? And why the rails do not provide it?

+3
source share
3 answers

SQL, , : - Rails. :

  • Rails - - - . Rails
    • ActiveRecord - . , - RDBMS.
    • ActiveRecord . "", AR SQL.
    • , AR, ( ), .
+5

Rails 3.1 ( ) . , , . MySql DB, , MySql . - Pat Shaughnessy .

+3

(?) . ActiveRecord. ( ), ActiveRecord.

SQL. DB , / SQL.

+2

Source: https://habr.com/ru/post/1751018/


All Articles