Skip to content

Commit

Permalink
Update Connection.php
Browse files Browse the repository at this point in the history
add metadate unsigned, length and decimal_places
  • Loading branch information
rakoitde committed Oct 5, 2022
1 parent b764570 commit 0c6ca53
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion system/Database/MySQLi/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,14 @@ protected function _fieldData(string $table): array
$retVal[$i] = new stdClass();
$retVal[$i]->name = $query[$i]->Field;

sscanf($query[$i]->Type, '%[a-z](%d)', $retVal[$i]->type, $retVal[$i]->max_length);
$unsigned = null;
sscanf($query[$i]->Type, '%[a-z](%[0-9,]) %[a-z]', $retVal[$i]->type, $retVal[$i]->length, $unsigned);

$exp = explode(',', $retVal[$i]->length);
$retVal[$i]->max_length = isset($exp[0]) ? (int) $exp[0] : 0;
$retVal[$i]->decimal_places = isset($exp[1]) ? (int) $exp[1] : 0;

$retVal[$i]->unsigned = $unsigned === 'unsigned';

$retVal[$i]->nullable = $query[$i]->Null === 'YES';
$retVal[$i]->default = $query[$i]->Default;
Expand Down

0 comments on commit 0c6ca53

Please sign in to comment.