diff --git a/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php b/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php
index 23d033739199e0136dac1640fd998a53f205f9d6..be8422dd19791b95eede7b49d1a607bcca12f021 100644
--- a/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php
+++ b/src/Lunr/Gravity/Database/DatabaseDMLQueryBuilder.php
@@ -178,6 +178,11 @@ abstract class DatabaseDMLQueryBuilder implements DMLQueryBuilderInterface
      */
     protected $is_recursive;
 
+    /**
+     * SQL Query part: String that contains the returning part
+     */
+    protected $returning;
+
     /**
      * Constructor.
      */
@@ -208,6 +213,7 @@ abstract class DatabaseDMLQueryBuilder implements DMLQueryBuilderInterface
         $this->join_type          = '';
         $this->with               = '';
         $this->is_recursive       = FALSE;
+        $this->returning          = '';
     }
 
     /**
@@ -240,6 +246,7 @@ abstract class DatabaseDMLQueryBuilder implements DMLQueryBuilderInterface
         unset($this->join_type);
         unset($this->with);
         unset($this->is_recursive);
+        unset($this->returning);
     }
 
     /**
@@ -302,7 +309,7 @@ abstract class DatabaseDMLQueryBuilder implements DMLQueryBuilderInterface
 
         if (($this->delete == '') && ($this->join == ''))
         {
-            array_push($components, 'order_by', 'limit');
+            array_push($components, 'order_by', 'limit', 'returning');
         }
 
         return 'DELETE ' . $this->implode_query($components);
diff --git a/src/Lunr/Gravity/Database/MariaDB/MariaDBConnection.php b/src/Lunr/Gravity/Database/MariaDB/MariaDBConnection.php
new file mode 100644
index 0000000000000000000000000000000000000000..b25259431b1480e6073efae93c41dc89abc24d39
--- /dev/null
+++ b/src/Lunr/Gravity/Database/MariaDB/MariaDBConnection.php
@@ -0,0 +1,67 @@
+<?php
+
+/**
+* MariaDB database connection class.
+*
+* PHP Version 5.6
+*
+* @package    Aurora\Gravity\Database\MariaDB
+* @author     Mathijs Visser <m.visser@m2mobi.com>
+* @copyright  2012-2018, M2Mobi BV, Amsterdam, The Netherlands
+* @license    http://lunr.nl/LICENSE MIT License
+*/
+
+namespace Lunr\Gravity\Database\MariaDB;
+
+use Lunr\Gravity\Database\MySQL\MySQLConnection;
+use Lunr\Gravity\Database\MySQL\MySQLDMLQueryBuilder;
+
+/**
+* MariaDB database access class.
+*/
+class MariaDBConnection extends MySQLConnection
+{
+
+    /**
+     * Constructor.
+     *
+     * @param Configuration   $configuration Shared instance of the configuration class
+     * @param LoggerInterface $logger        Shared instance of a logger class
+     * @param mysqli          $mysqli        Instance of the mysqli class
+     */
+    public function __construct($configuration, $logger, $mysqli)
+    {
+        parent::__construct($configuration, $logger, $mysqli);
+    }
+
+    /**
+     * Destructor.
+     */
+    public function __destruct()
+    {
+        parent::__destruct();
+    }
+
+    /**
+     * Return a new instance of a QueryBuilder object.
+     *
+     * @param boolean $simple Whether to return a simple query builder or an advanced one.
+     *
+     * @return MySQLDMLQueryBuilder $builder New DatabaseDMLQueryBuilder object instance
+     */
+    public function get_new_dml_query_builder_object($simple = TRUE)
+    {
+        $querybuilder = new MariaDBDMLQueryBuilder();
+        if ($simple === TRUE)
+        {
+            return new MariaDBSimpleDMLQueryBuilder($this->get_query_escaper_object(), $querybuilder);
+        }
+        else
+        {
+            return $querybuilder;
+        }
+    }
+
+}
+
+?>
diff --git a/src/Lunr/Gravity/Database/MariaDB/MariaDBDMLQueryBuilder.php b/src/Lunr/Gravity/Database/MariaDB/MariaDBDMLQueryBuilder.php
new file mode 100644
index 0000000000000000000000000000000000000000..fc7d4e9bcb78939cd5b28c70b2cc7de4cc00ccea
--- /dev/null
+++ b/src/Lunr/Gravity/Database/MariaDB/MariaDBDMLQueryBuilder.php
@@ -0,0 +1,53 @@
+<?php
+
+/**
+ * MySQL/MariaDB database query builder class.
+ *
+ * PHP Version 5.3
+ *
+ * @package    Lunr\Gravity\Database\MySQL
+ * @author     Mathijs Visser <m.visser@m2mobi.com>
+ * @copyright  2012-2018, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Gravity\Database\MariaDB;
+
+use Lunr\Gravity\Database\MySQL\MySQLDMLQueryBuilder;
+
+/**
+ * This is a SQL query builder class for generating queries for MariaDB
+ */
+class MariaDBDMLQueryBuilder extends MySQLDMLQueryBuilder
+{
+
+    /**
+     * Constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Destructor.
+     */
+    public function __destruct()
+    {
+        parent::__destruct();
+    }
+
+    /**
+     * Define which fields to return from a non SELECT query query
+     *
+     * @param string $fields Fields to return
+     *
+     * @return MariaDBDMLQueryBuilder $self Self reference
+     */
+    public function returning($fields)
+    {
+        $this->returning = 'RETURNING ' . $fields;
+        return $this;
+    }
+
+}
diff --git a/src/Lunr/Gravity/Database/MariaDB/MariaDBSimpleDMLQueryBuilder.php b/src/Lunr/Gravity/Database/MariaDB/MariaDBSimpleDMLQueryBuilder.php
new file mode 100644
index 0000000000000000000000000000000000000000..1ae83b9628e81492ba31d9dd1534cabe3e7a167c
--- /dev/null
+++ b/src/Lunr/Gravity/Database/MariaDB/MariaDBSimpleDMLQueryBuilder.php
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * MySQL/MariaDB database query builder class.
+ *
+ * PHP Version 5.3
+ *
+ * @package    Lunr\Gravity\Database\MySQL
+ * @author     Mathijs Visser <m.visser@m2mobi.com>
+ * @copyright  2012-2018, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Gravity\Database\MariaDB;
+
+use Lunr\Gravity\Database\MySQL\MySQLSimpleDMLQueryBuilder;
+
+/**
+ * This is a SQL query builder class for generating queries
+ * only suitable MariaDB, performing automatic escaping
+ * of input values where appropriate.
+ */
+class MariaDBSimpleDMLQueryBuilder extends MySQLSimpleDMLQueryBuilder
+{
+
+    /**
+     * Instance of the MySQL query escaper
+     * @var MySQLQueryEscaper
+     */
+    protected $escaper;
+
+    /**
+     * Instance of the query builder
+     * @var MariaDBDMLQueryBuilder
+     */
+    protected $querybuilder;
+
+    /**
+     * Constructor.
+     *
+     * @param MySQLQueryEscaper      $escaper      Instance of the MySQLQueryEscaper class.
+     * @param MariaDBDMLQueryBuilder $querybuilder Reference to the DMLQueryBuilder
+     */
+    public function __construct($escaper, $querybuilder)
+    {
+        parent::__construct($escaper);
+
+        $this->escaper      = $escaper;
+        $this->querybuilder = $querybuilder;
+    }
+
+    /**
+     * Destructor.
+     */
+    public function __destruct()
+    {
+        parent::__destruct();
+
+        unset($this->querybuilder);
+        unset($this->escaper);
+    }
+
+    /**
+     * Define which fields to return from a non SELECT query
+     *
+     * @param string $returning Fields to return
+     *
+     * @return MySQLDMLQueryBuilder $self Self reference
+     */
+    public function returning($returning)
+    {
+        $columns = '';
+        foreach (explode(',', $returning) as $column)
+        {
+            $columns .= $this->escaper->column($column) . ', ';
+        }
+
+        $this->returning = 'RETURNING ' . $returning;
+        return $this;
+    }
+
+}
diff --git a/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBDMLQueryBuilderDeleteTest.php b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBDMLQueryBuilderDeleteTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..6cb2ab070210ee63e4f07f53d5705ffcb9ef91ad
--- /dev/null
+++ b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBDMLQueryBuilderDeleteTest.php
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * This file contains the MariaDBDMLQueryBuilderDeleteTest class.
+ *
+ * PHP Version 5.3
+ *
+ * @package    Lunr\Gravity\Database\MariaDB
+ * @author     Mathijs Visser <m.visser@m2mobi.com>
+ * @copyright  2012-2018, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Gravity\Database\MariaDB\Tests;
+
+use Lunr\Gravity\Database\MariaDB\Tests\MariaDBDMLQueryBuilderTest;
+
+/**
+ * This class contains the tests for the query parts necessary to build
+ * delete queries.
+ *
+ * @covers Lunr\Gravity\Database\MariaDB\MariaDBDMLQueryBuilder
+ */
+class MariaDBDMLQueryBuilderDeleteTest extends MariaDBDMLQueryBuilderTest
+{
+
+    /**
+     * Test delete with returning statement.
+     *
+     * @param string $value    Returning value
+     * @param string $expected Expected built query part
+     *
+     * @dataProvider expectedReturningProvider
+     * @covers       Lunr\Gravity\Database\MariaDB\MariaDBDMLQueryBuilder::returning
+     */
+    public function testDeleteWithReturning($value, $expected)
+    {
+        $property = $this->builder_reflection->getProperty('returning');
+        $property->setAccessible(TRUE);
+
+        $this->builder->returning($value);
+
+        $this->assertContains($expected, $property->getValue($this->builder));
+    }
+
+    /**
+     * Unit Test Data Provider for delete returning statements
+     *
+     * @return array $expectedReturn
+     */
+    public function expectedReturningProvider()
+    {
+        $expectedreturn   = [];
+        $expectedreturn[] = ['*', 'RETURNING *'];
+        $expectedreturn[] = ['id, name', 'RETURNING id, name'];
+
+        return $expectedreturn;
+    }
+
+}
diff --git a/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBDMLQueryBuilderTest.php b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBDMLQueryBuilderTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..8a833755312bfea59cad537be8fdc55261c0dfa6
--- /dev/null
+++ b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBDMLQueryBuilderTest.php
@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * This file contains the MariaDMLQueryBuilderTest class.
+ *
+ * PHP Version 5.4
+ *
+ * @package    Lunr\Gravity\Database\MariaDB
+ * @author     Mathijs Visser <m.visser@m2mobi.com>
+ * @copyright  2012-2018, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Gravity\Database\MariaDB\Tests;
+
+use Lunr\Gravity\Database\MariaDB\MariaDBDMLQueryBuilder;
+use PHPUnit\Framework\TestCase;
+use ReflectionClass;
+
+/**
+ * This class contains common setup routines, providers
+ * and shared attributes for testing the MariaDBDMLQueryBuilder class.
+ *
+ * @covers Lunr\Gravity\Database\MySQL\MariaDBDMLQueryBuilder
+ */
+abstract class MariaDBDMLQueryBuilderTest extends TestCase
+{
+    /**
+     * Instance of the MySQLQueryBuilder class.
+     * @var MariaDBDMLQueryBuilder
+     */
+    protected $builder;
+
+    /**
+     * Reflection instance of the MariaDBDMLQueryBuilder class.
+     * @var ReflectionClass
+     */
+    protected $builder_reflection;
+
+    /**
+     * Mock instance of the MariaDBConnection class.
+     * @var MySQLConnection
+     */
+    protected $db;
+
+    /**
+     * TestCase Constructor.
+     */
+    public function setUp()
+    {
+        $this->db = $this->getMockBuilder('Lunr\Gravity\Database\MariaDB\MariaDBConnection')
+                         ->disableOriginalConstructor()
+                         ->getMock();
+
+        $this->builder = new MariaDBDMLQueryBuilder($this->db);
+
+        $this->builder_reflection = new ReflectionClass('Lunr\Gravity\Database\MariaDB\MariaDBDMLQueryBuilder');
+    }
+
+    /**
+     * TestCase Destructor.
+     */
+    public function tearDown()
+    {
+        unset($this->builder);
+        unset($this->builder_reflection);
+        unset($this->db);
+    }
+
+}
+
+?>
diff --git a/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderBaseTest.php b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderBaseTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..50d823ebd464b980e7fc33ec3543e6e420b167a5
--- /dev/null
+++ b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderBaseTest.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * This file contains the MariaDBSimpleDMLQueryBuilderBaseTest class.
+ *
+ * PHP Version 5.4
+ *
+ * @package    Lunr\Gravity\Database\MariaDB
+ * @author     Mathijs Visser <m.visser@m2mobi.com>
+ * @copyright  2013-2018, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Gravity\Database\MariaDB\Tests;
+
+use Lunr\Gravity\Database\MariaDB\Tests\MariaDBSimpleDMLQueryBuilderTest;
+use ReflectionClass;
+
+/**
+ * This class contains basic tests for the MariaDBSimpleDMLQueryBuilder class.
+ *
+ * @covers Lunr\Gravity\Database\MariaDB\MariaDBSimpleDMLQueryBuilder
+ */
+class MariaDBSimpleDMLQueryBuilderBaseTest extends MariaDBSimpleDMLQueryBuilderTest
+{
+
+    /**
+     * Test the QueryEscaper class is passed correctly.
+     */
+    public function testEscaperIsPassedCorrectly()
+    {
+        $instance = 'Lunr\Gravity\Database\MySQL\MySQLQueryEscaper';
+        $this->assertInstanceOf($instance, $this->escaper);
+    }
+
+}
+
+?>
diff --git a/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderDeleteTest.php b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderDeleteTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..e53c26be56ae35f423bf0ec8ac2945c4f57f9496
--- /dev/null
+++ b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderDeleteTest.php
@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * This file contains the MariaDBSimpleDMLQueryBuilderDeleteTest class.
+ *
+ * PHP Version 5.4
+ *
+ * @package    Lunr\Gravity\Database\MariaDB
+ * @author     Mathijs Visser <m.visser@m2mobi.com>
+ * @copyright  2013-2018, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Gravity\Database\MariaDB\Tests;
+
+use Lunr\Gravity\Database\MariaDB\Tests\MariaDBSimpleDMLQueryBuilderTest;
+use ReflectionClass;
+
+/**
+ * This class contains the delete tests for the MariaDBSimpleDMLQueryBuilder class
+ *
+ * @covers Lunr\Gravity\Database\MariaDB\MariaDBSimpleDMLQueryBuilder
+ */
+class MariaDBSimpleDMLQueryBuilderDeleteTest extends MariaDBSimpleDMLQueryBuilderTest
+{
+
+    /**
+     * Test delete with returning statement.
+     *
+     * @param string $value    Returning value
+     * @param string $expected Expected built query part
+     *
+     * @dataProvider expectedReturningProvider
+     * @covers       Lunr\Gravity\Database\MariaDB\MariaDBSimpleDMLQueryBuilder::returning
+     */
+    public function testDeleteWithReturning($value, $expected)
+    {
+        $property = $this->reflection->getProperty('returning');
+        $property->setAccessible(TRUE);
+
+        $property = $this->reflection->getProperty('returning');
+        $property->setAccessible(TRUE);
+
+        $this->builder->returning($value);
+
+        $this->assertEquals($expected, $property->getValue($this->builder));
+    }
+
+    /**
+     * Unit Test Data Provider for delete returning statements
+     *
+     * @return array $expectedReturn
+     */
+    public function expectedReturningProvider()
+    {
+        $expectedreturn   = [];
+        $expectedreturn[] = ['*',                 'RETURNING *'];
+        $expectedreturn[] = ['id, name',          'RETURNING id, name'];
+        $expectedreturn[] = ['foo_id as id',      'RETURNING foo_id as id'];
+        $expectedreturn[] = ['bar_id as id, foo', 'RETURNING bar_id as id, foo'];
+
+        return $expectedreturn;
+    }
+
+}
diff --git a/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderTest.php b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..1388117d02fba1c56824c446ce3081b87e1def02
--- /dev/null
+++ b/src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderTest.php
@@ -0,0 +1,93 @@
+<?php
+
+/**
+ * This file contains the MariaDBSimpleDMLQueryBuilderTest class.
+ *
+ * PHP Version 5.4
+ *
+ * @package    Lunr\Gravity\Database\MariaDB
+ * @author     Mathijs Visser <m.visser@m2mobi.com>
+ * @copyright  2013-2018, M2Mobi BV, Amsterdam, The Netherlands
+ * @license    http://lunr.nl/LICENSE MIT License
+ */
+
+namespace Lunr\Gravity\Database\MariaDB\Tests;
+
+use Lunr\Gravity\Database\MySQL\MySQLQueryEscaper;
+use Lunr\Gravity\Database\MariaDB\MariaDBSimpleDMLQueryBuilder;
+use PHPUnit\Framework\TestCase;
+use ReflectionClass;
+
+/**
+ * This class contains common setup routines, providers
+ * and shared attributes for testing the MariaDBSimpleDMLQueryBuilder class.
+ *
+ * @covers Lunr\Gravity\Database\MariaDB\MMariaDBSimpleDMLQueryBuilder
+ */
+abstract class MariaDBSimpleDMLQueryBuilderTest extends TestCase
+{
+
+    /**
+     * Mock instance of the MySQLConnection class
+     * @var MySQLConnection
+     */
+    protected $db;
+
+    /**
+     * MySQL query escaper instance
+     * @var MySQLQueryEscaper
+     */
+    protected $escaper;
+
+    /**
+     * Instance of the simple  query builder
+     * @var MariaDBSimpleDMLQueryBuilder
+     */
+    protected $builder;
+
+    /**
+     * Mock instance of the MariaDBMLQueryBuilder class.
+     * @var MariaDBDMLQueryBuilder
+     */
+    protected $builder_reflection;
+
+    /**
+     * Reflection of the MariaDBSimpleQueryBuilder
+     * @var ReflectionClass
+     */
+    protected $reflection;
+
+    /**
+     * Testcase Constructor.
+     */
+    public function setUp()
+    {
+        $this->db = $this->getMockBuilder('Lunr\Gravity\Database\MySQL\MySQLConnection')
+                         ->disableOriginalConstructor()
+                         ->getMock();
+
+        $this->escaper = new MySQLQueryEscaper($this->db);
+
+        $this->builder_reflection = $this->getMockBuilder('Lunr\Gravity\Database\MariaDB\MariaDBDMLQueryBuilder')
+                                         ->disableOriginalConstructor()
+                                         ->getMock();
+
+        $this->builder    = new MariaDBSimpleDMLQueryBuilder($this->escaper, $this->builder_reflection);
+        $this->reflection = new ReflectionClass($this->builder);
+    }
+
+    /**
+     * Testcase Destructor.
+     */
+    public function tearDown()
+    {
+        unset($this->db);
+        unset($this->escaper);
+        unset($this->builder);
+        unset($this->builder_reflection);
+        unset($this->reflection);
+    }
+
+}
+
+?>
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index ac3d27cd08527ae6fd1eeb7fe5fd6fde179db683..3fd5502a069da31d870d36012cc6a9f0944afb6f 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -157,6 +157,9 @@
             <file>../src/Lunr/Gravity/Database/MySQL/Tests/MySQLConnectionEscapeTest.php</file>
             <file>../src/Lunr/Gravity/Database/MySQL/Tests/MySQLConnectionTransactionTest.php</file>
             <file>../src/Lunr/Gravity/Database/MySQL/Tests/MySQLConnectionMasterSlaveTest.php</file>
+            <file>../src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBDMLQueryBuilderDeleteTest.php</file>
+            <file>../src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderBaseTest.php</file>
+            <file>../src/Lunr/Gravity/Database/MariaDB/Tests/MariaDBSimpleDMLQueryBuilderDeleteTest.php</file>
             <file>../src/Lunr/Gravity/Database/SQLite3/Tests/LunrSQLite3Test.php</file>
             <file>../src/Lunr/Gravity/Database/SQLite3/Tests/SQLite3ConnectionBaseTest.php</file>
             <file>../src/Lunr/Gravity/Database/SQLite3/Tests/SQLite3ConnectionSetTest.php</file>
