summaryrefslogtreecommitdiffstats
path: root/effa54cf9433bc4aff5d77b453e4351215aeec14.patch
blob: 2bdab62920c0be940b403d253978b3b3b5b8ea6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
From effa54cf9433bc4aff5d77b453e4351215aeec14 Mon Sep 17 00:00:00 2001
From: Laurent Laville <laurent.laville@gmail.com>
Date: Mon, 3 Jun 2019 23:21:49 +0200
Subject: [PATCH] fix issue GH-30

---
 data/references/Sqlite3.iniEntries.json | 11 ++++++++++-
 src/ExtensionFactory.php                |  9 +++++++++
 src/ReferenceCollection.php             | 11 ++++++++---
 src/SqliteStorage.php                   |  2 +-
 4 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/data/references/Sqlite3.iniEntries.json b/data/references/Sqlite3.iniEntries.json
index 25bd246..6963f0e 100644
--- a/data/references/Sqlite3.iniEntries.json
+++ b/data/references/Sqlite3.iniEntries.json
@@ -6,5 +6,14 @@
         "ext_max": "",
         "php_min": "5.3.0",
         "php_max": ""
+    },
+    {
+        "ext_name_fk": 75,
+        "name": "sqlite3.defensive",
+        "ext_min": "5.6.40",
+        "ext_max": "",
+        "php_min": "5.6.40",
+        "php_max": "",
+        "lib_sqlite": ">=3.26"
     }
-]
\ No newline at end of file
+]
diff --git a/src/ExtensionFactory.php b/src/ExtensionFactory.php
index 179f058..65df0fb 100644
--- a/src/ExtensionFactory.php
+++ b/src/ExtensionFactory.php
@@ -105,6 +105,15 @@ public function getMetaVersion(?string $key = null, ?string $extname = null) : a
                     );
                 }
             }
+
+        } elseif (in_array('sqlite3', array($this->name, $extname))) {
+            if (method_exists('sqlite3', 'version')) {
+                $v = \SQLite3::version();
+                $meta = array(
+                    'version_number' => $v['versionNumber'],
+                    'version_text'   => $v['versionString'],
+                );
+            }
         }
 
         if (isset($key) && array_key_exists($key, $meta)) {
diff --git a/src/ReferenceCollection.php b/src/ReferenceCollection.php
index 1fa63ae..3e34790 100644
--- a/src/ReferenceCollection.php
+++ b/src/ReferenceCollection.php
@@ -98,6 +98,10 @@ public function addIniEntry($rec)
             $rec['deprecated'] = '';
         }
 
+        if (!isset($rec['lib_sqlite'])) {
+            $rec['lib_sqlite'] = '';
+        }
+
         if (is_array($row)) {
             if ($row == $rec) {
                 // nothing to do
@@ -326,6 +330,7 @@ protected function doInitialize()
             ' ext_min VARCHAR(16), ext_max VARCHAR(16),' .
             ' php_min VARCHAR(16), php_max VARCHAR(16),' .
             ' deprecated VARCHAR(16),' .
+            ' lib_sqlite VARCHAR(16), ' .
             ' PRIMARY KEY (ext_name_fk, name))'
         );
         $this->dbal->exec(
@@ -398,8 +403,8 @@ protected function doInitialize()
         );
         $this->stmtIniEntries = $this->dbal->prepare(
             'REPLACE INTO ' . $tblIniEntries .
-            ' (ext_name_fk, name, ext_min, ext_max, php_min, php_max, deprecated)' .
-            ' VALUES (:ext_name_fk, :name, :ext_min, :ext_max, :php_min, :php_max, :deprecated)'
+            ' (ext_name_fk, name, ext_min, ext_max, php_min, php_max, deprecated, lib_sqlite)' .
+            ' VALUES (:ext_name_fk, :name, :ext_min, :ext_max, :php_min, :php_max, :deprecated, :lib_sqlite)'
         );
         $this->stmtClasses = $this->dbal->prepare(
             'REPLACE INTO ' . $tblClasses .
@@ -440,7 +445,7 @@ protected function doInitialize()
         );
         $this->stmtIniEntry = $this->dbal->prepare(
             'SELECT' .
-            ' ext_name_fk, name, ext_min, ext_max, php_min, php_max, deprecated' .
+            ' ext_name_fk, name, ext_min, ext_max, php_min, php_max, deprecated, lib_sqlite' .
             ' FROM ' . $tblIniEntries .
             ' WHERE ext_name_fk = :ext_name_fk AND name = :name COLLATE NOCASE'
         );
diff --git a/src/SqliteStorage.php b/src/SqliteStorage.php
index 14681ac..77ad0bc 100644
--- a/src/SqliteStorage.php
+++ b/src/SqliteStorage.php
@@ -155,7 +155,7 @@ protected function doInitialize() : void
             'SELECT i.name,' .
             ' ext_min as "ext.min", ext_max as "ext.max",' .
             ' php_min as "php.min", php_max as "php.max",' .
-            ' deprecated' .
+            ' deprecated, lib_sqlite' .
             ' FROM bartlett_compatinfo_inientries i,  bartlett_compatinfo_extensions e' .
             ' WHERE i.ext_name_fk = e.id AND e.name = :name COLLATE NOCASE'
         );