Net-Z3950-DBIServer

 view release on metacpan or  search on metacpan

examples/books/books.nzd  view on Meta::CPAN

# books.nzd - a sample configuration file for Net::Z39.50::DBIServer
# $Id: books.nzd,v 1.25 2009-03-05 17:51:38 mike Exp $
#
# See Net::Z3950::DBIServer::Spec for a formal description of this
# file's format, if you need it.  But it's actually pretty obvious.
#
# To use the an-yet uninstalled distribution, invoke as:
#	perl -I ../../lib ../../bin/zSQLgate books.nzd @:9998

datasource = "DBI:mysql:dbname=books"		# If using MySQL
#datasource = "DBI:Pg:dbname=books"		# If using PostgreSQL
#datasource = "dbi:Oracle:host=test;sid=test"	# If using Oracle
#username = "mike"				# If needed
#password = "mike3636"				# If needed
option "mysql_enable_utf8" = 1

database "places" {
    table = "country"
    search attrset bib1 {
	access 12 = "id"			# local number
	access 4 = "name"			# title
    }
    data format xml {
	record = "country"
	field "countryId" = "id"
	field "countryName" = "name"
    }
}

database "artists" {
    table = "author"
    auxiliary "country" with "country.id = author.country_id"
    search attrset bib1 {
	access 12 = "id"			# local number
	access 1 = "name"			# author
    }
    data format xml {
	record = "author"
	field "authorId" = "id"
	field "authorName" = "name"
	field "authorCountry" = "?country.name"
    }
}

database "works" {
    table = "book"
    auxiliary "author" with "author.id = book.author_id"
    auxiliary "country" with "country.id = author.country_id"
    join = "outer"

    restriction = "author_id != 1"		# Omit Douglas Adams books
    search {
	defaultattrs 1=4
	attrset bib1 {
	    access 1 = fulltext "author.name"	# personal name
	    access 12 = "id"			# local number
	    access 4 = fulltext "name"		# title (fulltext for MySQL)
	    access 30 = "year"			# year
	    access 1016 = "name,year,notes"	# any
	    access 32 = "year"			# some kind of date
	}
	attrset "xd-1" {			# test for multiple attrsets
	    access 1 = "name"			# AA cross-domain title
	    access 5 = "year"			# AA cross-domain date
	}
	attrset 1.2.840.10003.3.1000.169.42 {	# Private attribute-set
	    access 609 = "notes"
	}
    }
    data {
	cachesize = 2
	format grs1 {
	    field (1,14) = "id"		# tagSet-M local control number
	    field (3,"artistId") = "author_id"
	    field (2,1) = "name"		# tagSet-G title



( run in 0.630 second using v1.01-cache-2.11-cpan-64ef6c95b5d )