Browse Source

More test support for sqlite

Maurits van der Schee 5 years ago
parent
commit
273ca1ff17

+ 25
- 11
src/Tqdev/PhpCrudApi/Database/ConditionsBuilder.php View File

146
     private function getSpatialFunctionName(string $operator): string
146
     private function getSpatialFunctionName(string $operator): string
147
     {
147
     {
148
         switch ($operator) {
148
         switch ($operator) {
149
-            case 'co':return 'ST_Contains';
150
-            case 'cr':return 'ST_Crosses';
151
-            case 'di':return 'ST_Disjoint';
152
-            case 'eq':return 'ST_Equals';
153
-            case 'in':return 'ST_Intersects';
154
-            case 'ov':return 'ST_Overlaps';
155
-            case 'to':return 'ST_Touches';
156
-            case 'wi':return 'ST_Within';
157
-            case 'ic':return 'ST_IsClosed';
158
-            case 'is':return 'ST_IsSimple';
159
-            case 'iv':return 'ST_IsValid';
149
+            case 'co':
150
+                return 'ST_Contains';
151
+            case 'cr':
152
+                return 'ST_Crosses';
153
+            case 'di':
154
+                return 'ST_Disjoint';
155
+            case 'eq':
156
+                return 'ST_Equals';
157
+            case 'in':
158
+                return 'ST_Intersects';
159
+            case 'ov':
160
+                return 'ST_Overlaps';
161
+            case 'to':
162
+                return 'ST_Touches';
163
+            case 'wi':
164
+                return 'ST_Within';
165
+            case 'ic':
166
+                return 'ST_IsClosed';
167
+            case 'is':
168
+                return 'ST_IsSimple';
169
+            case 'iv':
170
+                return 'ST_IsValid';
160
         }
171
         }
161
     }
172
     }
162
 
173
 
176
                 $functionName = str_replace('ST_', 'ST', $functionName);
187
                 $functionName = str_replace('ST_', 'ST', $functionName);
177
                 $argument = $hasArgument ? 'geometry::STGeomFromText(?,0)' : '';
188
                 $argument = $hasArgument ? 'geometry::STGeomFromText(?,0)' : '';
178
                 return "$column.$functionName($argument)=1";
189
                 return "$column.$functionName($argument)=1";
190
+            case 'sqlite':
191
+                $argument = $hasArgument ? '?' : '0';
192
+                return "$functionName($column, $argument)=1";
179
         }
193
         }
180
     }
194
     }
181
 
195
 

+ 1
- 1
src/Tqdev/PhpCrudApi/Database/GenericReflection.php View File

202
                 if (isset($matches[1])) {
202
                 if (isset($matches[1])) {
203
                     $result['DATA_TYPE'] = $matches[1];
203
                     $result['DATA_TYPE'] = $matches[1];
204
                 } else {
204
                 } else {
205
-                    $result['DATA_TYPE'] = 'text';
205
+                    $result['DATA_TYPE'] = 'integer';
206
                 }
206
                 }
207
                 if (isset($matches[5])) {
207
                 if (isset($matches[5])) {
208
                     $result['NUMERIC_PRECISION'] = $matches[3];
208
                     $result['NUMERIC_PRECISION'] = $matches[3];

+ 3
- 0
test.php View File

27
             if (substr($entry, -4) != '.log') {
27
             if (substr($entry, -4) != '.log') {
28
                 continue;
28
                 continue;
29
             }
29
             }
30
+            if ($config->getDriver() == 'sqlite' && strpos($entry, '_geo')) {
31
+                continue;
32
+            }
30
             $success += runTest($config, $file, $category);
33
             $success += runTest($config, $file, $category);
31
             $total += 1;
34
             $total += 1;
32
         } elseif (is_dir($file)) {
35
         } elseif (is_dir($file)) {

tests/functional/001_records/076_list_user_locations_within_area.log → tests/functional/001_records/076_list_user_locations_within_geometry.log View File


Loading…
Cancel
Save