Recent

Author Topic: TSQLQuery | DataType | Json | PostgreSQL  (Read 923 times)

cpalx

  • Hero Member
  • *****
  • Posts: 753
TSQLQuery | DataType | Json | PostgreSQL
« on: February 13, 2021, 07:41:30 pm »
Hello

i am using Lazarus 2.0.10 in Linux Ubuntu 20.04.

does some body know how to detect if a field is a json data type?

i use: Query.FieldDefs[ iRow ].DataType

but i can not competere to any of ftSmallint, ftInteger, ....

https://lazarus-ccr.sourceforge.io/docs/fcl/db/tfieldtype.html

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: TSQLQuery | DataType | Json | PostgreSQL
« Reply #1 on: March 02, 2021, 11:50:05 am »
There is no native JSOM TFieldType. Delphi also does not have such field type.
Only way is map to ftBlob, ftMemo fields ... (at TSQLConnection level ... I do not know if it is implemented ATM or not)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TSQLQuery | DataType | Json | PostgreSQL
« Reply #2 on: March 02, 2021, 03:25:18 pm »
i use: Query.FieldDefs[ iRow ].DataType
but i can not competere to any of ftSmallint, ftInteger, ...

Are you sure you have the DB unit in your uses clause and that nothing else is interfering in the definition of TFieldType? Ctrl-clicking in DataType should lead you to where it's taking it from, or you could use a temporary:
Code: [Select]
var something: TFieldType;just to see from where it's taking it.

ETA: Also, seeing your code might lead to better help ...
« Last Edit: March 02, 2021, 03:27:12 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018