tags:

views:

5

answers:

0

Any recommendations for a module which keeps SQL queries external to the application, for Ruby programs? I'm looking to avoid hardcoding SQL queries and possibly to support multiple SQL backends in a set of programs that make direct SQL queries (that is, not mediated via an ORM).

Hyopthetically:

# Production system is pg, dev environment is sqlite
sql_book = What::Module::Here.load( a_file,
                                    ENV['DEVEL'] ? 'PostgreSQL' : 'SQLite3' )

# Okay, now get all Widget IDs
r = db_handle.execute( :load_all_widget_ids )

In perl I might use Data::Phrasebook::SQL or something more exotic like CAM::SQLManager.