Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 864d1c3c3cd8df4e3a2692faf8776e05 > files > 924

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

<html>
  <head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Immediate Queries</title>
    <link rel="stylesheet" type="text/css" href="../../../../style.css">
  </head>
  <body>
    <div class="CommonContent">
      <div class="CommonContentArea">
        <h1>Immediate Queries</h1><div id="TOC"><div id="TOCinner"><span class="TOCtitle">Contents</span><div class="TOCcontents"><ul><li><a href ="#Immediate Mode Pros And Cons">Immediate Mode Pros And Cons</a></li></ul></li></ul></div></div></div><script>
//We attach this function to a browser object as a variable so that if multiple of these blocks are
//present on the same page, then they will simply over-write eachother with the same function instead
//of generating a naming collision.
window.WikiCodeFormattingCopyToClipboard = function copyToClipboard(sID){
	var sContent = document.getElementById(sID).innerText;
	if( window.clipboardData && clipboardData.setData )
	{
		clipboardData.setData("Text", sContent);
	}
	else
	{
		alert("You must enable javascript access to your clipboard for this feature to work. Please referr to your browser documentation or Google search for instructions.");
	}
}
</script><p>This is the default query mode:
the whole query result is evaluated upon query execution and object IDs list is
produced as a result. </p>



<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">QueryModesExample.cs: <span class="fscMemberName">TestImmediateQueries</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> TestImmediateQueries()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Open_Text').style.display='inline';"/>        </span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_51_977_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Testing query performance on 10000 pilot objects in Immediate mode</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            FillUpDB(</span><span style="color: #800080;">10000</span><span style="color: #000000;">);
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IConfiguration configuration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration();
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            configuration.Queries().EvaluationMode(QueryEvaluationMode.IMMEDIATE);
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IObjectContainer db </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(configuration, Db4oFileName);
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">try</span><span style="color: #000000;">
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Open_Text').style.display='inline';"/>            </span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_454_891_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                IQuery query </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query();
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query.Constrain(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(Pilot));
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query.Descend(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">_points</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">).Constrain(</span><span style="color: #800080;">99</span><span style="color: #000000;">).Greater();
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                DateTime dt1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> DateTime.UtcNow;
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query.Execute();
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                DateTime dt2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> DateTime.UtcNow;
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                TimeSpan diff </span><span style="color: #000000;">=</span><span style="color: #000000;"> dt2 </span><span style="color: #000000;">-</span><span style="color: #000000;"> dt1;
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Query execution time=</span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> diff.TotalMilliseconds </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;"> ms</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">finally</span><span style="color: #000000;">
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Open_Text').style.display='inline';"/>            </span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateQueries_200_71_924_967_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close();
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        }</span></span></div></pre></div></div>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">QueryModesExample.vb: <span class="fscMemberName">TestImmediateQueries</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TestImmediateQueries()</span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateQueries_335_71_15_972_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TestImmediateQueries()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Testing query performance on 10000 pilot objects in Immediate mode</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            FillUpDB(</span><span style="color: #800080;">10000</span><span style="color: #000000;">)
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> configuration </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration()
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            configuration.Queries.EvaluationMode(QueryEvaluationMode.IMMEDIATE)
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> db </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(configuration, Db4oFileName)
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> query </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IQuery </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query.Constrain(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(Pilot))
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query.Descend(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">_points</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">).Constrain(</span><span style="color: #800080;">99</span><span style="color: #000000;">).Greater()
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> dt1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> DateTime </span><span style="color: #000000;">=</span><span style="color: #000000;"> DateTime.UtcNow
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query.Execute()
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> dt2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> DateTime </span><span style="color: #000000;">=</span><span style="color: #000000;"> DateTime.UtcNow
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> diff </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> TimeSpan </span><span style="color: #000000;">=</span><span style="color: #000000;"> dt2 </span><span style="color: #000000;">-</span><span style="color: #000000;"> dt1
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Query execution time=</span><span style="color: #800000;">&quot;</span><span style="color: #000000;"> </span><span style="color: #000000;">+</span><span style="color: #000000;"> diff.TotalMilliseconds.ToString() </span><span style="color: #000000;">+</span><span style="color: #000000;"> </span><span style="color: #800000;">&quot;</span><span style="color: #800000;"> ms</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close()
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>

