My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
GettingStarted  
Minimal actions to get things happening
Updated Nov 18, 2010 by dan...@drjays.com

This page is a brief overview of what you need to do to get started with perl-dbr.

Download

Use the "Source" tab:

http://code.google.com/p/perl-dbr/source/checkout

Install

% perl Makefile.PL
% make
% sudo make install

Examples

There are currently 2 examples in the perl-dbr distribution.

Both examples output verbose logging information to /tmp files, so you can see what DBR is doing behind the scenes when you run the example scripts.

Music Example

This example is a ready-to-run sample application.

It comes with:

  • a small application database with music information.
  • a config database pre-loaded with application schema metadata.
  • a config file for DBR
  • example scripts

% cd examples/music
% ./basic.pl

Cars Example

This example starts from scratch and is a good way to see the gears behind the scenes. You can quickly get it running by:

% cd examples/cars
% ./init.sh
% ./script/create.pl

Then run other scripts, such as:

% ./script/all_cars.pl

There is a README.txt file that walks through the pieces. This example does not use the Admin tool; instead it has a collection of SQL files that load up the data, so you can see what kinds of metadata setup is required (which the Admin tool will do for you).

Your Own Project

Config File

The config file contains connectivity info to get to the Config database.

DBR uses the config database to access all the instances that have been registered, and use the schema information that has been loaded (with the Scan tool and the Admin tool).

Here are a couple of examples of what your config file will look like:

SQLite

name=dbrconf
class=master
database=myappdb
dbfile=/path/to/sqlite/file.db
type=SQLite
dbr_bootstrap=1

MySQL

name=dbrconf
class=master
database=myappdb
user=username
password=password
hostname=dbhostname
type=Mysql
dbr_bootstrap=1

Admin Tool

TBD

The admin tools is located in the bin directory in the perl-dbr distribution. (Does it get installed?)

  • Scan application database
  • Type fields (date, enum, dollars, percent)
  • Define table foreign key relations and terminology to use
    • when doing things like: $model->cars->salesperson

Write Application Code

TBD

  • Common connectivity
    • Create a Logger
    • Create a DBR with path to a config file
    • Connect via DBR to a registered instance using its handle
  • Basic tests
    • walk some table rows
    • load some table data
Powered by Google Project Hosting