Skip to content

Commit 7fb964c

Browse files
committed
Add translation of numeric types in MySQL to actual types.
1 parent 6de69b2 commit 7fb964c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

api.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,15 @@ public function __construct() {
8888
k2."REFERENCED_TABLE_SCHEMA" = ? AND
8989
k1."TABLE_NAME" COLLATE \'utf8_bin\' = k2."TABLE_NAME" COLLATE \'utf8_bin\' AND
9090
k1."REFERENCED_TABLE_NAME" COLLATE \'utf8_bin\' = ? AND
91-
k2."REFERENCED_TABLE_NAME" COLLATE \'utf8_bin\' IN ?'
91+
k2."REFERENCED_TABLE_NAME" COLLATE \'utf8_bin\' IN ?',
92+
'reflect_type'=> 'SELECT
93+
"COLUMN_NAME", "COLUMN_TYPE"
94+
FROM
95+
"INFORMATION_SCHEMA"."COLUMNS"
96+
WHERE
97+
"TABLE_SCHEMA" = ? AND
98+
"TABLE_NAME" = ?
99+
'
92100
);
93101
}
94102

@@ -2217,6 +2225,11 @@ protected function swagger($settings) {
22172225
foreach ($primaryKeys as $primaryKey) {
22182226
$table_fields[$table['name']][$primaryKey]->primaryKey = true;
22192227
}
2228+
$result = $this->db->query($this->db->getSql('reflect_type'),array($database,$table_list[0]));
2229+
while ($row = $this->db->fetchRow($result)) {
2230+
$expl = explode('(',$row[1]);
2231+
$table_fields[$table['name']][$row[0]]->type = $expl[0];
2232+
}
22202233
}
22212234

22222235
foreach (array('root_actions','id_actions') as $path) {

0 commit comments

Comments
 (0)