Skip Menu |

This queue is for tickets about the Class-DBI-Lite CPAN distribution.

Report information
The Basics
Id: 77077
Status: new
Priority: 0/
Queue: Class-DBI-Lite

People
Owner: jdrago_999 [...] yahoo.com
Requestors: mdengfeng [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: NoSQL cache issue.
Date: Wed, 9 May 2012 18:46:04 +0800
To: bug-Class-DBI-Lite [...] rt.cpan.org
From: DengFeng Mao <mdengfeng [...] gmail.com>
Hi, Expert It seems Class::DBI::Lite doesn't support setting database connection at run-time. Here is the scenario. I am using Class::DBI::Lite with SQLite. But the SQLite database is at remote host. It would be available after the downloading. So all the 'Model' classes can't be loaded before the SQLite database file is available. I mean I can't 'use App::db::model;‘ in the codes as normal. Then I try to use 'eval' as the work-around ###################### eval { require App::db::model; App::db::model->import(); } ######################## When above codes were executed. Class::DBI::Lite would go to a fix location /tmp/mydb.sqlite to connect the database. It can work well for just one database. Now, I have two databases needed to be operated. So I created two Class::DBI::Liste instances. First ,connect the database /tmp/mydb.sqlite and create the database instance 1 ; Then, downloaded a new sqlite database and overwrite /tmp/mydb.sqlite. and execute above 'eval' block again ,, then create the database instance 2. The database schema are the same for both instances. But the records are different. Then the issue is coming. When query in instance 2. I got some results from instance 1. It seems the database connection was changed but the cache was not refreshed according the new db connection. So I got the results in the cache instead of the real records in instance 2. Do you have any advice for this situation? Or is there a better way to handle two database at the same time with Class::DBI::Lite. Thanks in advance Dengfeng -- --------------------------------------------------------- Market is wrong, But I am right!