What do you get when you cross a mission-critical enterprise-class
database with a camel?

#!/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!


see ./INSTALL for hints on installation
see ./UPGRADE to evolve databases from prior releases
see ./TODO for a list of stuff in the queue
see ./CHANGES for a visionary perspective


Perl-ObjectStore mailing list:

majordomo@parallax.co.uk   "subscribe perl-objectstore you@your.company.com"

(If you think you've run into a bug, try running your script with
"perl -MObjStore=PANIC" and mail the output to the mailing list.)

-------------------------------------------------------------------
Copyright  1997-1998 Joshua Nathaniel Pritikin.  All rights reserved.

This package is free software and is provided "as is" without express
or implied warranty.  It may be used, redistributed and/or modified
under the terms of the Perl Artistic License (see
http://www.perl.com/perl/misc/Artistic.html)
