improve test for #592

This commit is contained in:
Maurits van der Schee 2020-04-20 13:18:00 +02:00
commit 57cd6dee9b
2 changed files with 14 additions and 2 deletions

View file

@ -16,11 +16,17 @@ class DataConverter
private function convertRecordValue($conversion, $value)
{
switch ($conversion) {
$args = explode('|', $conversion);
$type = array_shift($args);
switch ($type) {
case 'boolean':
return $value ? true : false;
case 'integer':
return (int) $value;
case 'float':
return (float) $value;
case 'decimal':
return sprintf('%.' . $args[0] . 'f', $value);
}
return $value;
}
@ -33,6 +39,12 @@ class DataConverter
if (in_array($this->driver, ['sqlsrv', 'sqlite']) && in_array($column->getType(), ['integer', 'bigint'])) {
return 'integer';
}
if (in_array($this->driver, ['sqlite']) && in_array($column->getType(), ['float', 'double'])) {
return 'float';
}
if (in_array($this->driver, ['sqlite']) && in_array($column->getType(), ['decimal'])) {
return 'decimal|' . $column->getScale();
}
return 'none';
}

View file

@ -1,5 +1,5 @@
skip-for-pgsql: varbinary is not properly supported yet
skip-for-sqlite: float is returned as string, decimal does not respect scale
#skip-for-sqlite: float is returned as string, decimal does not respect scale
skip-for-sqlsrv: float has high precision and time and datetime have microseconds
===
POST /columns