protected function Go_Click()
 {
     QApplication::$blnLocalCache = false;
     $timeNoCache = -microtime(true);
     $a = Person::LoadAll();
     // noncached loads
     $timeNoCache += microtime(true);
     QApplication::$blnLocalCache = true;
     $timeLoad1Cached = -microtime(true);
     $a = Person::LoadAll();
     // noncached loads
     $timeLoad1Cached += microtime(true);
     $timeLoad2Cached = -microtime(true);
     $a = Person::LoadAll();
     // cached loads
     $timeLoad2Cached += microtime(true);
     QApplication::$blnLocalCache = new QCacheProviderLocalMemory(array());
     $timeLoad3Cached = -microtime(true);
     $a = Person::LoadAll();
     // noncached loads
     $timeLoad3Cached += microtime(true);
     $timeLoad4Cached = -microtime(true);
     $a = Person::LoadAll();
     // cached loads
     $timeLoad4Cached += microtime(true);
     $this->pnlTiny->Text = sprintf("Load No Cache: %2.1f%% \n", 100 * $timeNoCache / $timeNoCache) . sprintf("Populate Cache: %2.1f%% \n", 100 * $timeLoad1Cached / $timeNoCache) . sprintf("Load With Cache: %2.1f%% \n", 100 * $timeLoad2Cached / $timeNoCache) . sprintf("Populate LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad3Cached / $timeNoCache) . sprintf("Load LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad4Cached / $timeNoCache);
     $cond = QQ::Equal(QQN::Project()->ProjectStatusTypeId, ProjectStatusType::Open);
     $clauses[] = QQ::Expand(QQN::Project()->ManagerPerson);
     Project::ClearCache();
     Person::ClearCache();
     QApplication::$blnLocalCache = false;
     $timeNoCache = -microtime(true);
     $a = Project::QueryArray($cond, $clauses);
     // noncached loads
     $timeNoCache += microtime(true);
     QApplication::$blnLocalCache = true;
     $timeLoad1Cached = -microtime(true);
     $a = Project::QueryArray($cond, $clauses);
     // noncached loads
     $timeLoad1Cached += microtime(true);
     $timeLoad2Cached = -microtime(true);
     $a = Project::QueryArray($cond, $clauses);
     // cached loads
     $timeLoad2Cached += microtime(true);
     QApplication::$blnLocalCache = new QCacheProviderLocalMemory(array());
     $timeLoad3Cached = -microtime(true);
     $a = Project::QueryArray($cond, $clauses);
     // noncached loads
     $timeLoad3Cached += microtime(true);
     $timeLoad4Cached = -microtime(true);
     $a = Project::QueryArray($cond, $clauses);
     // cached loads
     $timeLoad4Cached += microtime(true);
     $this->pnlBig->Text = sprintf("Load No Cache: %2.1f%% \n", 100 * $timeNoCache / $timeNoCache) . sprintf("Populate Cache: %2.1f%% \n", 100 * $timeLoad1Cached / $timeNoCache) . sprintf("Load With Cache: %2.1f%% \n", 100 * $timeLoad2Cached / $timeNoCache) . sprintf("Populate LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad3Cached / $timeNoCache) . sprintf("Load LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad4Cached / $timeNoCache);
 }
 public function testSelectSubsetInExpand()
 {
     Project::ClearCache();
     Person::ClearCache();
     Milestone::ClearCache();
     $objPersonArray = Person::QueryArray(QQ::OrCondition(QQ::Like(QQN::Person()->ProjectAsManager->Name, '%ACME%'), QQ::Like(QQN::Person()->ProjectAsManager->Name, '%HR%')), QQ::Clause(QQ::Select(QQN::Person()->LastName), QQ::Expand(QQN::Person()->ProjectAsManager, null, QQ::Select(QQN::Person()->ProjectAsManager->Spent)), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
     foreach ($objPersonArray as $objPerson) {
         $this->assertNull($objPerson->FirstName, "FirstName should be null, since it was not selected");
         $this->assertNotNull($objPerson->Id, "Id should not be null since it's always added to the select list");
         $this->assertNotNull($objPerson->_ProjectAsManager->Id, "ProjectAsManager->Id should not be null since id's are always added to the select list");
         $this->assertNull($objPerson->_ProjectAsManager->Name, "ProjectAsManager->Name should be null since it was not selected");
     }
     // generate full objects to load into cache
     $objPersonArray = Person::QueryArray(QQ::OrCondition(QQ::Like(QQN::Person()->ProjectAsManager->Name, '%ACME%'), QQ::Like(QQN::Person()->ProjectAsManager->Name, '%HR%')), QQ::Clause(QQ::Expand(QQN::Person()->ProjectAsManager), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
     $objPersonArray = Person::QueryArray(QQ::OrCondition(QQ::Like(QQN::Person()->ProjectAsManager->Name, '%ACME%'), QQ::Like(QQN::Person()->ProjectAsManager->Name, '%HR%')), QQ::Clause(QQ::Select(QQN::Person()->LastName), QQ::Expand(QQN::Person()->ProjectAsManager, null, QQ::Select(QQN::Person()->ProjectAsManager->Spent)), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
     foreach ($objPersonArray as $objPerson) {
         $this->assertNotNull($objPerson->FirstName, "FirstName should not be null, because it has been cached");
         $this->assertNotNull($objPerson->Id, "Id should not be null since it's always added to the select list");
         $this->assertNotNull($objPerson->_ProjectAsManager->Id, "ProjectAsManager->Id should not be null since id's are always added to the select list");
         $this->assertNotNull($objPerson->_ProjectAsManager->Name, "ProjectAsManager->Name should not be null since it was cached");
     }
 }