mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-16 11:58:41 +00:00
78 lines
1.8 KiB
PHP
78 lines
1.8 KiB
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.2
|
|
*
|
|
* @package phpOMS\DataStorage\Database\Schema\Grammar
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link http://website.orange-management.de
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace phpOMS\DataStorage\Database\Schema\Grammar;
|
|
|
|
use phpOMS\DataStorage\Database\Query\Builder;
|
|
|
|
/**
|
|
* Database query grammar.
|
|
*
|
|
* @package phpOMS\DataStorage\Database\Schema\Grammar
|
|
* @license OMS License 1.0
|
|
* @link http://website.orange-management.de
|
|
* @since 1.0.0
|
|
*/
|
|
class MysqlGrammar extends Grammar
|
|
{
|
|
/**
|
|
* System identifier.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
protected $systemIdentifier = '`';
|
|
|
|
/**
|
|
* Compile from.
|
|
*
|
|
* @param Builder $query Builder
|
|
* @param array $table Tables
|
|
*
|
|
* @return string
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
protected function compileSelectTables(Builder $query, array $table) : string
|
|
{
|
|
$builder = new Builder($query->getConnection());
|
|
$builder->select('table_name')
|
|
->from('information_schema.tables')
|
|
->where('table_schema', '=', $query->getConnection()->getDatabase());
|
|
|
|
return \rtrim($builder->toSql(), ';');
|
|
}
|
|
|
|
/**
|
|
* Compile from.
|
|
*
|
|
* @param Builder $query Builder
|
|
* @param array $table Tables
|
|
*
|
|
* @return string
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
protected function compileSelectFields(Builder $query, array $table) : string
|
|
{
|
|
$builder = new Builder($query->getConnection());
|
|
$builder->select('*')
|
|
->from('information_schema.columns')
|
|
->where('table_schema', '=', $query->getConnection()->getDatabase())
|
|
->andWhere('table_name', '=', 'test');
|
|
|
|
return \rtrim($builder->toSql(), ';');
|
|
}
|
|
}
|