Code Duplication    Length = 14-14 lines in 2 locations

Query/pgsql_limit.php 1 location

@@ 31-44 (lines=14) @@
28
 *
29
 * @return string
30
 */
31
function pgsql_limit($sql, $limit = null, $offset = null)
32
{
33
    if ($limit !== null) {
34
        $limit = (int) $limit;
35
        $sql .= " LIMIT $limit";
36
    }
37
38
    if ($offset !== null) {
39
        $offset = (int) $offset;
40
        $sql .= " OFFSET $offset";
41
    }
42
43
    return $sql;
44
}
45

Query/sqlsrv_limit.php 1 location

@@ 32-45 (lines=14) @@
29
 * @param string $offset valor offset
30
 * @return string
31
 */
32
function sqlsrv_limit($sql, $limit = null, $offset = null)
33
{
34
    if ($limit !== null) {
35
        $limit = (int) $limit;
36
        $sql = preg_replace('/(DELETE|INSERT|SELECT|UPDATE)/i', '${1} TOP ' . $limit, $sql);
37
    }
38
39
    if ($offset !== null) {
40
        $offset = (int) $offset;
41
        $sql .= " OFFSET $offset";
42
    }
43
44
    return $sql;
45
}
46