1 // Simple sample client
3 #include <stdlib.h> // for atoi()
8 int main(int argc, char **argv)
11 std::cerr << "Usage: " <<
12 argv[0] << " <host> <port> <dbname> <@prefix-search>\n";
18 connection conn(argv[1], atoi(argv[2]));
19 conn.option("databaseName", argv[3]);
20 conn.option("preferredRecordSyntax",
21 record::syntax(record::syntax::XML));
22 prefixQuery pq(argv[4]);
23 resultSet rs(conn, pq);
26 std::cout << "found " << n << " records:\n";
27 for (size_t i = 0; i < n; i++) {
28 const record rec(rs, i);
29 std::cout << "=== record " << i+1 <<
30 " (record-syntax " << (std::string) rec.recsyn() << ")" <<
31 " ===\n" << rec.render();
34 } catch(bib1Exception& err) {
35 std::cerr << argv[0] << ": bib1Exception " <<
36 err.errmsg() << " (" << err.addinfo() << ")\n";
39 } catch(ZOOM::exception& err) {
40 std::cerr << argv[0] << ": exception " <<
50 * c-file-style: "Stroustrup"
51 * indent-tabs-mode: nil
53 * vim: shiftwidth=4 tabstop=8 expandtab