#1 Re: mORMot 1 » Oracle - Ora-345 TFDParam - Firedac » 2024-02-02 15:49:54

Hi AB,

thanks for your reply. I tried also the SynDBOracle (better performance...), but in this case i must use only the TSQLRawBlob, retruieving the data, with a normal REST call cause a large number of exceptions and don't work. If i use the TSQLRawBlob, no problem, the two rest calls (one for the record and one for the blob) are perfect.

I think that the problem could be the data into the JSON uploaded. Is a data logger and there are many couples, with a great amount of decimal, date, time, and byte data.

To make a test, i uploaded some data with the TSQLRawBlob, then changed the field DATA to RawUTF8 and tried to retrieve the record with the rest call, it works becouse the field DATA contains Byte64 encoded data.

It's strange, becouse in the others DB it work perfect, only on the latest Oracle (with APEX).

For now i must use the two calls and the TSQLRawBlob.. i must change some client, but it's ok.

Thanks.

#2 mORMot 1 » Oracle - Ora-345 TFDParam - Firedac » 2024-02-02 10:40:56

dottor_jeckill
Replies: 2

Hi to all, i'm using the Mormot version 1.18 to access to a Oracle DB (latest version), in my definition of TSQLRecord have a long text field (is a JSON data of 5/6 thousand of bytes), this was converted in NCLOB field on the Oracle DB.

This is the definition of the TSQLRecord :

        TASTelemetry = class(TSQLRecord)
        private
                fWORKORDER: RawUTF8;
                fGIORNO: integer;
                fCREATO_IL: TDateTime;
                fANNO: integer;
                fCENTRO_DI_LAVORO: Int64;
                fMESE: integer;
                fDATA: RawUTF8;
                fCUSTOM_KEY2: RawUTF8;
                fCUSTOM_KEY3: RawUTF8;
                fCUSTOM_KEY1: RawUTF8;
                fCUSTOM_KEY4: RawUTF8;
                fCUSTOM_KEY5: RawUTF8;
        public
        published
                property ID_CENTRO_DI_LAVORO: Int64 read fCENTRO_DI_LAVORO write fCENTRO_DI_LAVORO;
                property WORKORDER: RawUTF8 index 30 read fWORKORDER write fWORKORDER;
                property CUSTOM_KEY1: RawUTF8 index 30 read fCUSTOM_KEY1 write fCUSTOM_KEY1;
                property CUSTOM_KEY2: RawUTF8 index 30 read fCUSTOM_KEY2 write fCUSTOM_KEY2;
                property CUSTOM_KEY3: RawUTF8 index 30 read fCUSTOM_KEY3 write fCUSTOM_KEY3;
                property CUSTOM_KEY4: RawUTF8 index 30 read fCUSTOM_KEY4 write fCUSTOM_KEY4;
                property CUSTOM_KEY5: RawUTF8 index 30 read fCUSTOM_KEY5 write fCUSTOM_KEY5;
                property ANNO: integer read fANNO write fANNO;
                property MESE: integer read fMESE write fMESE;
                property GIORNO: integer read fGIORNO write fGIORNO;
                property CREATO_IL: TDateTime read fCREATO_IL write fCREATO_IL;
                property DATA: RawUTF8 index 10000 read fDATA write fDATA;
        end;

when i write the data on the DB, with the TSQLRestClient.Add method, if the DATA field is less than 2000 bytes, it works fine, if it have more (like 5000 bytes) i have an error :
'[FireDAC][Phys][Ora]-345. Data too large for variable [:MA]. Max len = [2000], actual len = [5335] Hint: set the TFDParam.Size to a greater value'

I found the solution to convert the RawUTF8 into TSQLRawBlob field... but is very strange, the same structure works fine on MySQL Server, on SQL Server, always with Firedac, but not in Oracle.

Someone know how to increase the TFDParam.Size in the ORM?

Thanks in advance.

Cristiano.

#3 mORMot 1 » TSynSQLTableDataSet and TDateTime bug? » 2017-12-30 07:04:36

dottor_jeckill
Replies: 0

Hello,

i have a TSQLRecord derived class with a TDateTime field, like this:

Type 
  TTest = class(TSQLRecord)
     private
         fTestName : string;
         fTestDate : TDateTime;

     published
         property TestName : string read fTestName write fTestName;
         property TestDate  : TDateTime read fTestDate write fTestDate;
