






















网友“阿英”让分享的。
1、字段类型NUMERIC(18,6)只显示4位小数位,只有连接pgsql才有问题。
将MapOid(NUMERICOID, ftCurrency);改成MapOid(NUMERICOID, ftDouble);
procedure TSqlDBPostgresConnectionProperties.FillOidMapping; begin // see pg_type.h (most used first) MapOid(INT4OID, ftInt64); MapOid(INT8OID, ftInt64); MapOid(TEXTOID, ftUtf8); // other char types will be ftUtf8 as fallback MapOid(FLOAT8OID, ftDouble); MapOid(TIMESTAMPOID, ftDate); MapOid(BYTEAOID, ftBlob); MapOid(NUMERICOID, ftDouble); // our ORM uses NUMERIC(19,4) for currency MapOid(BOOLOID, ftInt64); MapOid(INT2OID, ftInt64); MapOid(CASHOID, ftCurrency); MapOid(TIMESTAMPTZOID, ftDate); MapOid(ABSTIMEOID, ftDate); MapOid(DATEOID, ftDate); MapOid(TIMEOID, ftDate); MapOid(TIMETZOID, ftDate); MapOid(REGPROCOID, ftInt64); MapOid(OIDOID, ftInt64); MapOid(FLOAT4OID, ftDouble); // note: any other unregistered OID will be handled as ftUtf8 to keep the data end;
2、Lazarus4.8+FPC3.2.2偶然缺最后一个汉字
将:
mormot.db.core.ftUtf8: if ColumnDataSize = 0 then dbtype := ftDefaultMemo else // no size dbtype := ftWideString; // means UnicodeString for Delphi 2009+
改为:
mormot.db.core.ftUtf8:
dbtype := ftString;
procedure TBinaryDataSet.InternalInitFieldDefs; var f, custom: PtrInt; dbtype: TFieldType; names: TRawUtf8DynArray; // FieldDefs.Items[].Name sizes: TIntegerDynArray; // FieldDefs.Items[].Size begin if FieldDefs.Count > 0 then begin // custom column sizes SetLength(names, FieldDefs.Count); SetLength(sizes, FieldDefs.Count); for f := 0 to FieldDefs.Count - 1 do with FieldDefs.Items[f] do begin names[f] := StringToUtf8(Name); sizes[f] := Size; end; end; FieldDefs.Clear; if fDataAccess = nil then exit; for f := 0 to fDataAccess.ColumnCount - 1 do with fDataAccess.Columns[f] do begin if names <> nil then begin custom := FindRawUtf8(names, ColumnName); if custom >= 0 then // retrieve custom max column length from FieldDefs ColumnDataSize := sizes[custom]; end; case ColumnType of mormot.db.core.ftInt64: dbtype := ftLargeint; mormot.db.core.ftDate: dbtype := ftDateTime; mormot.db.core.ftUtf8: dbtype := ftString; { if ColumnDataSize = 0 then dbtype := ftDefaultMemo else // no size dbtype := ftWideString; // means UnicodeString for Delphi 2009+ } mormot.db.core.ftBlob: dbtype := ftBlob; mormot.db.core.ftDouble, mormot.db.core.ftCurrency: dbtype := ftFloat; else raise EVirtualDataSet.CreateUtf8('%.GetFieldData ColumnType=%', [self, TSqlDBFieldTypeToString(ColumnType)]); end; FieldDefs.Add(Utf8ToString(ColumnName), dbtype, ColumnDataSize); end; end;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。