We're having a lot of trouble with the way _execute selects whether to
use update or query.

Here's the code in the postgres adapter:
    def _execute(sql, name = nil)
        case sql.strip
        when /^(select|show)/i:
          @connection.execute_query(sql)
        else
          @connection.execute_update(sql)
        end
    end

Executing SQL that looks something like: "UPDATE blah SET \"name\" =
'\nshow'" would cause the execute_query method to be used even if it's
actually an update. (This is not actual SQL but we hit something like
this in production, I've reduced it *significantly* for clarity.)

I'm trying to understand why "select" can't just call "execute_query"
directly. Using regexps to determine whether it's a select or an
update is asking for trouble.

Could someone clarify this for me and suggest a way forward that is
not as fragile as the current approach.

Cheers,
Jon
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to