end;

and i need to trasform it in a DataSet for a report. But before i want to see it in a Grid.

If i convert this table on a TSynSQLTableDataSet, using the MormotVCL function JSONToDataSet, or using the creators of the class, i have an error on showing values on the grid becouse che TDateTime field (TestDate) have a bad format (it contains a 0.45556 number for example..).

If i convert this table in a TClientDataSet, with the MormotMidasVCL function JSONToClientDataSet i have no problem and the grid is perfect.

Someon know why this happens? Is a bug?

Thanks.

#4 Re: mORMot 1 » Complex JSON object creation » 2017-12-24 07:17:59

I solved... I read again the documentation and solved... Great library and documentation.

The solution is the _safe keywork.

so :

procedure TSapConnection.EstraiStruttura(var Oggetto: Variant; Nome: String; Valore: Variant);
var
        Temp: Variant;
        Tabella: String;
begin
        Temp := _Obj([]);

        if Pos('.', Nome) > 0 then
        begin
                // creiamo un oggetto atto a contenerlo...
                Tabella := Copy(Nome, 1, Pos('.', Nome) - 1);

                if Oggetto.Exists(Tabella) then
                begin
                        EstraiStruttura(Temp, Copy(Nome, Pos('.', Nome) + 1, Length(Nome)), Valore);
                        // TDocVariantData(Oggetto).Value[Tabella].Add(Temp);
                        _safe(_safe(Oggetto).Value[Tabella]).AddFrom(Temp); // Here the correction!
                end
                else
                begin
                        EstraiStruttura(Temp, Copy(Nome, Pos('.', Nome) + 1, Length(Nome)), Valore);
                        Oggetto.Add(Tabella, Temp);
                end;

        end
        else
                // altrimenti restituiamo quello che abbiamo...
                Oggetto.Add(Nome, Valore);

end;

Thanks AB for this wonderful framework.

Merry Christmas.

#5 mORMot 1 » Complex JSON object creation » 2017-12-23 08:31:26

dottor_jeckill
Replies: 1

Hi to all,
i'm new of this framework, i come from SuperObject and XSuperObject libraries to create my JSON structures.

I have a original TStringList that i want to convert to JSON, using the '.' to start a new sublevel, for example :

if i have :

  FIRST=10
  TEST.NAME=ccc
  TEST.AGE=40
  TEST.COUNTRY.NAME=TE

i want to obtain :

  {'FIRST':'10', 'TEST':{'NAME':'ccc', 'AGE':'10', 'COUNTRY':{'NAME':'TE'}}

In the past used the SuperOject to obtain this, without any problem. Now i wanto to use the MORMOT to have this.

I write this procedure :

procedure TSapConnection.EstraiStruttura(var Oggetto: Variant; Nome: String; Valore: Variant);
var
        Temp: Variant;
        Tabella: String;
begin
        Temp := _Obj([]);

        if Pos('.', Nome) > 0 then
        begin
                
                Tabella := Copy(Nome, 1, Pos('.', Nome) - 1);

                if Oggetto.Exists(Tabella) then
                begin
                        EstraiStruttura(Temp, Copy(Nome, Pos('.', Nome) + 1, Length(Nome)), Valore);
                        TDocVariantData(Oggetto).Value[Tabella].Add(Temp); //// <<<-- 
                end
                else
                begin
                        EstraiStruttura(Temp, Copy(Nome, Pos('.', Nome) + 1, Length(Nome)), Valore);
                        Oggetto.Add(Tabella, Temp);
                end;

        end
        else
                
                Oggetto.Add(Nome, Valore);

end;

This produce a json like this :
  {'FIRST':'10', 'TEST':{'AGE':'10', 'COUNTRY':{'NAME':'TE'}}

and not
  {'FIRST':'10', 'TEST':{'NAME':'ccc', 'AGE':'10', 'COUNTRY':{'NAME':'TE'}}

I think that the problem is on the line with "<<<-- ", i want to add to a "TEST" object another key and value, using the Temp (i.e. a JSON) Variable.

Is it possible? How, if i have an object, can i add a couple value (or values..)?

I tried the

Oggetto._(Tabella).Add(Temp);

But doesn't work.. Can anyone help me?

Thanks.

Board footer

Powered by FluxBB