generic database object retrieval code.
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 25 Jul 2006 21:29:30 +0000 (21:29 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 25 Jul 2006 21:29:30 +0000 (21:29 +0000)
caller provides a list of db classes, the retrieves all object in the table
and prints them out as JSON

git-svn-id: svn://svn.open-ils.org/ILS/trunk@5108 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/src/extras/import/object_dumper.pl [new file with mode: 0755]

diff --git a/Evergreen/src/extras/import/object_dumper.pl b/Evergreen/src/extras/import/object_dumper.pl
new file mode 100755 (executable)
index 0000000..bd9fc0c
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+# ---------------------------------------------------------------------
+# Generic databse object dumper.
+# ./object_dumper.pl <bootstrap_config> <type>, <type>, ...
+# ./object_dumper.pl /openils/conf/bootstrap.conf permission.grp_tree
+# ---------------------------------------------------------------------
+
+use strict; 
+use warnings;
+use JSON;
+use OpenSRF::System;
+use OpenILS::Utils::Fieldmapper;
+use OpenSRF::Utils::SettingsClient;
+
+my $config = shift || die "bootstrap config required\n";
+
+OpenSRF::System->bootstrap_client( config_file => $config );
+Fieldmapper->import;
+
+require OpenILS::Utils::CStoreEditor;
+my $e = OpenILS::Utils::CStoreEditor->new;
+
+for my $t (@ARGV) {
+       $t =~ s/\./_/og;
+       my $m = "retrieve_all_$t";
+       my $d = $e->$m();
+       print JSON->perl2JSON($_) . "\n" for @$d;
+}