Skip to content

Commit 450bf38

Browse files
committed
add normalizeDefault() method for OCI8
1 parent 9e19f79 commit 450bf38

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

system/Database/OCI8/Connection.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,25 @@ protected function _fieldData(string $table): array
349349
$retval[$i]->max_length = $length;
350350

351351
$retval[$i]->nullable = $query[$i]->NULLABLE === 'Y';
352-
$retval[$i]->default = rtrim($query[$i]->DATA_DEFAULT);
352+
$retval[$i]->default = $this->normalizeDefault($query[$i]->DATA_DEFAULT);
353353
}
354354

355355
return $retval;
356356
}
357357

358+
/**
359+
* Removes trailing whitespace from default values
360+
* returned in database column metadata queries.
361+
*/
362+
private function normalizeDefault(?string $default): ?string
363+
{
364+
if ($default === null) {
365+
return $default;
366+
}
367+
368+
return rtrim($default);
369+
}
370+
358371
/**
359372
* Returns an array of objects with index data
360373
*

0 commit comments

Comments
 (0)