Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sqlite #793

Merged
merged 16 commits into from
Sep 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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