1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-31 17:51:43 +02:00

Compare commits

...

6 Commits
v3.2.3 ... v3.2

Author SHA1 Message Date
David Grudl
d571460a6f Released version 3.2.4 2020-03-26 04:05:01 +01:00
David Grudl
dc3e1cda19 SqliteResult: workaround for PHP bug 79414 2020-03-26 04:02:26 +01:00
David Grudl
21039ff379 Result: does not drop the value if detection fails 2020-03-26 04:00:52 +01:00
David Grudl
22b15d9859 travis: fixed databases 2020-03-26 04:00:52 +01:00
Chrudos Vorlicek
6aa8a431c2 Result::normalize() Fix select float in format of e-notation (#317) v3.2 (#320) 2018-10-25 22:33:22 +02:00
David Grudl
69ea60cc16 travis: added PHP 7.3 2018-10-17 17:47:42 +02:00
5 changed files with 23 additions and 4 deletions

View File

@@ -6,6 +6,11 @@ php:
- 7.0
- 7.1
- 7.2
- 7.3
services:
- mysql
- postgresql
before_install:
# turn off XDebug
@@ -63,3 +68,5 @@ cache:
notifications:
email: false
dist: trusty

View File

@@ -445,11 +445,12 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
$columns = [];
static $types = [SQLITE3_INTEGER => 'int', SQLITE3_FLOAT => 'float', SQLITE3_TEXT => 'text', SQLITE3_BLOB => 'blob', SQLITE3_NULL => 'null'];
for ($i = 0; $i < $count; $i++) {
$type = $this->resultSet->columnType($i); // buggy in PHP 7.4.4 & 7.3.16, bug 79414
$columns[] = [
'name' => $this->resultSet->columnName($i),
'table' => null,
'fullname' => $this->resultSet->columnName($i),
'nativetype' => $types[$this->resultSet->columnType($i)],
'nativetype' => $type ? $types[$type] : null,
];
}
return $columns;

View File

@@ -498,8 +498,11 @@ class Result implements IDataSource
} elseif ($type === Type::FLOAT) {
$value = ltrim((string) $value, '0');
$p = strpos($value, '.');
if ($p !== false) {
$e = strpos($value, 'e');
if ($p !== false && $e === false) {
$value = rtrim(rtrim($value, '0'), '.');
} elseif ($p !== false && $e !== false) {
$value = rtrim($value, '.');
}
if ($value === '' || $value[0] === '.') {
$value = '0' . $value;
@@ -526,6 +529,9 @@ class Result implements IDataSource
} elseif ($type === Type::BINARY) {
$row[$key] = $this->getResultDriver()->unescapeBinary($value);
} else {
$row[$key] = $value;
}
}
}

View File

@@ -21,8 +21,8 @@ class dibi
/** version */
const
VERSION = '3.2.3',
REVISION = 'released on 2018-09-17';
VERSION = '3.2.4',
REVISION = 'released on 2020-03-26';
/** sorting order */
const

View File

@@ -99,6 +99,11 @@ test(function () {
Assert::same(['col' => 1.0], $result->test(['col' => 1]));
Assert::same(['col' => 1.0], $result->test(['col' => 1.0]));
Assert::same(['col' => '1.1e+10'], $result->test(['col' => '1.1e+10']));
Assert::same(['col' => '1.1e-10'], $result->test(['col' => '1.1e-10']));
Assert::same(['col' => '1.1e+10'], $result->test(['col' => '001.1e+10']));
Assert::notSame(['col' => '1.1e+1'], $result->test(['col' => '1.1e+10']));
setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu');
Assert::same(['col' => 0.0], $result->test(['col' => '']));
Assert::same(['col' => 0.0], $result->test(['col' => '0']));