You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.1 KiB
54 lines
1.1 KiB
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* @author Robert Strutts
|
|
* @copyright (c) 2026, Robert Strutts
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace IOcornerstone\Framework\Database\Grammar;
|
|
|
|
/**
|
|
* Description of MySQLGrammar
|
|
*
|
|
* @author Robert Strutts
|
|
*/
|
|
class MySQLGrammar extends Grammar
|
|
{
|
|
public function wrap(string $column): string
|
|
{
|
|
return "`{$column}`";
|
|
}
|
|
|
|
public function compileYear(string $column): string
|
|
{
|
|
return "YEAR({$this->wrap($column)})";
|
|
}
|
|
|
|
public function compileMonth(string $column): string
|
|
{
|
|
return "MONTH({$this->wrap($column)})";
|
|
}
|
|
|
|
public function compileDay(string $column): string
|
|
{
|
|
return "DAY({$this->wrap($column)})";
|
|
}
|
|
|
|
public function compileDate(string $column): string
|
|
{
|
|
return "DATE({$this->wrap($column)})";
|
|
}
|
|
|
|
public function compileTime(string $column): string
|
|
{
|
|
return "TIME({$this->wrap($column)})";
|
|
}
|
|
|
|
public function compileJsonContains(string $column): string
|
|
{
|
|
return "JSON_CONTAINS({$this->wrap($column)}, ?)";
|
|
}
|
|
} |