mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-08-11 15:46:02 +02:00
* better field size detection, add support for smallint field
This commit is contained in:
parent
de8d28c369
commit
b60221b7b6
@ -346,6 +346,9 @@ begin
|
|||||||
case LowerCase(s) of
|
case LowerCase(s) of
|
||||||
'widestring' : result:=ftString;
|
'widestring' : result:=ftString;
|
||||||
'currency' : result:=ftFloat;
|
'currency' : result:=ftFloat;
|
||||||
|
'smallint' : result:=ftInteger;
|
||||||
|
else
|
||||||
|
writeln('Unknown field type:',S)
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -401,7 +404,15 @@ begin
|
|||||||
fn:=F.Name;
|
fn:=F.Name;
|
||||||
// The JSON streamer does not create all properties :(
|
// The JSON streamer does not create all properties :(
|
||||||
if FO.hasOwnProperty('size') then
|
if FO.hasOwnProperty('size') then
|
||||||
fs:=F.Size
|
begin
|
||||||
|
|
||||||
|
if isString(FO['size']) then
|
||||||
|
fs:=StrToInt(String(FO['size']))
|
||||||
|
else if isNumber(FO['size']) then
|
||||||
|
fs:=F.Size
|
||||||
|
else
|
||||||
|
fs:=0;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
fs:=0;
|
fs:=0;
|
||||||
if FO.hasOwnProperty('type') then
|
if FO.hasOwnProperty('type') then
|
||||||
@ -415,6 +426,7 @@ begin
|
|||||||
Ft:=DataTypeToFieldType(dT);
|
Ft:=DataTypeToFieldType(dT);
|
||||||
if (ft=ftBlob) and (fs=0) then
|
if (ft=ftBlob) and (fs=0) then
|
||||||
fs:=1;
|
fs:=1;
|
||||||
|
// Writeln('FieldDef : ',fn,', ',ft,', ',fs);
|
||||||
FieldDefs.Add(fn,ft,fs,Req);
|
FieldDefs.Add(fn,ft,fs,Req);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user