Menu

databases

Joel Limardo

Databases

The core BixChange system doesn't use a relational database. This, too, is on purpose. If you want to connect to PostgreSQL or MySQL you can simply install and use the popular Class::DBI module and add double quote blocks around anything you want evaluated in a resource (INI) file like this:

 
      FOO=<<EOF
          %%
              use Class::DBI;
              ...
              # the following I borrowed from the Class::DBI pod
 package Music::DBI;
         use base 'Class::DBI';
         Music::DBI−>connection('dbi:mysql:dbname', 'username', 'password');

         package Music::Artist;
         use base 'Music::DBI';
         Music::Artist−>table('artist');
         Music::Artist−>columns(All => qw/artistid name/);
         Music::Artist−>has_many(cds => 'Music::CD');
         ...

          %%
      EOF
 

If our output is a simple string then just make it a stand alone statement like this:

  
      FOO=<<EOF
           %%
                my $n = q|a nice string|;
                $n;
           %%
      EOF
  

Strictly speaking you don't need the last statement but it is highly recommended to avoid confusion later on. If you want to return a bunch of data you can simply use the BixChange::_bankdeposit() method. See /data/m/ma/main11.ini for an example that uses an XObject.


MongoDB Logo MongoDB