How can I use DBD::Proxy with DBIx::Class?

I need to get a database connection through a firewall, and also limit what queries can be run. DBD::Proxy seems to be the perfect solution for this. However, I'm currently using DBIx::Class, and can't figure out how to hook them together.

In particular, DBD::Proxy doesn't take SQL; it takes particular named queries. But DBIx::Class doesn't seem to have a way to invoke those named queries.

This is inside a Catalyst-based webapp.

Answers


DBD::Proxy does take SQL. It allows for named queries as a convenience.

There is no convenient way to use DBIx::Class with DBD::Proxy named queries, since the purpose of the DBIx::Class Object-Relational Mapper (ORM) is to present an object-oriented view of SQL's Data Manipulation Language (DML) statements. The named query feature of DBD::Proxy is not a DML statement, so DBIx::Class does not have feature that suit your needs: passing a literal string directly to the prepare() function of your DBD::Proxy driver.

Some inconvenient ways:

  1. Don't use DBIx::Class. Just do it in DBI. You could use Catalyst::Model::DBI, or plain DBI + catalyst::Model::Adaptor + your own model class.

  2. Don't use named queries. This means that if you were planning to use named queries as a way to control access to the database, then you'll need to move the query authorization logic into the code that makes the call to the database inside your controller or model, depending on how you built your application.


Need Your Help

Google Chart - GeoChart “Incompatible data table: Error: Unknown address type.”

javascript json google-visualization

I'm trying to generate a GeoChart using a set of data retrieved from mysql and parsed in PHP. However, I'm pretty sure that the error lies in my JavaScript. I've simplified the data to make it easi...

Draw a simple circle uiimage

ios uiimage core-graphics circle cgcontext

I try to make a 20x20 UIImage with a simple blue circle.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.