2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * db_query_c.x
2N/A *
2N/A * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A%#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#if RPC_HDR
2N/A%#ifndef _DB_QUERY_H
2N/A%#define _DB_QUERY_H
2N/A
2N/A%
2N/A%/* db_query is the structure that contains the components of a query.
2N/A% It contains the values for searching the indices. */
2N/A%
2N/A
2N/A#ifdef USINGC
2N/A%#include "db_item_c.h"
2N/A%#include "db_entry_c.h"
2N/A%#include "db_scheme_c.h"
2N/A#else
2N/A%#include "db_item.h"
2N/A%#include "db_entry.h"
2N/A%#include "db_scheme.h"
2N/A#endif /* USINGC */
2N/A#endif /* RPC_HDR */
2N/A
2N/A%/* A component of a query */
2N/Astruct db_qcomp {
2N/A int which_index; /* identifies which index is being used */
2N/A item* index_value; /* value to be used in search */
2N/A};
2N/A
2N/A#if RPC_HDR || RPC_XDR
2N/A#ifdef USINGC
2N/Astruct db_query {
2N/A db_qcomp components<>;
2N/A};
2N/A#endif /* USINGC */
2N/A#endif /* RPC_HDR */
2N/A
2N/A#ifndef USINGC
2N/A#ifdef RPC_HDR
2N/A%
2N/A%class db_query {
2N/A%protected:
2N/A% int num_components;
2N/A% db_qcomp* components;
2N/A% public:
2N/A%/* Accessor: returns number of components */
2N/A% int size() { return num_components; }
2N/A%
2N/A%/* Accessor: returns location of start of query */
2N/A% db_qcomp* queryloc() { return components; }
2N/A%
2N/A%
2N/A%/* Null constructor: returns empty empty query. */
2N/A% db_query() { num_components = 0; components = NULL; }
2N/A%
2N/A%/* Returns a db_query containing the index values as obtained from
2N/A% 'attrlist.' */
2N/A% db_query( db_scheme*, int, nis_attr* );
2N/A%
2N/A%/* Returns a newly db_query containing the index values as
2N/A% obtained from the given object. The object itself,
2N/A% along with information on the scheme given, will determine
2N/A% which values are extracted from the object and placed into the query.
2N/A% Returns an empty query if 'obj' is not a valid entry.
2N/A% Note that space is allocated for the query and the index values
2N/A% (i.e. do not share pointers with strings in 'obj'.)
2N/A%*/
2N/A% db_query( db_scheme*, entry_object_p );
2N/A%
2N/A% /* destructor (frees all components) */
2N/A% ~db_query();
2N/A%
2N/A% /* clear component structure */
2N/A% void clear_components( int );
2N/A%
2N/A%/* Print all components of this query to stdout. */
2N/A% void print();
2N/A%};
2N/A%typedef class db_query * db_query_p;
2N/A#endif /* RPC_HDR */
2N/A#endif /* USINGC */
2N/A
2N/A#if RPC_HDR
2N/A%#endif /* _DB_QUERY_H */
2N/A#endif /* RPC_HDR */