FIX Postgres booleans should return as int for consistency

This commit is contained in:
Guy Marriott 2019-04-17 15:15:17 +12:00
parent 2c207b636a
commit da1af3d8b0
No known key found for this signature in database
GPG Key ID: A80F9ACCB86D3DA7
2 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,7 @@ class PDOStatementHandle
'float8' => 'float',
'float16' => 'float',
'numeric' => 'float',
'bool' => 'int', // Bools should be ints
// MySQL
'NEWDECIMAL' => 'float',

View File

@ -267,5 +267,9 @@ class DatabaseTest extends SapphireTest
// Dates are returned as strings
$this->assertInternalType('string', $record['Created'], 'DBDatetime fields should be string (non-prepared)');
// Booleans selected directly are ints
$result = DB::query('SELECT TRUE')->first();
$this->assertInternalType('int', reset($result));
}
}