Subject: What do you get when you cross a mission-critical enterprise-class database with a camel?
From: Joshua Pritikin <[email-masked]>
Date: 11 Jan 1998 00:29:50 GMT
Newsgroups: comp.lang.perl.announce,comp.lang.perl.modules

#!/usr/local/bin/perl -w

# SQL Challenge
#
# 1. Create a new database or use the existing one.
# 2. Populate a table with questions.
# 3. Print them out in the general pattern: 1 1,2 1,2,3 ...

use ObjStore;
use ObjStore::Config;

my $db = ObjStore::open(TMP_DBDIR . "/challenge", 'update', 0666);

begin 'update', sub {
    $db->root('questions' => sub {
        my $i = new ObjStore::Index($db);
        $i->configure(path => 'msg', unique => 1);

        $i->add({ msg => "Do you want some orange juice?" });
        $i->add({ msg => "Are you hungry?" });
        $i->add({ msg => "How about pizza?" });
        $i->add({ msg => "SQL is the best language ever!" });
        $i;
     });
};

begin sub {
    my $c = $db->root('questions')->new_cursor;
    for (my $e=1; $e <= $c->count; $e++) {
      $c->moveto(-1);
      for (1..$e) { print $c->each(1)->{msg}."\n"; }
      print "\n";
    }
};

Name           DSLI  Description                                  Info
-----------    ----  -------------------------------------------- -----
ObjStore       Rm+O  ObjectStore OODBMS Interface                 JPRIT

- Requires ObjectStore OODBMS (http://www.odi.com) & perl 5.004_04.
- Perl 5.004_54 or better recommended.

Get it via http://www.perl.com/CPAN/authors/id/JPRIT/ !

##################
# RE@ENT CHAN@ES #
##################

** 01-06-98 RELEASE 1.22 - HAPPY NEW YEAR!

- Real indices!  Queries such as /date between qw(Nov97 Jan98)/ are
now easy!  And you can index on multiple keys: $index->configure(path
=> "last_name, first_name").

- No longer ignores -MCarp=verbose!

- posh: both cd & ls now use the same path resolver.

- Builds via Makefile.PL.  Ported to Digital Unix 4.0 (Alpha).

- The stargate no longer destroys data as it is copied.

- 'new_cursor' now defaults to transient memory.

** 12-13-97 RELEASE 1.21

- THE TUTORIAL IS DONE!  See ObjStore::Tutorial!

- Fixed numerous minor bugs; fixed ObjStore::UNIVERSAL::isa;
significant changes to posh; NOREFS invokation optimized out unless
the method is present; re-organized the stargate; moved CSV stuff to
ObjStore::CSV; untested support for kernel threads.

- 'Table' redesigned for performance.  See ObjStore::Table2.

- The documentation is updated & re-written!