joomla/joomla-platform — pull request #679 by gpongelli (2011-12-29 16:09:50+00:00)
Title: Changed quoteName function.

Now quoteName can take an array of names to quote and each can have dot notation.
Added alias support "AS" as second parameter, same type of first parameter, so if first parameter is a string second need to be a string, if first parameter is an array second need to be an array.
Special mention to first parameter array: each array element will be quoted and can be aliased with second parameter array that must be same length and contain null value for those element that doesn't need alias, so for example

$db->quoteName( array('a', 'b'), array('alias_a', 'alias_b') );

using " as quote character, this call will return an array with

Array
(
[0] => '"a" AS "alias_a"'
[1] => '"b" AS "alias_b"'
)

while this example

$db->quoteName( array('a', 'b'), array(null, 'alias_b') );

using " as quote character, this call will return an array with

Array
(
[0] => '"a"'
[1] => '"b" AS "alias_b"'
)

More complex example

$db->quoteName( array('a.c', 'b.d'), array(null, 'alias_b_d') );

will return an array with

Array
(
[0] => '"a"."c"'
[1] => '"b"."d" AS "alias_b_d"'
)

This pull request contain also changes to relative quoteName test to try array quote and alias parameter.