diff --git a/.gitignore b/.gitignore
index 88e1243..d27e5c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@ composer.lock
.phpunit.result.cache
test.php
test.sqlite
+*.test.sqlite
.DS_Store
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..45e82a5
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,28 @@
+image: php:7.1-alpine
+
+services:
+ - mysql:latest
+
+variables:
+ MYSQL_DATABASE: destructr_test
+ MYSQL_ROOT_PASSWORD: badpassword
+
+before_script:
+ - apk update
+ - apk add git
+ - docker-php-ext-install pdo
+ - curl -sS https://getcomposer.org/installer | php
+ - php composer.phar install
+
+test:local:
+ script:
+ - php composer.phar test-local
+
+test:mysql:
+ script:
+ - docker-php-ext-install pdo_mysql
+ - php composer.phar test-mysql
+
+test:sqlite:
+ script:
+ - php composer.phar test-sqlite
diff --git a/composer.json b/composer.json
index 85858e5..886366b 100644
--- a/composer.json
+++ b/composer.json
@@ -21,11 +21,11 @@
"test-local": [
"phpunit --testsuite Local"
],
- "test-db": [
- "phpunit --testsuite DB"
+ "test-mysql": [
+ "phpunit --testsuite MySQL"
],
- "test-legacydb": [
- "phpunit --testsuite LegacyDB"
+ "test-sqlite": [
+ "phpunit --testsuite SQLite"
]
},
"autoload": {
diff --git a/phpunit.xml b/phpunit.xml
index 65c3167..2264fee 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -5,11 +5,11 @@
tests/Drivers
tests/LegacyDrivers
-
- tests/Drivers
+
+ tests/Drivers/MySQL
-
- tests/LegacyDrivers
+
+ tests/LegacyDrivers/SQLite
diff --git a/src/Drivers/AbstractDriver.php b/src/Drivers/AbstractDriver.php
index 310ac8a..45828a6 100644
--- a/src/Drivers/AbstractDriver.php
+++ b/src/Drivers/AbstractDriver.php
@@ -83,7 +83,7 @@ abstract class AbstractDriver implements DSODriverInterface
if (!$s->execute($params)) {
return [];
}
- return $s->fetchAll(\PDO::FETCH_ASSOC);
+ return @$s->fetchAll(\PDO::FETCH_ASSOC);
}
public function insert(string $table, DSOInterface $dso) : bool
diff --git a/src/LegacyDrivers/MySQL56Driver.php b/src/LegacyDrivers/MySQL56Driver.php
deleted file mode 100644
index 0c2095c..0000000
--- a/src/LegacyDrivers/MySQL56Driver.php
+++ /dev/null
@@ -1,35 +0,0 @@
-createLegacyUDF();
- return parent::createTable($table, $virtualColumns);
- }
-
- public function createLegacyUDF()
- {
- $drop = $this->pdo->exec('DROP FUNCTION IF EXISTS `destructr_json_extract`;');
- $create = $this->pdo->exec(file_get_contents(__DIR__.'/destructr_json_extract.sql'));
- }
-
- protected function expandPath(string $path) : string
- {
- $path = str_replace('.', '|', $path);
- return "destructr_json_extract(`json_data`,'$.{$path}')";
- }
-}
diff --git a/src/LegacyDrivers/README.md b/src/LegacyDrivers/README.md
index c3bf2e9..4a8e361 100644
--- a/src/LegacyDrivers/README.md
+++ b/src/LegacyDrivers/README.md
@@ -41,19 +41,5 @@ using SQLite if you don't have access to a fully supported database version.
### MySQL 5.6
-**\Destructr\LegacyDrivers\MySQL56Driver**
-
-**Overall support level: Decent performance, highly suspect accuracy**
-
-LegacyDrivers\MySQL56Driver provides bare-minimum support for MySQL < 5.7.
-This driver now passes the basic tests and basic integration tests, but hasn't
-been verified in the slightest beyond that.
-
-It flattens unstructured JSON and uses a highly dodgy user-defined function to
-extract values from it. There are absolutely edge cases that will extract the
-wrong data. That said, outside of those edge cases it should actually work
-fairly well. All the sorting and filtering is happening in SQL, and things
-should mostly be fairly predictable.
-
-This driver should be your last resort. I cannot emphasize enough that this
-thing is extremely kludgey and should not be trusted.
+** No longer supported. You should really use SQLite if you don't have access to
+something better. Will most likely never be supported. **
diff --git a/src/LegacyDrivers/destructr_json_extract.sql b/src/LegacyDrivers/destructr_json_extract.sql
deleted file mode 100644
index 9b0597b..0000000
--- a/src/LegacyDrivers/destructr_json_extract.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-CREATE FUNCTION `destructr_json_extract`(
-details TEXT,
-required_field VARCHAR (255)
-) RETURNS TEXT CHARSET utf8
-BEGIN
- DECLARE search_term TEXT;
- SET details = SUBSTRING_INDEX(details, "{", -1);
- SET details = SUBSTRING_INDEX(details, "}", 1);
- SET search_term = CONCAT('"', SUBSTRING_INDEX(required_field,'$.', - 1), '"');
- IF INSTR(details, search_term) > 0 THEN
- RETURN TRIM(
- BOTH '"' FROM SUBSTRING_INDEX(
- SUBSTRING_INDEX(
- SUBSTRING_INDEX(
- details,
- search_term,
- - 1
- ),
- ',"',
- 1
- ),
- ':',
- -1
- )
- );
- ELSE
- RETURN NULL;
- END IF;
-END;
diff --git a/tests/Drivers/IntegrationTests/AbstractDriverIntegrationTest.php b/tests/Drivers/AbstractDriverIntegrationTest.php
similarity index 99%
rename from tests/Drivers/IntegrationTests/AbstractDriverIntegrationTest.php
rename to tests/Drivers/AbstractDriverIntegrationTest.php
index 69df76a..9f546f3 100644
--- a/tests/Drivers/IntegrationTests/AbstractDriverIntegrationTest.php
+++ b/tests/Drivers/AbstractDriverIntegrationTest.php
@@ -1,7 +1,7 @@
createLegacyUDF();
- return $class;
- }
-}
diff --git a/tests/LegacyDrivers/IntegrationTests/SQLiteDriverIntegrationTest.php b/tests/LegacyDrivers/SQLite/SQLiteDriverIntegrationTest.php
similarity index 69%
rename from tests/LegacyDrivers/IntegrationTests/SQLiteDriverIntegrationTest.php
rename to tests/LegacyDrivers/SQLite/SQLiteDriverIntegrationTest.php
index 68dc494..513b62e 100644
--- a/tests/LegacyDrivers/IntegrationTests/SQLiteDriverIntegrationTest.php
+++ b/tests/LegacyDrivers/SQLite/SQLiteDriverIntegrationTest.php
@@ -1,16 +1,16 @@