Skip to content

Commit 273ca1f

Browse files
committed
More test support for sqlite
1 parent 3e68bc6 commit 273ca1f

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

src/Tqdev/PhpCrudApi/Database/ConditionsBuilder.php

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,28 @@ private function getColumnConditionSql(ColumnCondition $condition, array &$argum
146146
private function getSpatialFunctionName(string $operator): string
147147
{
148148
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';
160171
}
161172
}
162173

@@ -176,6 +187,9 @@ private function getSpatialFunctionCall(string $functionName, string $column, bo
176187
$functionName = str_replace('ST_', 'ST', $functionName);
177188
$argument = $hasArgument ? 'geometry::STGeomFromText(?,0)' : '';
178189
return "$column.$functionName($argument)=1";
190+
case 'sqlite':
191+
$argument = $hasArgument ? '?' : '0';
192+
return "$functionName($column, $argument)=1";
179193
}
180194
}
181195

src/Tqdev/PhpCrudApi/Database/GenericReflection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function getTableColumns(string $tableName, string $type): array
202202
if (isset($matches[1])) {
203203
$result['DATA_TYPE'] = $matches[1];
204204
} else {
205-
$result['DATA_TYPE'] = 'text';
205+
$result['DATA_TYPE'] = 'integer';
206206
}
207207
if (isset($matches[5])) {
208208
$result['NUMERIC_PRECISION'] = $matches[3];

test.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ function runDir(Config $config, string $dir, array $matches, string $category):
2727
if (substr($entry, -4) != '.log') {
2828
continue;
2929
}
30+
if ($config->getDriver() == 'sqlite' && strpos($entry, '_geo')) {
31+
continue;
32+
}
3033
$success += runTest($config, $file, $category);
3134
$total += 1;
3235
} elseif (is_dir($file)) {

0 commit comments

Comments
 (0)