#1 2013-12-25 20:11:35

nirnir
Member
Registered: 2013-11-11
Posts: 66

TSQLTableJSON set field size

I'm using TSQLTableJSON and convert it to Tclientdataset .
the field size in Tclientdataset is automatically defined by the json column content length ,
The current value length shouldn't be the maxsize of the dataset column.
I'm using SetFieldType to define the column type for the created dataset , how can I control the size also ?

Offline

#2 2013-12-26 01:51:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: TSQLTableJSON set field size

nirnir wrote:

The current value length shouldn't be the maxsize of the dataset column.

Why not?
If you want to store something bigger?

Offline

#3 2013-12-26 06:26:35

nirnir
Member
Registered: 2013-11-11
Posts: 66

Re: TSQLTableJSON set field size

suppose the longest first_name in the json database was 'ab' ,
after I converted it to Tdataset the column size would be 2 and I wouldn't be able to insert value longer than two characters .

Offline

#4 2013-12-28 16:34:55

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: TSQLTableJSON set field size

TSQLTable.SetFieldType() method allows now to specify a column size.
See http://synopse.info/fossil/info/a6f2c6965e

Hope it fits your needs.

Offline

#5 2013-12-29 08:07:50

nirnir
Member
Registered: 2013-11-11
Posts: 66

Re: TSQLTableJSON set field size

Thanks, you are great .

you forgot to change   

ContentSize := -1; 
TO
ContentSize := FieldSize;
inside SetFieldType

Offline

#6 2013-12-29 16:19:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: TSQLTableJSON set field size

Oups...
I did it again!
sad

See http://synopse.info/fossil/info/8be083220d

Offline

Board footer

Powered by FluxBB