Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I have a program i have written that uses MySQL database, nothing complicated, just some basic "SELECT WHERE ... " type queries. I find out now that the host where the program will be costs $20/month extra for a MySQL db, and I would like to switch it all over to Berkely, (or even some plain text/xml files would be fine too)

Does anyone know of module that can take my existing SQL commands and use them to store and retrieve the data to xml/text files or Berkely instead of into MySQL? Thus saving me the time to rewrite all those parts?

Thanks,
Kevin

Replies are listed 'Best First'.
Re: SQL with Berkely DB
by sgifford (Prior) on Apr 01, 2006 at 04:33 UTC
    Look at DBD::SQLite for a way to do SQL queries without an SQL database.
Re: SQL with Berkely DB
by bart (Canon) on Apr 01, 2006 at 08:20 UTC
    Does anyone know of module that can take my existing SQL commands and use them to store and retrieve the data to xml/text files or Berkely instead of into MySQL?

    DBD::AnyData can handle text, CSV, and XML files with the proper supporting modules. Maybe jZed, who is the author of said module, can add support for BerkeleyDB too, if he gets help of some people who desperately want it.

    Note that I recommend against updating this kind of "database" in normal use, the whole file needs to be rewritten every time.

    p.s. I'm a bit surprised you can get BerkeleyDB for free, while you have to pay extra for Mysql.

      Good idea, bart! But please change from the future tense to the past tense. My DBD::DBM has come as part of the DBI distribution for several years now. It handles many kinds of DBM files, including BerkeleyDB. It, like DBD::AnyData uses SQL::Statement as its SQL engine so look there for details of what SQL is supported but it makes use of MLDBM and the storage abilities of the various DBM files (including both DB_File and BerkeleyDB so doesn't operate the same way DBD::AnyData does.