@@ -939,7 +939,7 @@ public function __construct() {
939
939
k1."table" = ? AND
940
940
k2."table" IN ? ' ,
941
941
'reflect_columns ' => 'SELECT
942
- "name", "dflt_value", case when "notnull"==1 then \'NO \' else \'YES \' end as "nullable", "type", 2147483647
942
+ "name", "dflt_value", case when "notnull"==1 then \'no \' else \'yes \' end as "nullable", "type", 2147483647
943
943
FROM
944
944
"sys/columns"
945
945
WHERE
@@ -2262,15 +2262,19 @@ protected function swagger($settings) {
2262
2262
}
2263
2263
$ result = $ this ->db ->query ($ this ->db ->getSql ('reflect_columns ' ),array ($ table_list [0 ],$ database ));
2264
2264
while ($ row = $ this ->db ->fetchRow ($ result )) {
2265
- if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = $ row [1 ];
2266
2265
$ table_fields [$ table ['name ' ]][$ row [0 ]]->required = strtolower ($ row [2 ])=='no ' && $ row [1 ]===null ;
2266
+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->{'x-nullable ' } = strtolower ($ row [2 ])=='yes ' ;
2267
2267
$ table_fields [$ table ['name ' ]][$ row [0 ]]->{'x-dbtype ' } = $ row [3 ];
2268
2268
$ table_fields [$ table ['name ' ]][$ row [0 ]]->maxLength = $ row [4 ];
2269
2269
if ($ this ->db ->isNumericType ($ table_fields [$ table ['name ' ]][$ row [0 ]])) {
2270
- $ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'number ' ;
2271
2270
if (strpos (strtolower ($ table_fields [$ table ['name ' ]][$ row [0 ]]->{'x-dbtype ' }),'int ' )!==false ) {
2272
2271
$ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'integer ' ;
2272
+ if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = (int )$ row [1 ];
2273
+ } else {
2274
+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'number ' ;
2275
+ if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = (float )$ row [1 ];
2273
2276
}
2277
+
2274
2278
} else {
2275
2279
if ($ this ->db ->isBinaryType ($ table_fields [$ table ['name ' ]][$ row [0 ]])) {
2276
2280
$ table_fields [$ table ['name ' ]][$ row [0 ]]->format = 'byte ' ;
@@ -2280,6 +2284,7 @@ protected function swagger($settings) {
2280
2284
$ table_fields [$ table ['name ' ]][$ row [0 ]]->format = 'json ' ;
2281
2285
}
2282
2286
$ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'string ' ;
2287
+ if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = $ row [1 ];
2283
2288
}
2284
2289
}
2285
2290
@@ -2409,10 +2414,10 @@ protected function swagger($settings) {
2409
2414
echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2410
2415
}
2411
2416
echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
2417
+ echo ',"x-nullable": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-nullable ' });
2412
2418
if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
2413
2419
echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
2414
2420
}
2415
- echo ',"required": ' .json_encode ($ action ['fields ' ][$ field ]->required );
2416
2421
if (isset ($ action ['fields ' ][$ field ]->default )) {
2417
2422
echo ',"default": ' .json_encode ($ action ['fields ' ][$ field ]->default );
2418
2423
}
@@ -2450,10 +2455,10 @@ protected function swagger($settings) {
2450
2455
echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2451
2456
}
2452
2457
echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
2458
+ echo ',"x-nullable": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-nullable ' });
2453
2459
if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
2454
2460
echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
2455
2461
}
2456
- echo ',"required": ' .json_encode ($ action ['fields ' ][$ field ]->required );
2457
2462
if (isset ($ action ['fields ' ][$ field ]->default )) {
2458
2463
echo ',"default": ' .json_encode ($ action ['fields ' ][$ field ]->default );
2459
2464
}
@@ -2517,10 +2522,10 @@ protected function swagger($settings) {
2517
2522
echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2518
2523
}
2519
2524
echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
2525
+ echo ',"x-nullable": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-nullable ' });
2520
2526
if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
2521
2527
echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
2522
2528
}
2523
- echo ',"required": ' .json_encode ($ action ['fields ' ][$ field ]->required );
2524
2529
if (isset ($ action ['fields ' ][$ field ]->default )) {
2525
2530
echo ',"default": ' .json_encode ($ action ['fields ' ][$ field ]->default );
2526
2531
}
@@ -2555,10 +2560,10 @@ protected function swagger($settings) {
2555
2560
echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2556
2561
}
2557
2562
echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
2563
+ echo ',"x-nullable": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-nullable ' });
2558
2564
if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
2559
2565
echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
2560
2566
}
2561
- echo ',"required": ' .json_encode ($ action ['fields ' ][$ field ]->required );
2562
2567
if (isset ($ action ['fields ' ][$ field ]->default )) {
2563
2568
echo ',"default": ' .json_encode ($ action ['fields ' ][$ field ]->default );
2564
2569
}
0 commit comments