Re: writing DBI applications offline
by Corion (Patriarch) on Oct 06, 2008 at 07:31 UTC
|
What SQL features do you need? I'm quite fond of DBD::SQLite (respectively the more maintained DBD::SQLite::Amalgamation distribution), which is a full, self-contained RDBMS in a single file.
| [reply] [Watch: Dir/Any] |
Re: writing DBI applications offline
by moritz (Cardinal) on Oct 06, 2008 at 07:44 UTC
|
Why not simply install a mysql server on your machine? On Debian it's a aptitude install mysql-server-5.0 away, and I guess other systems don't make it more complicated (on windows you'll probably have to find the installer binary yourself).
Then you need a bit of configuration, but it's really not much, and then you can use the same DBD module on your local machine as on the production site. Which can be very important if things like UTF-8 handling are different than in other drivers. | [reply] [Watch: Dir/Any] [d/l] |
|
With a reddening face, Silas the Monk realizes he actually has a copy of mysql that can be installed. He apologises profusely to the assembled masters and bows obsequeiously.
As he backs out of the room, he knocks over the umbrella stand.
| [reply] [Watch: Dir/Any] |
Re: writing DBI applications offline
by andreas1234567 (Vicar) on Oct 06, 2008 at 08:17 UTC
|
Consider Test::MockDBI. It allows you to test and run your application without having an actual, populated database present. See also this article from 2005 on perl.com (Note: article author eq module author).
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]
| [reply] [Watch: Dir/Any] [d/l] |
Re: writing DBI applications offline
by GrandFather (Saint) on Oct 06, 2008 at 07:32 UTC
|
| [reply] [Watch: Dir/Any] |
Re: writing DBI applications offline
by rhesa (Vicar) on Oct 06, 2008 at 11:45 UTC
|
I recently had great success with DBD::Mock. Have a look.
| [reply] [Watch: Dir/Any] |
Re: writing DBI applications offline
by dragonchild (Archbishop) on Oct 07, 2008 at 13:11 UTC
|
The canonical answers are DBD::Mock (for a more purist solution) and DBD::SQLite (for a more practical solution). DBIx::Class (the current "premier Perl ORM", whatever that means) uses DBD::SQLite for all of its testing needs. This means you have a huge corpus of prior art to work from.
Note: DBD::SQLite implements a subset of ANSI SQL. This means that you will not be able to test things like triggers, views, stored procedures, etc. Nor will you be able to test usage of DBMS-specific functions or keywords (such as LIMIT, CONNECT BY, etc). For that, you will need to use DBD::Mock.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] [Watch: Dir/Any] |
|
It seems Silas The Monk knocked over a few more umbrella stands as he bumbled around the monastery.
First of during the installation process for mysql, the process somehow got cancelled just as it was going into the wizard part. After that nothing I tried made the wizard reappear.
However I am mightily pleased with DBI::SQLite. Thanks everyone.
| [reply] [Watch: Dir/Any] |