mirror of
https://github.com/dg/dibi.git
synced 2025-08-31 17:51:43 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d571460a6f | ||
|
dc3e1cda19 | ||
|
21039ff379 | ||
|
22b15d9859 | ||
|
6aa8a431c2 | ||
|
69ea60cc16 |
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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']));
|
||||
|
Reference in New Issue
Block a user