Skip to content

Commit

Permalink
Merge branch 'develop' into admin/docbot
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-parry committed Sep 20, 2018
2 parents 01f6e94 + 1e08dc6 commit b104aa3
Show file tree
Hide file tree
Showing 22 changed files with 1,664 additions and 175 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dist: precise
env:
- DB=mysqli
- DB=postgres
- DB=sqlite

services:
- memcached
Expand Down
1 change: 1 addition & 0 deletions php_errors.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[30-Jan-2018 23:57:36 America/Chicago] PHP Fatal error: Class 'z' not found in /Users/kilishan/WebSites/CodeIgniter4/tests/system/Validation/RulesTest.php on line 5
5 changes: 4 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
</testsuite>
<testsuite name="system">
<directory>./tests/system</directory>
<!-- <exclude>./tests/system/Database/Live</exclude> -->
<exclude>./tests/system/Database</exclude>
</testsuite>
<testsuite name="database">
<directory>./tests/system/Database</directory>
</testsuite>
</testsuites>

Expand Down
25 changes: 25 additions & 0 deletions system/Database/BaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,21 @@ class BaseBuilder
*/
protected $binds = [];

/**
* Some databases, like SQLite, do not by default
* allow limiting of delete clauses.
*
* @var bool
*/
protected $canLimitDeletes = true;

/**
* Some databases do not by default
* allow limit update queries with WHERE.
* @var bool
*/
protected $canLimitWhereUpdates = true;

//--------------------------------------------------------------------

/**
Expand Down Expand Up @@ -1908,6 +1923,11 @@ public function update($set = null, $where = null, int $limit = null, $test = fa

if ( ! empty($limit))
{
if (! $this->canLimitWhereUpdates)
{
throw new DatabaseException('This driver does not allow LIMITs on UPDATE queries using WHERE.');
}

$this->limit($limit);
}

Expand Down Expand Up @@ -2292,6 +2312,11 @@ public function delete($where = '', $limit = null, $reset_data = true, $returnSQ

if ( ! empty($this->QBLimit))
{
if (! $this->canLimitDeletes)
{
throw new DatabaseException('SQLite3 does not allow LIMITs on DELETE queries.');
}

$sql = $this->_limit($sql);
}

Expand Down
Loading

0 comments on commit b104aa3

Please sign in to comment.