From: Joshua Pritikin <
[email protected]>
Newsgroups: comp.lang.perl.announce,comp.lang.perl.modules
Subject: What do you get when you cross a mission-critical enterprise-class database with a camel?
Followup-To: comp.lang.perl.modules
Date: 11 Jan 1998 00:29:50 GMT
Organization: MindSpring Enterprises
Lines: 83
Sender:
[email protected]
Approved:
[email protected] (comp.lang.perl.announce)
Message-ID: <
[email protected]>
Reply-To:
[email protected]
NNTP-Posting-Host: gadget.cscaper.com
X-Disclaimer: The "Approved" header verifies header information for article transmission and does not imply approval of content.
Path: usenet.cise.ufl.edu!barley.lw.net!news.icix.net!news.Destek.Net!news.mv.net!newsfeed.wizvax.net!ulowell.uml.edu!cam-news-feed2.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!news.idt.net!news-peer-east.sprintlink.net!news-peer.sprintlink.net!news.sprintlink.net!Sprint!newsfeed.direct.ca!News.Vancouver.iSTAR.net!news.istar.net!hammer.uoregon.edu!nntp.teleport.com!news.teleport.com!not-for-mail
Xref: usenet.cise.ufl.edu comp.lang.perl.announce:50 comp.lang.perl.modules:1018
#!/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!