Remove extraneous and misleading old CVS IDs
[ZOOM-Perl-moved-to-github.git] / samples / zoom / update.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use warnings;
5 use ZOOM;
6
7 my $options = new ZOOM::Options();
8 $options->option(user => "admin");
9 $options->option(password => "fish");
10 my $conn = create ZOOM::Connection($options);
11 $conn->connect("test.indexdata.com:2118");
12 print "connected\n";
13
14 my $dbname = "mike$$";
15 $conn->option(databaseName => $dbname);
16
17 send_package($conn, "create", databaseName => $dbname);
18 print "$0: created database '$dbname'\n";
19
20 my $rs = $conn->search_pqf("mineral");
21 my $n = $rs->size($rs);
22 print "$0: found $n records\n";
23
24 send_package($conn, "update", action => "specialUpdate",
25              recordIdOpaque => 1, record => join("", <DATA>));
26 print "$0: added record\n";
27
28 $rs = $conn->search_pqf("mineral");
29 $n = $rs->size($rs);
30 print "$0: found $n records\n";
31
32 send_package($conn, "drop", databaseName => $dbname);
33 print "$0: deleted database\n";
34
35 eval {
36     $rs = $conn->search_pqf("mineral");
37 }; if (!$@) {
38     print "$0: uh-oh\n";
39 } elsif ($@->isa("ZOOM::Exception")) {
40     print "$0: database no longer there\n";
41 } else {
42     die "@='$@'";
43 }
44
45
46 sub send_package {
47     my($conn, $op, %options) = @_;
48
49     my $p = $conn->package();
50     foreach my $key (keys %options) {
51         $p->option($key, $options{$key});
52     }
53     $p->send($op);
54     $p->destroy();
55 }
56
57
58 __DATA__
59 <gils>
60   <Title>
61     UTAH EARTHQUAKE EPICENTERS
62     <Acronym>UUCCSEIS</Acronym>
63   </Title>
64   <Originator>UTAH GEOLOGICAL AND MINERAL SURVEY</Originator>
65   <Local-Subject-Index>
66     APPALACHIAN VALLEY; EARTHQUAKE; EPICENTER; SEISMOLOGY; UTAH
67   </Local-Subject-Index>
68   <Abstract>
69     Five files of epicenter data arranged by date comprise this data
70     set.  These files are searchable by magnitude and
71     longitude/latitude.  Hardcopy of listing and plot of requested
72     area available.  Epicenter location and date, magnitude, and focal
73     depth available.
74     <Format>DIGITAL DATA SETS</Format>
75     <Data-Category>TERRESTRIAL</Data-Category>
76     <Comments>
77       Data are supplied by the University of Utah Seismograph
78       Station. The Utah Geologcial and Mineral Survey (UGMS) is merely
79       a clearinghouse of the data.
80     </Comments>
81   </Abstract>
82   <Spatial-Domain>
83     <Geographic-Coverage>US STATE</Geographic-Coverage>
84     <Coverage-Description>UTAH</Coverage-Description>
85     <Bounding-Coordinates>
86       <West-Bounding-Coordinate>-114</West-Bounding-Coordinate>
87       <East-Bounding-Coordinate>-109</East-Bounding-Coordinate>
88       <North-Bounding-Coordinate>42</North-Bounding-Coordinate>
89       <South-Bounding-Coordinate>37</South-Bounding-Coordinate>
90     </Bounding-Coordinates>
91   </Spatial-Domain>
92   <Time-Period>
93     <Time-Period-Textual>-PRESENT</Time-Period-Textual>
94   </Time-Period>
95   <Availability>
96     <Distributor>
97       <Organization>UTAH GEOLOGICAL AND MINERAL SURVEY</Organization>
98       <Street-Address>606 BLACK HAWK WAY</Street-Address>
99       <City>SALT LAKE CITY</City>
100       <State>UT</State>
101       <Zip-Code>84108</Zip-Code>
102       <Country>USA</Country>
103       <Telephone>(801) 581-6831</Telephone>
104     </Distributor>
105     <Resource-Description>UTAH EARTHQUAKE EPICENTERS</Resource-Description>
106     <Technical-Prerequisites>
107       <Data-Set-Type>AUTOMATED</Data-Set-Type>
108       <Access-Method>BATCH</Access-Method>
109       <Number-of-Records>8,700</Number-of-Records>
110       <Computer-Type>PC NETWORK</Computer-Type>
111       <Computer-Location>SALT LAKE CITY, UT</Computer-Location>
112     </Technical-Prerequisites>
113   </Availability>
114   <Access-Constraints>
115     <Documentation>NONE</Documentation>
116   </Access-Constraints>
117   <Use-Constraints>
118     <Status>OPERATIONAL</Status>
119   </Use-Constraints>
120   <Point-of-Contact>
121     <Name>BILL CASE</Name>
122     <Organization>UTAH GEOLOGICAL AND MINERAL SURVEY</Organization>
123     <Street-Address>606 BLACK HAWK WAY</Street-Address>
124     <City>SALT LAKE CITY</City>
125     <State>UT</State>
126     <Zip-Code>84108</Zip-Code>
127     <Country>USA</Country>
128     <Telephone>(801) 581-6831</Telephone>
129   </Point-of-Contact>
130   <Control-Identifier>ESDD0006</Control-Identifier>
131   <Record-Source>UTAH GEOLOGICAL AND MINERAL SURVEY</Record-Source>
132   <Date-of-Last-Modification>198903</Date-of-Last-Modification>
133 </gils>