Lazarus

Programming => Databases => Topic started by: Fantablup on July 03, 2021, 07:17:28 pm

Title: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: Fantablup on July 03, 2021, 07:17:28 pm
I had a headache with this.
Some hours doing search on ftbyte in Lazarus for TFieldType.
I ise Zeos an with stByte. And i couldn't update column with TZquery because it did not have ftByte in the parameter TFieldType. And it does not have AsByte in the parameter value.

After some hours i used Value instead of AsByte(not exists) in the parameter value.

Seems to work.
Title: Re: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: AlexTP on July 03, 2021, 08:30:10 pm
You are not correct

https://github.com/graemeg/freepascal/blob/master/packages/fcl-db/src/base/db.pas#L114

line 114, ftByte exists there.
Title: Re: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: Fantablup on July 03, 2021, 08:47:10 pm
I am totally correct.

Not in my Lazarus instalation.
I'm using version 2.0.12.

Absolutely nothing in the DB unit here. It does not exists here.
Strange.
Const
  Fieldtypenames : Array [TFieldType] of String[15] =
    (
      {ftUnknown} 'Unknown',
      {ftString} 'String',
      {ftSmallint} 'Smallint',
      {ftInteger} 'Integer',
      {ftWord} 'Word',
      {ftBoolean} 'Boolean',
      {ftFloat} 'Float',
      {ftCurrency} 'Currency',
      {ftBCD} 'BCD',
      {ftDate} 'Date',
      {ftTime} 'Time',
      {ftDateTime} 'DateTime',
      {ftBytes} 'Bytes',
      {ftVarBytes} 'VarBytes',
      {ftAutoInc} 'AutoInc',
      {ftBlob} 'Blob',
      {ftMemo} 'Memo',
      {ftGraphic} 'Graphic',
      {ftFmtMemo} 'FmtMemo',
      {ftParadoxOle} 'ParadoxOle',
      {ftDBaseOle} 'DBaseOle',
      {ftTypedBinary} 'TypedBinary',
      {ftCursor} 'Cursor',
      {ftFixedChar} 'FixedChar',
      {ftWideString} 'WideString',
      {ftLargeint} 'Largeint',
      {ftADT} 'ADT',
      {ftArray} 'Array',
      {ftReference} 'Reference',
      {ftDataSet} 'DataSet',
      {ftOraBlob} 'OraBlob',
      {ftOraClob} 'OraClob',
      {ftVariant} 'Variant',
      {ftInterface} 'Interface',
      {ftIDispatch} 'IDispatch',
      {ftGuid} 'Guid',
      {ftTimeStamp} 'TimeStamp',
      {ftFMTBcd} 'FMTBcd',
      {ftFixedWideChar} 'FixedWideChar',
      {ftWideMemo} 'WideMemo'
    );   

But it works with setting unknown and value on the parameter value.
Title: Re: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: Fantablup on July 03, 2021, 09:02:19 pm
Ahaaaa..

My Lazarus is using FPC 3.2.0.
Latest is 3.2.2

Maybe a update is smart?

 :)
Title: Re: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: AlexTP on July 03, 2021, 09:08:12 pm
Yes, last FPC added them:

ftOraTimeStamp, ftOraInterval, ftLongWord, ftShortint, ftByte, ftExtended);
Title: Re: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: marsupilami79 on July 11, 2021, 07:32:40 pm
Hello Fantablup,

I had a headache with this.
Some hours doing search on ftbyte in Lazarus for TFieldType.
I ise Zeos an with stByte. And i couldn't update column with TZquery because it did not have ftByte in the parameter TFieldType. And it does not have AsByte in the parameter value.

After some hours i used Value instead of AsByte(not exists) in the parameter value.

Seems to work.

You might want to check if this is supported in Zeos 8.0. We added our own fields there. So we probably support ftByte there too.
Title: Re: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: LacaK on July 12, 2021, 01:49:26 pm
Can I ask if you want use/access:
- database field which is of type "byte"?
- or access parameter in SQL using TParam.AsByte ? (there exists AsByte property in Delphi)
- or access field value TField.AsByte ? (there is no AsByte property in Delphi)

Note: I added TParam.AsByte property for Delphi compatibility (however this will be only part of incomming FPC 3.4 I guess)
Title: Re: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: Fantablup on July 12, 2021, 02:38:17 pm
Ohh..

AsByte is not in Lazarus either.

Yes, as byte.

I will use metadata of the DBCresultset instead for getting the field types.

Thanks for the update.
Title: Re: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: LacaK on July 12, 2021, 02:43:35 pm
AsByte is not in Lazarus either.

Lazarus 2.0.12 is build with FPC 3.2.0
upcomming Lazarus 2.2.0 will be build with FPC 3.2.2

My change is in FPC TRUNK only, so if you use only stable version of Lazarus then you must wait for Lazarus which will be build with FPC 3.4.0
(it can take 1-2 years ... until new major FPC will be released)
Title: Re: ftByte in TFieldType not exist in Lazarus. But exists in Delphi and Zeos
Post by: Fantablup on July 12, 2021, 03:01:09 pm
I saw that.

So i will not use the Lazarus field types. But instead the st**** field types in Zeos. Getting it with the metadata and the columns types there.
TinyPortal © 2005-2018