1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-04 13:17:58 +02:00

Column: types adjustment

This commit is contained in:
David Grudl
2018-04-17 14:32:02 +02:00
parent 47179d5632
commit 30dec49a9d
2 changed files with 8 additions and 8 deletions

View File

@@ -21,8 +21,8 @@ use Dibi;
* @property-read string $type * @property-read string $type
* @property-read mixed $nativeType * @property-read mixed $nativeType
* @property-read int|null $size * @property-read int|null $size
* @property-read bool|null $nullable * @property-read bool $nullable
* @property-read bool|null $autoIncrement * @property-read bool $autoIncrement
* @property-read mixed $default * @property-read mixed $default
*/ */
class Column class Column
@@ -94,15 +94,15 @@ class Column
} }
public function isNullable(): ?bool public function isNullable(): bool
{ {
return isset($this->info['nullable']) ? (bool) $this->info['nullable'] : null; return !empty($this->info['nullable']);
} }
public function isAutoIncrement(): ?bool public function isAutoIncrement(): bool
{ {
return isset($this->info['autoincrement']) ? (bool) $this->info['autoincrement'] : null; return !empty($this->info['autoincrement']);
} }

View File

@@ -45,14 +45,14 @@ Assert::null($columns[0]->getVendorInfo('xxx'));
if (!in_array($config['system'], ['sqlite', 'sqlsrv'], true)) { if (!in_array($config['system'], ['sqlite', 'sqlsrv'], true)) {
Assert::same('i', $columns[0]->getType()); Assert::same('i', $columns[0]->getType());
} }
Assert::null($columns[0]->isNullable()); Assert::false($columns[0]->isNullable());
Assert::same('xXx', $columns[3]->getName()); Assert::same('xXx', $columns[3]->getName());
Assert::null($columns[3]->getTableName()); Assert::null($columns[3]->getTableName());
if (!in_array($config['system'], ['sqlite', 'sqlsrv'], true)) { if (!in_array($config['system'], ['sqlite', 'sqlsrv'], true)) {
Assert::same('i', $columns[0]->getType()); Assert::same('i', $columns[0]->getType());
} }
Assert::null($columns[3]->isNullable()); Assert::false($columns[3]->isNullable());
Assert::same('xXx', $info->getColumn('xxx')->getName()); Assert::same('xXx', $info->getColumn('xxx')->getName());
Assert::same('xXx', $info->getColumn('xXx')->getName()); Assert::same('xXx', $info->getColumn('xXx')->getName());