From: Marcel Werk Date: Thu, 1 Mar 2012 20:26:02 +0000 (+0100) Subject: Added an option to disable the qualified shorthand in dbo list queries X-Git-Tag: 2.0.0_Beta_1~1286 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=291dad13d5e5a1a84ba3571e0c4cd39ab3b747e2;p=GitHub%2FWoltLab%2FWCF.git Added an option to disable the qualified shorthand in dbo list queries --- diff --git a/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php b/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php index 4fdef16772..530becdad3 100644 --- a/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php +++ b/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php @@ -75,6 +75,12 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { */ public $sqlJoins = ''; + /** + * enables the automatic usage of the qualified shorthand + * @var boolean + */ + public $useQualifiedShorthand = true; + /** * sql conditions * @var wcf\system\database\util\PreparedStatementConditionBuilder @@ -142,8 +148,8 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { return; } - $sql = "SELECT ".(!empty($this->sqlSelects) ? $this->sqlSelects.',' : '')." - ".$this->getDatabaseTableAlias().".* + $sql = "SELECT ".(!empty($this->sqlSelects) ? $this->sqlSelects.($this->useQualifiedShorthand ? ',' : '') : '')." + ".($this->useQualifiedShorthand ? $this->getDatabaseTableAlias().'.*' : '')." FROM ".$this->getDatabaseTableName()." ".$this->getDatabaseTableAlias()." ".$this->sqlJoins." WHERE ".$this->getDatabaseTableAlias().".".$this->getDatabaseTableIndexName()." IN (?".str_repeat(',?', count($this->objectIDs) - 1).") @@ -153,8 +159,8 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { $this->objects = $statement->fetchObjects(($this->objectClassName ?: $this->className)); } else { - $sql = "SELECT ".(!empty($this->sqlSelects) ? $this->sqlSelects.',' : '')." - ".$this->getDatabaseTableAlias().".* + $sql = "SELECT ".(!empty($this->sqlSelects) ? $this->sqlSelects.($this->useQualifiedShorthand ? ',' : '') : '')." + ".($this->useQualifiedShorthand ? $this->getDatabaseTableAlias().'.*' : '')." FROM ".$this->getDatabaseTableName()." ".$this->getDatabaseTableAlias()." ".$this->sqlJoins." ".$this->getConditionBuilder()->__toString()."