database driver from config file

28 views
Skip to first unread message

Matt Zagrabelny

unread,
Nov 19, 2012, 12:19:52 PM11/19/12
to rose-db...@googlegroups.com
Greetings,

I have looked at the Rose::DB(::Object) tutorial(s) and also examined the source, but cannot find the preferred way to set the database driver from a config file. I see that in the tutorial the driver is "hard-coded" into the derived Rose::DB derived class. Is there a way to specify the driver from a config file?

I am using librose-db-perl 0.769-1.

I have tried passing the driver in as a parameter to new(), but that doesn't seem to work when register_db is called later on.

I get this error:

Attempt to change driver from 'mysql' to 'pg' detected.  The driver cannot be changed after object creation. at ./bin/dbauditor line 125

Thanks for the insight.

-mz

Peter Karman

unread,
Nov 19, 2012, 12:27:20 PM11/19/12
to rose-db...@googlegroups.com


On Monday, November 19, 2012 11:19:52 AM UTC-6, Matt Zagrabelny wrote:
Greetings,

I have looked at the Rose::DB(::Object) tutorial(s) and also examined the source, but cannot find the preferred way to set the database driver from a config file. I see that in the tutorial the driver is "hard-coded" into the derived Rose::DB derived class. Is there a way to specify the driver from a config file?



We store our settings in a .ini file and load it like this:
Reply all
Reply to author
Forward
0 new messages