# phpDox - Source of AbstractSQL.php

# Source of file AbstractSQL.php

Size: 0,864 Bytes - Last Modified: 2020-04-17T14:56:27-04:00

## src/Drivers/AbstractSQL.php

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

    <?php declare(strict_types=1);

    /**

     * Query

     *

     * SQL Query Builder / Database Abstraction Layer

     *

     * PHP version 7.4

     *

     * @package     Query

     * @author      Timothy J. Warren <tim@timshomepage.net>

     * @copyright   2012 - 2020 Timothy J. Warren

     * @license     http://www.opensource.org/licenses/mit-license.html  MIT License

     * @link        https://git.timshomepage.net/aviat/Query

     * @version     3.0.0

     */

    namespace Query\Drivers;

    /**

     * Parent for database-specific syntax subclasses

     */

    abstract class AbstractSQL implements SQLInterface {

    	/**

    	 * Limit clause

    	 *

    	 * @param string $sql

    	 * @param int $limit

    	 * @param int $offset

    	 * @return string

    	 */

    	public function limit(string $sql, int $limit, ?int $offset=NULL): string

    	{

    		$sql .= "\nLIMIT {$limit}";

    		if (is_numeric($offset))

    		{

    			$sql .= " OFFSET {$offset}";

    		}

    		return $sql;

    	}

    }