Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 864d1c3c3cd8df4e3a2692faf8776e05 > files > 156

db4o-doc-7.4-2.fc13.i686.rpm

<html>
  <head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Native Query Implementation</title>
    <link rel="stylesheet" type="text/css" href="../../../style.css">
  </head>
  <body>
    <div class="CommonContent">
      <div class="CommonContentArea">
        <h1>Native Query Implementation</h1>

<p>So how are Native Queries
realized in practice?</p>

<p>Let's return to the <a href="../native_query_concepts.html" class="wikiLink">Pilot</a> class.
Suppose we need to find all pilots with the name starting from "M" and points
over 100. In a native OO language it would be expressed as:</p>

<span name="cs_wiki_filter" csw_filters="cs"><p>c#:&nbsp;</p><p><code>pilot.Name.StartsWith("M")
&amp;&amp; pilot.Points &gt; 100</code></p>

</span>In order to pass this condition to a database, collection or
other query processor a special object is used. In .NET2 it is a delegate, in
Java5 it is a named method. 



<span name="cs_wiki_filter" csw_filters="cs"><p>c#:&nbsp;</p>

<p><code>delegate(Pilot pilot){</code></p>

<p><code>&nbsp;&nbsp;&nbsp; return pilot.Name.StartsWith("M")&amp;&amp; student.Points &gt;
100; </code></p>

<p><code>}</code></p>

</span>

<p>&nbsp;</p>For more information about NQ implementations in the other
Java and .NET versions see
<a href="../../object_lifecycle/querying/native_queries/native_query_syntax.html" class="wikiLink">Native Query Syntax</a>.



</div>
    </div>
    <div id="footer">
					This revision (4) was last Modified 2007-06-04T17:25:45 by Tetyana.
				</div>
  </body>
</html>