mirror of
https://github.com/dg/dibi.git
synced 2025-09-01 10:02:53 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8f0d0fb115 | ||
|
965570c067 | ||
|
4ae4f49c21 | ||
|
5b9ffe14ba | ||
|
2d9358e4f7 | ||
|
e3748420f5 |
@@ -30,11 +30,6 @@ class DibiMySqlReflector extends DibiObject implements IDibiReflector
|
|||||||
*/
|
*/
|
||||||
public function getTables()
|
public function getTables()
|
||||||
{
|
{
|
||||||
/*$this->query("
|
|
||||||
SELECT TABLE_NAME as name, TABLE_TYPE = 'VIEW' as view
|
|
||||||
FROM INFORMATION_SCHEMA.TABLES
|
|
||||||
WHERE TABLE_SCHEMA = DATABASE()
|
|
||||||
");*/
|
|
||||||
$res = $this->driver->query('SHOW FULL TABLES');
|
$res = $this->driver->query('SHOW FULL TABLES');
|
||||||
$tables = array();
|
$tables = array();
|
||||||
while ($row = $res->fetch(FALSE)) {
|
while ($row = $res->fetch(FALSE)) {
|
||||||
@@ -54,12 +49,6 @@ class DibiMySqlReflector extends DibiObject implements IDibiReflector
|
|||||||
*/
|
*/
|
||||||
public function getColumns($table)
|
public function getColumns($table)
|
||||||
{
|
{
|
||||||
/*$table = $this->escape($table, dibi::TEXT);
|
|
||||||
$this->query("
|
|
||||||
SELECT *
|
|
||||||
FROM INFORMATION_SCHEMA.COLUMNS
|
|
||||||
WHERE TABLE_NAME = $table AND TABLE_SCHEMA = DATABASE()
|
|
||||||
");*/
|
|
||||||
$res = $this->driver->query("SHOW FULL COLUMNS FROM {$this->driver->escape($table, dibi::IDENTIFIER)}");
|
$res = $this->driver->query("SHOW FULL COLUMNS FROM {$this->driver->escape($table, dibi::IDENTIFIER)}");
|
||||||
$columns = array();
|
$columns = array();
|
||||||
while ($row = $res->fetch(TRUE)) {
|
while ($row = $res->fetch(TRUE)) {
|
||||||
@@ -87,13 +76,6 @@ class DibiMySqlReflector extends DibiObject implements IDibiReflector
|
|||||||
*/
|
*/
|
||||||
public function getIndexes($table)
|
public function getIndexes($table)
|
||||||
{
|
{
|
||||||
/*$table = $this->escape($table, dibi::TEXT);
|
|
||||||
$this->query("
|
|
||||||
SELECT *
|
|
||||||
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
|
||||||
WHERE TABLE_NAME = $table AND TABLE_SCHEMA = DATABASE()
|
|
||||||
AND REFERENCED_COLUMN_NAME IS NULL
|
|
||||||
");*/
|
|
||||||
$res = $this->driver->query("SHOW INDEX FROM {$this->driver->escape($table, dibi::IDENTIFIER)}");
|
$res = $this->driver->query("SHOW INDEX FROM {$this->driver->escape($table, dibi::IDENTIFIER)}");
|
||||||
$indexes = array();
|
$indexes = array();
|
||||||
while ($row = $res->fetch(TRUE)) {
|
while ($row = $res->fetch(TRUE)) {
|
||||||
|
@@ -51,12 +51,6 @@ class DibiSqliteReflector extends DibiObject implements IDibiReflector
|
|||||||
*/
|
*/
|
||||||
public function getColumns($table)
|
public function getColumns($table)
|
||||||
{
|
{
|
||||||
$meta = $this->driver->query("
|
|
||||||
SELECT sql FROM sqlite_master WHERE type = 'table' AND name = {$this->driver->escape($table, dibi::TEXT)}
|
|
||||||
UNION ALL
|
|
||||||
SELECT sql FROM sqlite_temp_master WHERE type = 'table' AND name = {$this->driver->escape($table, dibi::TEXT)}
|
|
||||||
")->fetch(TRUE);
|
|
||||||
|
|
||||||
$res = $this->driver->query("PRAGMA table_info({$this->driver->escape($table, dibi::IDENTIFIER)})");
|
$res = $this->driver->query("PRAGMA table_info({$this->driver->escape($table, dibi::IDENTIFIER)})");
|
||||||
$columns = array();
|
$columns = array();
|
||||||
while ($row = $res->fetch(TRUE)) {
|
while ($row = $res->fetch(TRUE)) {
|
||||||
|
@@ -38,8 +38,8 @@ class dibi
|
|||||||
FIELD_TIME = self::TIME;
|
FIELD_TIME = self::TIME;
|
||||||
|
|
||||||
/** version */
|
/** version */
|
||||||
const VERSION = '2.3.2',
|
const VERSION = '2.3.3',
|
||||||
REVISION = 'released on 2015-04-18';
|
REVISION = 'released on 2015-10-22';
|
||||||
|
|
||||||
/** sorting order */
|
/** sorting order */
|
||||||
const ASC = 'ASC',
|
const ASC = 'ASC',
|
||||||
@@ -368,18 +368,6 @@ class dibi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replacement for majority of dibi::methods() in future.
|
|
||||||
*/
|
|
||||||
public static function __callStatic($name, $args)
|
|
||||||
{
|
|
||||||
//if ($name = 'select', 'update', ...') {
|
|
||||||
// return self::command()->$name($args);
|
|
||||||
//}
|
|
||||||
return call_user_func_array(array(self::getConnection(), $name), $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/********************* fluent SQL builders ****************d*g**/
|
/********************* fluent SQL builders ****************d*g**/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -315,11 +315,12 @@ class DibiFluent extends DibiObject implements IDataSource
|
|||||||
*/
|
*/
|
||||||
public function fetch()
|
public function fetch()
|
||||||
{
|
{
|
||||||
if ($this->command === 'SELECT') {
|
if ($this->command === 'SELECT' && !$this->clauses['LIMIT']) {
|
||||||
return $this->query($this->_export(NULL, array('%lmt', 1)))->fetch();
|
$result = $this->query($this->limit(1)->_export())->fetch();
|
||||||
} else {
|
$this->removeClause('LIMIT');
|
||||||
return $this->query($this->_export())->fetch();
|
return $result;
|
||||||
}
|
}
|
||||||
|
return $this->query($this->_export())->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -329,11 +330,12 @@ class DibiFluent extends DibiObject implements IDataSource
|
|||||||
*/
|
*/
|
||||||
public function fetchSingle()
|
public function fetchSingle()
|
||||||
{
|
{
|
||||||
if ($this->command === 'SELECT') {
|
if ($this->command === 'SELECT' && !$this->clauses['LIMIT']) {
|
||||||
return $this->query($this->_export(NULL, array('%lmt', 1)))->fetchSingle();
|
$result = $this->query($this->limit(1)->_export())->fetchSingle();
|
||||||
} else {
|
$this->removeClause('LIMIT');
|
||||||
return $this->query($this->_export())->fetchSingle();
|
return $result;
|
||||||
}
|
}
|
||||||
|
return $this->query($this->_export())->fetchSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -401,7 +403,7 @@ class DibiFluent extends DibiObject implements IDataSource
|
|||||||
public function count()
|
public function count()
|
||||||
{
|
{
|
||||||
return (int) $this->query(array(
|
return (int) $this->query(array(
|
||||||
'SELECT COUNT(*) FROM (%ex', $this->_export(), ') AS [data]',
|
'SELECT COUNT(*) FROM (%ex', $this->_export(), ') [data]',
|
||||||
))->fetchSingle();
|
))->fetchSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -488,13 +488,23 @@ class DibiResult extends DibiObject implements IDataSource
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$value = $row[$key];
|
$value = $row[$key];
|
||||||
if ($value === FALSE || $type === dibi::TEXT) {
|
if ($type === dibi::TEXT) {
|
||||||
|
|
||||||
} elseif ($type === dibi::INTEGER) {
|
} elseif ($type === dibi::INTEGER) {
|
||||||
$row[$key] = is_float($tmp = $value * 1) ? $value : $tmp;
|
$row[$key] = is_float($tmp = $value * 1) ? $value : $tmp;
|
||||||
|
|
||||||
} elseif ($type === dibi::FLOAT) {
|
} elseif ($type === dibi::FLOAT) {
|
||||||
$row[$key] = str_replace(',', '.', ltrim((string) ($tmp = (float) $value), '0')) === ltrim(rtrim(rtrim($value, '0'), '.'), '0') ? $tmp : $value;
|
$value = ltrim($value, '0');
|
||||||
|
$p = strpos($value, '.');
|
||||||
|
if ($p !== FALSE) {
|
||||||
|
$value = rtrim(rtrim($value, '0'), '.');
|
||||||
|
}
|
||||||
|
if ($value === '' || $value[0] === '.') {
|
||||||
|
$value = '0' . $value;
|
||||||
|
}
|
||||||
|
$row[$key] = $value === str_replace(',', '.', (string) ($float = (float) $value))
|
||||||
|
? $float
|
||||||
|
: $value;
|
||||||
|
|
||||||
} elseif ($type === dibi::BOOL) {
|
} elseif ($type === dibi::BOOL) {
|
||||||
$row[$key] = ((bool) $value) && $value !== 'f' && $value !== 'F';
|
$row[$key] = ((bool) $value) && $value !== 'f' && $value !== 'F';
|
||||||
|
@@ -215,7 +215,7 @@ final class DibiTranslator extends DibiObject
|
|||||||
$v = $this->formatValue($v, FALSE);
|
$v = $this->formatValue($v, FALSE);
|
||||||
$vx[] = $k . ($v === 'NULL' ? 'IS ' : '= ') . $v;
|
$vx[] = $k . ($v === 'NULL' ? 'IS ' : '= ') . $v;
|
||||||
|
|
||||||
} elseif ($pair[1] === 'ex') { // TODO: this will be removed
|
} elseif ($pair[1] === 'ex') {
|
||||||
$vx[] = $k . $this->formatValue($v, 'ex');
|
$vx[] = $k . $this->formatValue($v, 'ex');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
92
tests/dibi/DibiFluent.fetch.limit.phpt
Normal file
92
tests/dibi/DibiFluent.fetch.limit.phpt
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider ../databases.ini
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Tester\Assert;
|
||||||
|
|
||||||
|
require __DIR__ . '/bootstrap.php';
|
||||||
|
|
||||||
|
$conn = new DibiConnection($config);
|
||||||
|
$conn->loadFile(__DIR__ . "/data/$config[system].sql");
|
||||||
|
|
||||||
|
|
||||||
|
// fetch & limit
|
||||||
|
$fluent = $conn->select('*')
|
||||||
|
->from('customers')
|
||||||
|
->limit(1)
|
||||||
|
->offset(3)
|
||||||
|
->orderBy('customer_id');
|
||||||
|
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1 OFFSET 3'),
|
||||||
|
(string) $fluent
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$fluent->fetch();
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1 OFFSET 3'),
|
||||||
|
dibi::$sql
|
||||||
|
);
|
||||||
|
$fluent->fetchSingle();
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1 OFFSET 3'),
|
||||||
|
dibi::$sql
|
||||||
|
);
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1 OFFSET 3'),
|
||||||
|
(string) $fluent
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$fluent->limit(0);
|
||||||
|
$fluent->fetch();
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 0 OFFSET 3'),
|
||||||
|
dibi::$sql
|
||||||
|
);
|
||||||
|
$fluent->fetchSingle();
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 0 OFFSET 3'),
|
||||||
|
dibi::$sql
|
||||||
|
);
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 0 OFFSET 3'),
|
||||||
|
(string) $fluent
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$fluent->removeClause('limit');
|
||||||
|
$fluent->fetch();
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1 OFFSET 3'),
|
||||||
|
dibi::$sql
|
||||||
|
);
|
||||||
|
$fluent->fetchSingle();
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1 OFFSET 3'),
|
||||||
|
dibi::$sql
|
||||||
|
);
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] OFFSET 3'),
|
||||||
|
(string) $fluent
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$fluent->removeClause('offset');
|
||||||
|
$fluent->fetch();
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1'),
|
||||||
|
dibi::$sql
|
||||||
|
);
|
||||||
|
$fluent->fetchSingle();
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1'),
|
||||||
|
dibi::$sql
|
||||||
|
);
|
||||||
|
Assert::same(
|
||||||
|
reformat('SELECT * FROM [customers] ORDER BY [customer_id]'),
|
||||||
|
(string) $fluent
|
||||||
|
);
|
@@ -81,7 +81,7 @@ try {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
Assert::same(
|
Assert::same(
|
||||||
reformat(' SELECT * FROM [table] LIMIT 1'),
|
reformat('SELECT * FROM [table] LIMIT 1'),
|
||||||
dibi::$sql
|
dibi::$sql
|
||||||
);
|
);
|
||||||
|
|
||||||
|
130
tests/dibi/DibiResult.normalize.phpt
Normal file
130
tests/dibi/DibiResult.normalize.phpt
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Tester\Assert;
|
||||||
|
|
||||||
|
require __DIR__ . '/bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
|
class MockResult extends DibiResult
|
||||||
|
{
|
||||||
|
function __construct()
|
||||||
|
{}
|
||||||
|
|
||||||
|
function test($row)
|
||||||
|
{
|
||||||
|
$normalize = new ReflectionMethod('DibiResult', 'normalize');
|
||||||
|
$normalize->setAccessible(TRUE);
|
||||||
|
$normalize->invokeArgs($this, array(& $row));
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
test(function () {
|
||||||
|
$result = new MockResult;
|
||||||
|
$result->setType('col', dibi::BOOL);
|
||||||
|
|
||||||
|
Assert::same(array('col' => NULL), $result->test(array('col' => NULL)));
|
||||||
|
Assert::same(array('col' => TRUE), $result->test(array('col' => TRUE)));
|
||||||
|
Assert::same(array('col' => FALSE), $result->test(array('col' => FALSE)));
|
||||||
|
|
||||||
|
Assert::same(array('col' => FALSE), $result->test(array('col' => '')));
|
||||||
|
Assert::same(array('col' => FALSE), $result->test(array('col' => '0')));
|
||||||
|
Assert::same(array('col' => TRUE), $result->test(array('col' => '1')));
|
||||||
|
Assert::same(array('col' => TRUE), $result->test(array('col' => 't')));
|
||||||
|
Assert::same(array('col' => FALSE), $result->test(array('col' => 'f')));
|
||||||
|
Assert::same(array('col' => TRUE), $result->test(array('col' => 'T')));
|
||||||
|
Assert::same(array('col' => FALSE), $result->test(array('col' => 'F')));
|
||||||
|
Assert::same(array('col' => FALSE), $result->test(array('col' => 0)));
|
||||||
|
Assert::same(array('col' => FALSE), $result->test(array('col' => 0.0)));
|
||||||
|
Assert::same(array('col' => TRUE), $result->test(array('col' => 1)));
|
||||||
|
Assert::same(array('col' => TRUE), $result->test(array('col' => 1.0)));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test(function () {
|
||||||
|
$result = new MockResult;
|
||||||
|
$result->setType('col', dibi::TEXT); // means TEXT or UNKNOWN
|
||||||
|
|
||||||
|
Assert::same(array('col' => NULL), $result->test(array('col' => NULL)));
|
||||||
|
Assert::same(array('col' => TRUE), $result->test(array('col' => TRUE)));
|
||||||
|
Assert::same(array('col' => FALSE), $result->test(array('col' => FALSE)));
|
||||||
|
|
||||||
|
Assert::same(array('col' => ''), $result->test(array('col' => '')));
|
||||||
|
Assert::same(array('col' => '0'), $result->test(array('col' => '0')));
|
||||||
|
Assert::same(array('col' => '1'), $result->test(array('col' => '1')));
|
||||||
|
Assert::same(array('col' => 0), $result->test(array('col' => 0)));
|
||||||
|
Assert::same(array('col' => 1), $result->test(array('col' => 1)));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test(function () {
|
||||||
|
$result = new MockResult;
|
||||||
|
$result->setType('col', dibi::FLOAT);
|
||||||
|
|
||||||
|
Assert::same(array('col' => NULL), $result->test(array('col' => NULL)));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => TRUE)));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => FALSE)));
|
||||||
|
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '')));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '0')));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => '1')));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '.0')));
|
||||||
|
Assert::same(array('col' => 0.1), $result->test(array('col' => '.1')));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '0.0')));
|
||||||
|
Assert::same(array('col' => 0.1), $result->test(array('col' => '0.1')));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '0.000')));
|
||||||
|
Assert::same(array('col' => 0.1), $result->test(array('col' => '0.100')));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => '1.0')));
|
||||||
|
Assert::same(array('col' => 1.1), $result->test(array('col' => '1.1')));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => '1.000')));
|
||||||
|
Assert::same(array('col' => 1.1), $result->test(array('col' => '1.100')));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => '001.000')));
|
||||||
|
Assert::same(array('col' => 1.1), $result->test(array('col' => '001.100')));
|
||||||
|
Assert::same(array('col' => 10.0), $result->test(array('col' => '10')));
|
||||||
|
Assert::same(array('col' => 11.0), $result->test(array('col' => '11')));
|
||||||
|
Assert::same(array('col' => 10.0), $result->test(array('col' => '0010')));
|
||||||
|
Assert::same(array('col' => 11.0), $result->test(array('col' => '0011')));
|
||||||
|
Assert::same(array('col' => '0.00000000000000000001'), $result->test(array('col' => '0.00000000000000000001')));
|
||||||
|
Assert::same(array('col' => '12345678901234567890'), $result->test(array('col' => '12345678901234567890')));
|
||||||
|
Assert::same(array('col' => '12345678901234567890'), $result->test(array('col' => '012345678901234567890')));
|
||||||
|
Assert::same(array('col' => '12345678901234567890'), $result->test(array('col' => '12345678901234567890.000')));
|
||||||
|
Assert::same(array('col' => '12345678901234567890.1'), $result->test(array('col' => '012345678901234567890.100')));
|
||||||
|
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => 0)));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => 0.0)));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => 1)));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => 1.0)));
|
||||||
|
|
||||||
|
setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu');
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '')));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '0')));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => '1')));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '.0')));
|
||||||
|
Assert::same(array('col' => 0.1), $result->test(array('col' => '.1')));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '0.0')));
|
||||||
|
Assert::same(array('col' => 0.1), $result->test(array('col' => '0.1')));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => '0.000')));
|
||||||
|
Assert::same(array('col' => 0.1), $result->test(array('col' => '0.100')));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => '1.0')));
|
||||||
|
Assert::same(array('col' => 1.1), $result->test(array('col' => '1.1')));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => '1.000')));
|
||||||
|
Assert::same(array('col' => 1.1), $result->test(array('col' => '1.100')));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => '001.000')));
|
||||||
|
Assert::same(array('col' => 1.1), $result->test(array('col' => '001.100')));
|
||||||
|
Assert::same(array('col' => 10.0), $result->test(array('col' => '10')));
|
||||||
|
Assert::same(array('col' => 11.0), $result->test(array('col' => '11')));
|
||||||
|
Assert::same(array('col' => 10.0), $result->test(array('col' => '0010')));
|
||||||
|
Assert::same(array('col' => 11.0), $result->test(array('col' => '0011')));
|
||||||
|
Assert::same(array('col' => '0.00000000000000000001'), $result->test(array('col' => '0.00000000000000000001')));
|
||||||
|
Assert::same(array('col' => '12345678901234567890'), $result->test(array('col' => '12345678901234567890')));
|
||||||
|
Assert::same(array('col' => '12345678901234567890'), $result->test(array('col' => '012345678901234567890')));
|
||||||
|
Assert::same(array('col' => '12345678901234567890'), $result->test(array('col' => '12345678901234567890.000')));
|
||||||
|
Assert::same(array('col' => '12345678901234567890.1'), $result->test(array('col' => '012345678901234567890.100')));
|
||||||
|
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => 0)));
|
||||||
|
Assert::same(array('col' => 0.0), $result->test(array('col' => 0.0)));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => 1)));
|
||||||
|
Assert::same(array('col' => 1.0), $result->test(array('col' => 1.0)));
|
||||||
|
setlocale(LC_NUMERIC, 'C');
|
||||||
|
});
|
Reference in New Issue
Block a user