Query/src/Drivers/AbstractSQL.php

39 lines
770 B
PHP
Raw Normal View History

2016-10-12 22:12:25 -04:00
<?php declare(strict_types=1);
/**
* Query
*
2016-09-07 13:17:17 -04:00
* SQL Query Builder / Database Abstraction Layer
*
2022-09-29 11:33:08 -04:00
* PHP version 8.1
2016-09-07 13:17:17 -04:00
*
* @package Query
2023-01-20 11:30:51 -05:00
* @author Timothy J. Warren <tim@timshome.page>
* @copyright 2012 - 2023 Timothy J. Warren
2016-09-07 13:17:17 -04:00
* @license http://www.opensource.org/licenses/mit-license.html MIT License
2019-12-11 16:49:42 -05:00
* @link https://git.timshomepage.net/aviat/Query
2023-03-17 16:34:21 -04:00
* @version 4.1.0
*/
2023-03-17 15:18:33 -04:00
2016-09-07 17:39:19 -04:00
namespace Query\Drivers;
/**
* Parent for database-specific syntax subclasses
*/
2023-03-17 15:18:33 -04:00
abstract class AbstractSQL implements SQLInterface
{
/**
* Limit clause
*/
public function limit(string $sql, int $limit, ?int $offset=NULL): string
{
$sql .= "\nLIMIT {$limit}";
if (is_numeric($offset))
{
$sql .= " OFFSET {$offset}";
}
return $sql;
}
}