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-07-98 EMERGENCY RELEASE 1.23 - Fixed refcnt problems in bless & indices. From now on, make sure to check ossize as outlined in ./INSTALL: 'make test', then save the output of 'ossize -c'. Run 'make test' again and compare 'ossize -c' to the last snapshot. The only thing that might be different is the addition of another empty segment (this is a known bug in safe references, example below). If anything else changes, there is a serious refcnt bug! - Indices now set readonly locks *ONLY* on fields that are used as keys. - Notification API. ** 01-06-98 RELEASE 1.22 - 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. 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)