</span>


<p>Obviously object evaluation
takes some time and in a case of big resultsets you will have to wait for a long
time before the first result will be returned. This is especially unpleasant in
a client-server setup, when query processing can block the server for seconds or even minutes.</p>

<p>This mode makes the whole
objects result set available at once - ID list is built based on the committed
state in the database. As soon as a result is delivered it won't be changed
neither by changes in current transaction neither by committed changes from
another transactions. </p>

<p>Note, that resultset contains
only references to objects, you were querying for, which means that if an
object field has changed by the time of the actual object retrieval from the
object set - you will get the new field value:</p>


<span name="cs_wiki_filter" csw_filters="cs">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">QueryModesExample.cs: <span class="fscMemberName">TestImmediateChanged</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/None.gif" align="top"/><span style="color: #0000FF;">private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">static</span><span style="color: #000000;"> </span><span style="color: #0000FF;">void</span><span style="color: #000000;"> TestImmediateChanged()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Open_Text').style.display='inline';"/>        </span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_51_1135_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Testing immediate mode with field changes</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">);
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            FillUpDB(</span><span style="color: #800080;">10</span><span style="color: #000000;">);
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IConfiguration configuration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration();
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            configuration.Queries().EvaluationMode(QueryEvaluationMode.IMMEDIATE);
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            IObjectContainer db </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(configuration, Db4oFileName);
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">try</span><span style="color: #000000;">
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Open_Text').style.display='inline';"/>            </span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_426_1049_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                IQuery query1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query();
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query1.Constrain(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(Pilot));
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query1.Descend(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">_points</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">).Constrain(</span><span style="color: #800080;">5</span><span style="color: #000000;">).Smaller();
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                IObjectSet result1 </span><span style="color: #000000;">=</span><span style="color: #000000;"> query1.Execute();
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #008000;">//</span><span style="color: #008000;"> change field</span><span style="color: #008000;">
</span><span style="color: #008080;">16</span><span style="color: #008000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/></span><span style="color: #000000;">                IQuery query2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query();
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query2.Constrain(</span><span style="color: #0000FF;">typeof</span><span style="color: #000000;">(Pilot));
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query2.Descend(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">_points</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">).Constrain(</span><span style="color: #800080;">2</span><span style="color: #000000;">);
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                IObjectSet result2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> query2.Execute();
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                Pilot pilot2 </span><span style="color: #000000;">=</span><span style="color: #000000;"> (Pilot)result2[</span><span style="color: #800080;">0</span><span style="color: #000000;">];
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                pilot2.AddPoints(</span><span style="color: #800080;">22</span><span style="color: #000000;">);
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Set(pilot2);
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                ListResult(result1);
</span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">finally</span><span style="color: #000000;">
</span><span style="color: #008080;">26</span><span style="color: #000000;"><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedSubBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Open_Text').style.display='inline';"/>            </span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">...</span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesquerymodeCS.ZipsQueryModesExample.Cs_QueryModesExample.Cs_TestImmediateChanged_1306_71_1082_1125_Open_Text"><span style="color: #000000;">{
</span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close();
</span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"/>            }</span></span><span style="color: #000000;">
</span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        }</span></span></div></pre></div></div>

</span>

<span name="cs_wiki_filter" csw_filters="vb">

