RISE to Bloome Software
Log In    
r2bsoftware.se r2bsoftware.se
Click to hide navigation tree
Extended queries
The signature (parameters and return values) of a method created in RISE is set primarily by the choice of method stereotype and secondarily by what's specified by the user in the method editor dialog. There are, however, scenerios where the actual operation (query) must be determined or finialized in run-time. One such scenario is a flexible search dialog, or "report builder", where an end-user creates a query by combining the fields he's interrested in. Such a search dialog would either be extremely inefficient, always search on everything, or it would require a very large number of different, but similar, methods padded with a considerable amount of logics to select the proper method. RISE provides a general approach that allows an application to extend a method query in run-time.
To enable run-time extension by setting the "Extended query" property to True
The final signature of a extended query is determined by the code generator being used. The below code is a web service generated using the "c# for odbc" code generator:
returnSearchDocument[] SearchDocument(int maxRowsToReturn, string extendedCriteria, string[] extendedParameters, string extendedSortOrder)
The extendedCriteria string is added to the where-clause of the method. The extendedParameters array will be bound to the question marks in extendedCriteria. Finally, the extendedSortOrder will be added to the "order by"-clause of the method. An example use of such a method could look like
..... = SearchDocument(1024, "Author like ?", new string[] { "%Shaw%" }, "Author desc");
or combinatory search like
..... = SearchDocument(1024, "Author like ? and Name like ?", new string[] { "%Shaw%", "%Pygmalion%" }, "Name asc, Author desc");
Related articles: