예제 #1
0
 /**
  * Test loadAssoc method.
  *
  * @return  void
  *
  * @since   11.4
  */
 public function testLoadAssoc()
 {
     $query = $this->object->getQuery(true);
     $query->select('title');
     $query->from('jos_dbtest');
     $this->object->setQuery($query);
     $result = $this->object->loadAssoc();
     $this->assertThat($result, $this->equalTo(array('title' => 'Testing')), __LINE__);
 }
예제 #2
0
 /**
  * Query to database
  * @param JBDatabaseQuery $select
  * @param bool            $isOne
  * @param bool            $toArray
  * @return mixed
  */
 protected function _query(JBDatabaseQuery $select, $isOne = false, $toArray = false)
 {
     //jbdump::sql($select);
     $selectSql = (string) $select;
     $this->app->jbdebug->sql($selectSql);
     $this->_db->setQuery($selectSql);
     if (!$toArray) {
         if ((bool) $isOne) {
             $result = $this->_db->loadObject();
         } else {
             $result = $this->_db->loadObjectList();
         }
     } else {
         if ((bool) $isOne) {
             $result = $this->_db->loadAssoc();
         } else {
             $result = $this->_db->loadAssocList();
         }
     }
     return $result;
 }