private function _escape($entries) {

        // treat argument as an array
        $entries = (array)$entries;

        $result = array();

        // iterate over the entries given as argument
        foreach ($entries as $entry) {

            // explode string by dots
            $entry = explode('.', $entry);

            // iterate over the segments
            $entry = array_map(function($value) {

                // trim ticks and whitespace
                $value = trim(trim($value, '`'));

                // if not * or a MySQL function
                if ($value !== '*' && !$this->_is_mysql_function($value)) {

                    // if alias is used
                    if (stripos($value, ' as ') !== false) list($value, $alias) = array_map('trim', preg_split('/ as /i', $value));

                    // enclose value in grave accents
                    return '`' . $value . '`' . (isset($alias) ? ' AS ' . $alias : '');

                }

                // return the value as it is otherwise
                return $value;

            }, $entry);

            // concatenate the string back and add it to the result
            $result[] = implode('.', $entry);

        }

        // recompose the string and return it
        return implode(', ', $result);

    }
private function _escape($entries) {

        // treat argument as an array
        $entries = (array)$entries;

        $result = array();

        // iterate over the entries given as argument
        foreach ($entries as $entry) {

            // explode string by dots
            $entry = explode('.', $entry);

            // iterate over the segments
            $entry = array_map(function($value) {

                // trim ticks and whitespace
                $value = trim(trim($value, '`'));

                // if not * or a MySQL function
                if ($value !== '*' && !$this->_is_mysql_function($value)) {

                    // if alias is used
                    if (stripos($value, ' as ') !== false) list($value, $alias) = array_map('trim', preg_split('/ as /i', $value));

                    // enclose value in grave accents
                    return '`' . $value . '`' . (isset($alias) ? ' AS ' . $alias : '');

                }

                // return the value as it is otherwise
                return $value;

            }, $entry);

            // concatenate the string back and add it to the result
            $result[] = implode('.', $entry);

        }

        // recompose the string and return it
        return implode(', ', $result);

    }
private function _escape ( $ entries ) { // treat argument as an array $ entries = ( array ) $ entries ; $ result = array ( ) ; // iterate over the entries given as argument foreach ( $ entries as $ entry ) { // explode string by dots $ entry = explode ( '.' , $ entry ) ; // iterate over the segments $ entry = array_map ( function ( $ value ) { // trim ticks and whitespace $ value = trim ( trim ( $ value , '`' ) ) ; // if not * or a MySQL function if ( $ value !== '*' && ! $ this -> _is_mysql_function ( $ value ) ) { // if alias is used if ( stripos ( $ value , ' as ' ) !== false ) list ( $ value , $ alias ) = array_map ( 'trim' , preg_split ( '/ as /i' , $ value ) ) ; // enclose value in grave accents return '`' . $ value . '`' . ( isset ( $ alias ) ? ' AS ' . $ alias : '' ) ; } // return the value as it is otherwise return $ value ; } , $ entry ) ; // concatenate the string back and add it to the result $ result [ ] = implode ( '.' , $ entry ) ; } // recompose the string and return it return implode ( ', ' , $ result ) ; }
Encloses segments of a database.table.column construction in grave accents.

@param  mixed   A string or an array to escape.

@return string  Returns a string with the segments of a database.table.column construction enclosed in grave
accents.

@access private
Encloses segments of a database . table . column construction in grave accents .