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

I need to get a database connection through a firewall and also restrict which requests can be run. DBD :: Proxy seems to be the perfect solution for this. However, I am currently using DBIx :: Class and cannot figure out how to link them.

In particular, DBD :: Proxy does not accept SQL; it accepts specific named requests. But DBIx :: Class doesn't seem to have a way to invoke these named queries.

This is inside a Catalyst based web application.

+1


source to share


1 answer


DBD :: Proxy executes SQL. This allows named queries to be used as a convenience.

There is no convenient way to use DBIx :: Class with a DBD :: Proxy named query, since the purpose of the DBIx :: Class Object Relational Mapper (ORM) is to represent an Object Oriented View of the SQL Data Manipulation Language (DML). The named query function DBD :: Proxy is not a DML statement, so DBIx :: Class does not have a function that suits your needs: passing a literal string directly to the prepare () function of your DBD :: Proxy driver.



Some awkward ways:

  • Don't use DBIx :: Class. Just do it in DBI. You can use Catalyst :: Model :: DBI or simple DBI + catalyst :: Model :: Adapter + your own model class.

  • Don't use named queries. This means that if you plan on using named queries as a way to control database access, you will need to move the logic request authorization to code that makes the database call inside your controller or model, depending on how you built your application.

+1


source







All Articles