original_string: protected function getSqlForSelect($count = false)
      {
          $parts = $this->sqlParts;
  
          if (!$parts['select']) {
              $parts['select'] = array('*');
          }
  
          $query = 'SELECT ' . implode(', ', $parts['select']) . ' FROM ' . $this->getFrom();
  
          // JOIN
          foreach ($parts['join'] as $join) {
              $query .= ' ' . strtoupper($join['type'])
                  . ' JOIN ' . $join['table']
                  . ' ON ' . $join['on'];
          }
  
          $query .= ($parts['where'] !== null ? ' WHERE ' . ((string)$parts['where']) : '')
              . ($parts['groupBy'] ? ' GROUP BY ' . implode(', ', $parts['groupBy']) : '')
              . ($parts['having'] !== null ? ' HAVING ' . ((string)$parts['having']) : '');
  
          if (false === $count) {
              $query .= ($parts['orderBy'] ? ' ORDER BY ' . implode(', ', $parts['orderBy']) : '')
                  . ($parts['limit'] !== null ? ' LIMIT ' . $parts['limit'] : '')
                  . ($parts['offset'] !== null ? ' OFFSET ' . $parts['offset'] : '');
          }
  
          $query .= $this->generateLockSql();
  
          return $query;
      }
code: protected function getSqlForSelect($count = false)
      {
          $parts = $this->sqlParts;
  
          if (!$parts['select']) {
              $parts['select'] = array('*');
          }
  
          $query = 'SELECT ' . implode(', ', $parts['select']) . ' FROM ' . $this->getFrom();
  
          // JOIN
          foreach ($parts['join'] as $join) {
              $query .= ' ' . strtoupper($join['type'])
                  . ' JOIN ' . $join['table']
                  . ' ON ' . $join['on'];
          }
  
          $query .= ($parts['where'] !== null ? ' WHERE ' . ((string)$parts['where']) : '')
              . ($parts['groupBy'] ? ' GROUP BY ' . implode(', ', $parts['groupBy']) : '')
              . ($parts['having'] !== null ? ' HAVING ' . ((string)$parts['having']) : '');
  
          if (false === $count) {
              $query .= ($parts['orderBy'] ? ' ORDER BY ' . implode(', ', $parts['orderBy']) : '')
                  . ($parts['limit'] !== null ? ' LIMIT ' . $parts['limit'] : '')
                  . ($parts['offset'] !== null ? ' OFFSET ' . $parts['offset'] : '');
          }
  
          $query .= $this->generateLockSql();
  
          return $query;
      }
code_tokens: protected function getSqlForSelect ( $ count = false ) { $ parts = $ this -> sqlParts ; if ( ! $ parts [ 'select' ] ) { $ parts [ 'select' ] = array ( '*' ) ; } $ query = 'SELECT ' . implode ( ', ' , $ parts [ 'select' ] ) . ' FROM ' . $ this -> getFrom ( ) ; // JOIN foreach ( $ parts [ 'join' ] as $ join ) { $ query .= ' ' . strtoupper ( $ join [ 'type' ] ) . ' JOIN ' . $ join [ 'table' ] . ' ON ' . $ join [ 'on' ] ; } $ query .= ( $ parts [ 'where' ] !== null ? ' WHERE ' . ( ( string ) $ parts [ 'where' ] ) : '' ) . ( $ parts [ 'groupBy' ] ? ' GROUP BY ' . implode ( ', ' , $ parts [ 'groupBy' ] ) : '' ) . ( $ parts [ 'having' ] !== null ? ' HAVING ' . ( ( string ) $ parts [ 'having' ] ) : '' ) ; if ( false === $ count ) { $ query .= ( $ parts [ 'orderBy' ] ? ' ORDER BY ' . implode ( ', ' , $ parts [ 'orderBy' ] ) : '' ) . ( $ parts [ 'limit' ] !== null ? ' LIMIT ' . $ parts [ 'limit' ] : '' ) . ( $ parts [ 'offset' ] !== null ? ' OFFSET ' . $ parts [ 'offset' ] : '' ) ; } $ query .= $ this -> generateLockSql ( ) ; return $ query ; }
docstring: Converts this instance into an SELECT string in SQL
  
  @param bool $count
  @return string
docstring_tokens: Converts this instance into an SELECT string in SQL