<div class="FormattedSourceCode"><div class="fscHeader"><span class="fscFileName">QueryModesExample.vb: <span class="fscMemberName">TestImmediateChanged</span></span></div><div class="fscCode"><pre ID="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080;">01</span><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Open_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockStart.gif" align="top" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Open_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Closed_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Closed_Text').style.display='inline';"/><img id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Closed_Image" src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ContractedBlock.gif" align="top" style="display: none;" onClick="this.style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Closed_Text').style.display='none'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Open_Image').style.display='inline'; document.getElementById('ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Open_Text').style.display='inline';"/><span style="color: #0000FF;">Private</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Shared</span><span style="color: #000000;"> </span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Closed_Text" style="border: solid 1px #808080; background-color: #FFFFFF; display: none;">Sub TestImmediateChanged()</span><span id="ResourcesReferenceObject_LifecycleQueryingQuery_ModesQuerymodeVB.ZipsQueryModesExample.Vb_QueryModesExample.Vb_TestImmediateChanged_1441_71_15_1091_Open_Text"><span style="color: #0000FF;">Sub</span><span style="color: #000000;"> TestImmediateChanged()
</span><span style="color: #008080;">02</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            Console.WriteLine(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">Testing immediate mode with field changes</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">)
</span><span style="color: #008080;">03</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            FillUpDB(</span><span style="color: #800080;">10</span><span style="color: #000000;">)
</span><span style="color: #008080;">04</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> configuration </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IConfiguration </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.NewConfiguration()
</span><span style="color: #008080;">05</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            configuration.Queries.EvaluationMode(QueryEvaluationMode.IMMEDIATE)
</span><span style="color: #008080;">06</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> db </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectContainer </span><span style="color: #000000;">=</span><span style="color: #000000;"> Db4oFactory.OpenFile(configuration, Db4oFileName)
</span><span style="color: #008080;">07</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">08</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> query1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IQuery </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query
</span><span style="color: #008080;">09</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query1.Constrain(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(Pilot))
</span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query1.Descend(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">_points</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">).Constrain(</span><span style="color: #800080;">5</span><span style="color: #000000;">).Smaller()
</span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> result1 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> query1.Execute
</span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> query2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IQuery </span><span style="color: #000000;">=</span><span style="color: #000000;"> db.Query
</span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query2.Constrain(</span><span style="color: #0000FF;">GetType</span><span style="color: #000000;">(Pilot))
</span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                query2.Descend(</span><span style="color: #800000;">&quot;</span><span style="color: #800000;">_points</span><span style="color: #800000;">&quot;</span><span style="color: #000000;">).Constrain(</span><span style="color: #800080;">2</span><span style="color: #000000;">)
</span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> result2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> IObjectSet </span><span style="color: #000000;">=</span><span style="color: #000000;"> query2.Execute
</span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                </span><span style="color: #0000FF;">Dim</span><span style="color: #000000;"> pilot2 </span><span style="color: #0000FF;">As</span><span style="color: #000000;"> Pilot </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000FF;">CType</span><span style="color: #000000;">(result2(</span><span style="color: #800080;">0</span><span style="color: #000000;">), Pilot)
</span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                pilot2.AddPoints(</span><span style="color: #800080;">22</span><span style="color: #000000;">)
</span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Set(pilot2)
</span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                ListResult(result1)
</span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">Finally</span><span style="color: #000000;">
</span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>                db.Close()
</span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/InBlock.gif" align="top"/>            </span><span style="color: #0000FF;">End</span><span style="color: #000000;"> </span><span style="color: #0000FF;">Try</span><span style="color: #000000;">
</span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="../../../../Utility/ActiPro.CodeHighligher/OutliningIndicators/ExpandedBlockEnd.gif" align="top"/>        </span><span style="color: #0000FF;">End Sub</span></span></div></pre></div></div>

</span>


<a name="Immediate Mode Pros And Cons"></a><h2>Immediate Mode Pros And Cons</h2>

<p>Pros:</p>

<ul>
<li>If the query is intended to iterate through the entire resulting ObjectSet, <a href="http://developer.db4o.com/Resources/edit.aspx/Reference/Db4o_Concepts/Query_Modes/svntestdb4obuilddistjavadb4o-6.0docapicomdb4oObjectSet.html" title="interface in com.db4o"><code></code></a>this mode will be slightly faster than the
others.</li>

<li>The query will process without intermediate
side effects from changed objects (by the caller or by other transactions).</li>
</ul>


<p>Cons:</p>

<ul>
<li>Query processing can block the server for a long time.</li>

<li>In comparison to the other modes it will take longest until the first
results are returned.</li>

<li>The ObjectSet will require a considerate amount of memory to hold the
IDs of all found objects.</li>
</ul></div>
    </div>
    <div id="footer">
					This revision (10) was last Modified 2006-12-04T13:21:56 by Tetyana.
				</div>
  </body>
</html>