connection.delete("delete members
where members_id = #{ins}")
puts del #=> returns 0 regardless of if the delete really ran or not!
Again there are a few key things we should point out about the previous example.
??? Each of these low-level statements requires a full SQL statement that is compatible with
your backend database. In the example of SQL Server, that means your SQL statements
must be T-SQL compliant, and with Oracle, they must be PL/SQL compliant. Each database
uses a variation of ANSI SQL, and when you work directly with these low-level
statements, you must know and maintain the details of this on your own.
??? Both the update and delete statements return a zero value regardless of their execution.
This means that you have no real information saying whether or not the statement executed
properly, so checking for proper execution is left up to you.
??? When you use these low-level statements, you are bypassing everything Active Record
brings to the table, except for the ability to connect to the database.
Pages:
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405