#1 2015-05-11 20:34:06

Bojop
Member
From: Wolder
Registered: 2011-01-05
Posts: 28

GetJSONValues doesn't work

GetJSONValues gives only tekst values, the number values are converted to Null or nothing at all.
this happens with update c55e03ca6d{1305} at 6-5-2015.
with update/commit {1304} the conversion was still OK.

do I need to add something or is something broken?

Offline

#2 2015-05-11 20:49:21

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

Re: GetJSONValues doesn't work

Have you code to reproduce the issue?

Your description is difficult to follow.

Offline

#3 2015-05-11 21:09:35

Bojop
Member
From: Wolder
Registered: 2011-01-05
Posts: 28

Re: GetJSONValues doesn't work

i use
  u: RawUTF8;
  T: TSQLTableJSON;

T := Server.ExecuteList([TSQLDienst], S2U('SELECT * FROM Dienst'));
u := T.GetJSONValues(False);

Offline

#4 2015-05-12 06:37:58

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

Re: GetJSONValues doesn't work

We do not have issues on our side for such requests.
The regression tests do pass, when we use ExecuteList, on text or other kind of data.

How is TSQLDienst defined?
What is the problem?

Offline

#5 2015-05-12 09:39:07

Bojop
Member
From: Wolder
Registered: 2011-01-05
Posts: 28

Re: GetJSONValues doesn't work

TSQLDienst = class(TSQLRecord)
  private
    fNaam            : RawUTF8;
    fVoorNaam      : RawUTF8;
    fTussenVoegsel: RawUTF8;
    fNummer        : Int32;               // uniek = stored False {to make unique }
    fPloeg            : TPloegSoort;      // (8)
    fFunctie          : TOpFunctie;       // (7)
    fPosten          : TPosten;
    fTime            : TDateTime;        // date + time of record change
  published
    property Naam            : RawUTF8     read fNaam            write fNaam;
    property VoorNaam      : RawUTF8     read fVoorNaam      write fVoorNaam;
    property TussenVoegsel: RawUTF8     read fTussenVoegsel write fTussenVoegsel;
    property Nummer        : Int32          read fNummer         write fNummer stored False; // made unique
    property Ploeg            : TPloegSoort read fPloeg              write fPloeg;
    property Functie         : TOpFunctie   read fFunctie            write fFunctie;
    property Posten          : TPosten       read fPosten            write fPosten;
    property Time            : TDateTime   read fTime              write fTime;
  end;


//values with latest commit (only first 4 rows, rest I deleted)
//value of T
('ID', 'Naam', 'VoorNaam', 'TussenVoegsel', 'Nummer', 'Ploeg', 'Functie', 'Posten', 'Time',
'1', 'N1', 'V1', nil {#0}, '544', '5', '5', '768', '2012-06-15T18:25:31',
'2', 'N2', 'V2', '', '854', '4', '1', '627', '2014-12-13T08:14:49',
'3', 'N3', 'V3', nil {#0}, '338', '5', '3', '1584', '2012-09-26T17:03:40',
'4', 'N4', 'V4', '', '196', '4', '2', '1650', '2013-09-09T14:54:01', ........

//value of u
'{"fieldCount":9,"rowCount":143,"values":
["ID","Naam","VoorNaam","TussenVoegsel","Nummer","Ploeg","Functie","Posten","Time",
,"N1","V1",null,,,,,"2012-06-15T18:25:31",
,"N2","V2","",,,,,"2014-12-13T08:14:49",
,"N3","V3",null,,,,,"2012-09-26T17:03:40",
,"N4","V4","",,,,,"2013-09-09T14:54:01", .........

now al number values even the ID value are not returned, just get nothing


//old
//values with commit {1304} and older (only first 4 rows, rest I deleted)
//value of T
('ID', 'Naam', 'VoorNaam', 'TussenVoegsel', 'Nummer', 'Ploeg', 'Functie',
'Posten', 'Time',
'1', 'N1', 'V1', nil {#0}, '544', '5', '5', '768', '2012-06-15T18:25:31',
'2', 'N2', 'V2', '', '854', '4', '1', '627', '2014-12-13T08:14:49',
'3', 'N3', 'V3', nil {#0}, '338', '5', '3', '1584', '2012-09-26T17:03:40',
'4', 'N4', 'V4', '', '196', '4', '2', '1650', '2013-09-09T14:54:01', ........

//value of u
'{"fieldCount":9,"rowCount":143,"values":
["ID","Naam","VoorNaam","TussenVoegsel","Nummer","Ploeg","Functie","Posten","Time",
1,"N1","V1",null,544,5,5,768,"2012-06-15T18:25:31",
2,"N2","V2","",854,4,1,627,"2014-12-13T08:14:49",
3,"N3","V3",null,338,5,3,1584,"2012-09-26T17:03:40",
4,"N4","V4","",196,4,2,1650,"2013-09-09T14:54:01", .......

here al number values are returned also the ID value, with correct values

So, how do I get the number values back?

Offline

#6 2015-05-12 10:19:33

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

Re: GetJSONValues doesn't work

I've fixed a regression in TSQLTable.GetJSONValues.
See http://synopse.info/fossil/info/e477bcb533

Sorry for the inconvenience.

But IMHO you should try to use TSQLRest.RetrieveListJSON() method directly.
No need to use a temporary TSQLTableJSON storage.

Offline

#7 2015-05-12 13:45:47

Bojop
Member
From: Wolder
Registered: 2011-01-05
Posts: 28

Re: GetJSONValues doesn't work

ab wrote:

I've fixed a regression in TSQLTable.GetJSONValues.
See http://synopse.info/fossil/info/e477bcb533

yes, the result is OK again,  smile
thank you very much

ab wrote:

But IMHO you should try to use TSQLRest.RetrieveListJSON() method directly.
No need to use a temporary TSQLTableJSON storage.

I didn't know this one, it is indeed easier.

Offline

#8 2015-07-05 09:09:25

Bojop
Member
From: Wolder
Registered: 2011-01-05
Posts: 28

Re: GetJSONValues doesn't work

Again i have an issue wit GetJSONValues, I am getting no values.
I get an error on line 21606 from mORMot, "access violation". (i use latest commit 1593)

I changed most of my GetJSONValues calls to RetrieveListJSON, that works verry well.
But RetrieveListJSON can only handle one Table and also the Where part is limited, so is ORDER not allowed.

So i need GetJSONValues when i use more table's

do I need to add something or is something broken?

Offline

#9 2015-07-05 14:27:36

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

Re: GetJSONValues doesn't work

There was a small regression.

Please try http://synopse.info/fossil/info/1029cf9b01

Offline

#10 2015-07-05 18:25:35

Bojop
Member
From: Wolder
Registered: 2011-01-05
Posts: 28

Re: GetJSONValues doesn't work

yes, the result is OK ,  :-)

thank you very much

Offline

Board footer

Powered by FluxBB