public function query($Sql, $Parameters = null)
{
$Db = Gdn::database();
// Replace db prefixes.
$Sql = str_replace(array(':_z', ':_'), array($Db->DatabasePrefix . self::TABLE_PREFIX, $Db->DatabasePrefix), $Sql);
// Figure out the type of the type of the query.
if (stringBeginsWith($Sql, 'select')) {
$Type = 'select';
} elseif (stringBeginsWith($Sql, 'truncate')) {
$Type = 'truncate';
} elseif (stringBeginsWith($Sql, 'insert')) {
$Type = 'insert';
} elseif (stringBeginsWith($Sql, 'update')) {
$Type = 'update';
} elseif (stringBeginsWith($Sql, 'delete')) {
$Type = 'delete';
} else {
$Type = 'select';
}
// Execute the query.
if (is_array($Parameters)) {
$this->SQL->namedParameters($Parameters);
}
$Result = $this->SQL->query($Sql, $Type);
//$this->Timer->Split('Sql: '. str_replace("\n", "\n ", $Sql));
return $Result;
}