RouteX Document Router Toolkit
Main Functions Types & Errors Query Language Demo Home

rxFindQuery

Searches the query database for specific queries. You fill in a rxQueryData struct to search for a query much as you do to add a query to the database. The searching uses an index and is extremely fast, even with very large databases. If the query database has changed since you last searched for a query the index will be updataed, which may take a few moments for larger databases.

The query is passed in as a pointer to a struct of four null terminated strings, each 1024 characters long. This enables languages which do not handle C structs easily to still create a buffer which can be passed to RouteX. When a query is found by either rxFindQuery or rxFindNextQuery this variable will contain the data the query consists of.

typedef struct rxQueryData {

   UCharT Query[1024];

   UCharT Title[1024];

   UCharT Reference[1024];

   UCharT Action[1024];

}

Make sure that you set as null any fields that you don't wish to include in the search. See the sample code below for examples on doing this.

If no queries were found then *Status will be equal to EndOfHitList. (Currently defined as 3 in routextypes.h) Make sure you check not only for a status that is less than 0 but also for it being greater than 0. If no query was found the query number will be meaningless. It usually will be (unsigned long) -1.

Note that the data stored in the Query field is in hexadecimal form. If you are searching for particular query text make sure you convert your string using rxConvertQuery.

Synopsis

ULongT rxFindQuery( RouteX Router, rxQueryData *Query, StatusCodeT *Status )

Arguments

Router The RouteX object you are deleting
Query A pointer to a struct of type rxQueryData holding the query information.
Status A pointer to a value of type StatusCodeT. If an error occurs during the execution of the function a value representing the error will be stored in *Status. You should check *Status after every function call.

Returns

The found query number.

Related Functions

rxAddQuery, rxDeleteQuery, rxFindNextQuery

Example


rxQueryData   aQuery;

unsigned long querynum;



// Set up the query I'm searching for, in this case a 

// name stored in the reference field

strcpy( aQuery.Reference, "Someone");



// set  the other fields to null

aQuery.Action[0] = 0;

aQuery.Title[0] = 0;

aQuery.Query[0] = 0;



querynum = rxFindQuery( Router, &aQuery, Status);



if( *Status < 0 )

   return;



// I now want to delete all records for Someone

while( *Status == 0 ) {

   rxDeleteQuery( Router, querynum, Status );

 

   if( *Status < 0 )

      return;



   // note that you don't need to refill out our query

   querynum = rxFindNextQuery( Router, &aQuery, Status);  

}

 

Previous Main Next Home

Copyright 2000 Lextek International