for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WebServCo\Framework\Traits;
trait MysqlDatabaseTrait
{
public function escapeIdentifier($string)
return '`' . str_replace('`', '``', $string) . '`';
}
public function escapeTableName($string)
$parts = explode('.', $string);
if (!empty($parts[1])) {
return sprintf(
'%s.%s',
$this->escapeIdentifier($parts[0]),
$this->escapeIdentifier($parts[1]),
);
return $this->escapeIdentifier($parts[0]);