/**
  * Fetches the meta data from the index by a given where clause.
  * All selected records will be returned which means an array of meta data arrays.
  * If the uid field is selected it will be used as index in the returned array.
  * Additional WHERE clauses are appended to limit access to non-deleted entries and so on.
  *
  * @param	string		$fields A list of fields to be fetched. Default is a list of fields generated by tx_dam_db::getMetaInfoFieldList().
  * @param	array		$whereClauses WHERE clauses as array with associative keys (which can be used to overwrite 'enableFields' or 'pidList') or a single one as string.
  * @param	string		$groupBy Optional GROUP BY field(s), if none, supply blank string.
  * @param	string		$orderBy Optional ORDER BY field(s), if none, supply blank string.
  * @param	string		$limit Optional LIMIT value ([begin,]max), if none, supply blank string.
  * @return	array		Array of meta data arrays or false
  */
 function getDataWhere($select_fields, $whereClauses = array(), $groupBy = '', $orderBy = '', $limit = '')
 {
     $rows = array();
     $select_fields = $select_fields ? $select_fields : tx_dam_db::getMetaInfoFieldList();
     $where = tx_dam_db::fillWhereClauseArray($whereClauses);
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, 'tx_dam', implode(' AND ', $where), $groupBy, $orderBy, $limit);
     #debug ($GLOBALS['TYPO3_DB']->SELECTquery($select_fields, 'tx_dam', implode(' AND ', $where), $groupBy, $orderBy, $limit), 'getDataWhere');
     if ($res) {
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // Is there a workspace overlay?
             if (isset($GLOBALS['BE_USER']->workspace) && $GLOBALS['BE_USER']->workspace !== 0) {
                 if (isset($GLOBALS['TSFE'])) {
                     // we are in frontend
                     $GLOBALS['TSFE']->sys_page->versionOL('tx_dam', $row);
                 } else {
                     // it's the backend
                     t3lib_befunc::workspaceOL('tx_dam', $row);
                 }
             }
             if (isset($row['uid'])) {
                 $rows[$row['uid']] = $row;
             } else {
                 $rows[] = $row;
             }
         }
     }
     return $rows;
 }