-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Jan 19, 2006, at 12:59 PM, Michael Schoen wrote:
construct_sql is executed in the initialize method of the
association
and it handles the substitution of the sql.
Ah, thanks. So the bug is that it doesn't do the right thing if
the finder_sql has newlines (the regex needs to be modified).
I'll submit a patch.
Nice catch.
Um, so even with this patch I'm not totally happy, but the fix is
Oracle-specific, so not sure if it belongs in the core.
When I'm using finder_sql, it's often because I've needed to supply
a sql hint to get the right performance (isn't Oracle grand). So my
finder_sql is something like...
"SELECT /*+ INDEX(FOO$I) */ * FROM ..."
Unfortunately, when this gets auto-converted into counter_sql, the
hint gets wiped away as well. And if I needed a hint for the find,
I also need a hint for the count.
Would you be open to a patch that made the regexp uglier but didn't
kill the sql hint? Or should I just specify both finder_sql and
counter_sql?
Sure. I think we should try to preserve SQL hints if only for the
next programmer to come along with the notion that Rails will eat his
hairy custom SELECT and grin right back. Plus, MySQL has a similar
hint syntax, and every patch lends a welcome bit of polish..
Thanks,
jeremy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)
iD8DBQFD0A1ZAQHALep9HFYRAr9OAKCnngbZ+3TA6n3oa9GgYOuS4b5GHgCcDsSw
Sqgj4NzHCNMd3zeXlr+pTpE=
=O++C
-----END PGP SIGNATURE-----
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core