#1 Re: mORMot 1 » RTTI and TSQLRowBlob Type, trouble setting value » 2017-07-28 08:38:05

GLM

Argh ....

Well, I'm agree with you.
I'm trying to be DDD.
That's why I have an Agregat with my Domain, anda DataTransfertObject.

And I need to translate one to the other

#2 mORMot 1 » RTTI and TSQLRowBlob Type, trouble setting value » 2017-07-28 07:35:53

GLM
Replies: 3

Hello,

I've trouble with the TSQLRawBlob type.
When I try to Transfert Data from a generic object to my agregat, using RTTI function to make it work in all case, it didn't succed with property of this type whereas it's ok when the same proprerty is RawUTF8.

Here is the part of code where I lose my value.

function TCommonDataTransfertObject.SetBasicProperty(aProp: TRttiProperty;
  aValue: Variant; aSourceAsPointer: Pointer;
  aPropertyType: System.TTypeKind): Boolean;
begin
  Result := False;
  try
    case aPropertyType of

      // ...

      System.tkUString, System.tkString, System.tkWChar, System.tkWString,
      System.tkChar, System.tkLString:
        begin
          if not VarIsNull(aValue) then
            aProp.SetValue(aSourceAsPointer, VarToStr(aValue))
          else aProp.SetValue(aSourceAsPointer, '');
        end;
      end;
     
    Result := True;
  except
    Result := False;
  end;

end;

Any idea ?

Regards

#3 Re: mORMot 1 » How to specify a CallBack in a Array of parameters » 2016-08-25 08:34:37

GLM

Hi,

Too bad ...
It doesn't matter, we'll do it in an other way.

Thanks

#4 mORMot 1 » How to specify a CallBack in a Array of parameters » 2016-08-24 12:36:16

GLM
Replies: 2

Hello,

As it is show in samples, with mORMot we can specify callback with a service (Chat sample).
This is make using a simple parameter of a function.

Is it possible to pass this information within a generic array of parameters, a collection of variant like this :

TCommonGenericProperty = class(TCollectionItem)
  private
    FName : ShortString;
    FPropertyType : TTypeKind;
    FValue : Variant;
  published
    property Name : ShortString read FName write FName;
    property PropertyType : TTypeKind read FPropertyType write FPropertyType;
    property Value : Variant read FValue write FValue;
  end;

Will it be well serialize ?
How to get it on the server side ?

regards.

#6 Re: mORMot 1 » External Oracle DB. Pb with CreateMissingTables » 2016-03-01 07:36:01

GLM

The 2 databases are the same (come from an client's export).

Perhaps it is something like the rigths between the 2 computers.
I'm stil invastigating this problem and working on other fonctions of your framework.
So I'll be back to you as I've some news.

#7 Re: mORMot 1 » External Oracle DB. Pb with CreateMissingTables » 2016-02-26 11:16:01

GLM

Hello AB,

I work a bit on my trouble, and it seems that I've identified somethings :

- my trouble is function of the structure of the external table I try to lock.

If I use a typical table, with an standard ID Field, and another such as VAL1, it work fine (retrieve records and update them)

In fact most of our tables don't have such ID field's name, but often NOID or NO_PLAN.
And the lock I have depends if I try to map a field or not.

Can this help you ?

#8 Re: mORMot 1 » External Oracle DB. Pb with CreateMissingTables » 2016-02-24 16:40:06

GLM

Well,

I'have tried on an other computer (no firewall) and it's the same result...

Something strange :

  FOracleProps := TSQLDBOracleConnectionProperties.Create('//Delldev5:1526/Urios', '', 'URIOS_INF', 'VALIDU');
  lSQLDBConnection := FOracleProps.NewConnection;
  lSQLDBConnection.Connect
  if not lSQLDBConnection.Connected then
    raise Exception.Create('Message d''erreur');

-> the connection is Ok

#9 Re: mORMot 1 » External Oracle DB. Pb with CreateMissingTables » 2016-02-24 16:21:11

GLM

And something like Firewall ?

But why did I succed with SynDbExplorer ?

I'm going to try on an other computer.

#10 Re: mORMot 1 » External Oracle DB. Pb with CreateMissingTables » 2016-02-24 15:22:01

GLM

Yes, I used to.

I'have tried :
  FMainDataModel := TSQLModel.Create([TSQLPlan]);

and
  FMainDataModel := TSQLModel.Create([]); 
  FMainDataModel.AddTable(TSQLPlan);

#11 Re: mORMot 1 » External Oracle DB. Pb with CreateMissingTables » 2016-02-24 15:02:55

GLM

I'have tried with the file deleted.
It's the same : I saw the file being generated (Main.db3 and Main.db3-journal), but noting after.

#12 Re: mORMot 1 » External Oracle DB. Pb with CreateMissingTables » 2016-02-24 14:39:19

GLM

Here are some informations I can give you:

The last point before I lose the application running:

procedure TSQLDataBase.GetFieldNames(var Names: TRawUTF8DynArray; const TableName: RawUTF8);
var R: TSQLRequest;
    n: integer;
begin
  if (self=nil) or (fDB=0) then
    exit; // avoid GPF in case of call from a static-only server
  Lock;
  try
    try
*********************************************************************
      R.Prepare(fDB,'PRAGMA table_info('+TableName+');'); // ESQLite3Exception
*********************************************************************
      n := 0;
      repeat
        if R.Step<>SQLITE_ROW then break;
        if n=length(Names) then
          SetLength(Names,n+MAX_SQLFIELDS);
        Names[n] := sqlite3.column_text(R.Request,1); // cid,name,type,notnull,dflt_value,pk
        inc(n);
      until false;
      SetLength(Names,n);
    finally
      R.Close;
    end;
  finally
    UnLock;
  end;
end;


And the stack :

SynSQLite3.TSQLDatabase.GetFieldNames((),'Plan')
mORMotSQLite3.TSQLRestServerDB.CreateMissingTables(0,[])
srvMainDm_.TsrvMainDm.ConnectMainDB
SrvMainFrm_.TForm3.Button5Click($2D830A0)


Hope this can help you

#13 Re: mORMot 1 » External Oracle DB. Pb with CreateMissingTables » 2016-02-24 13:22:10

GLM

Well with the SynDBExplorer, the connection string works fine !

#14 mORMot 1 » External Oracle DB. Pb with CreateMissingTables » 2016-02-24 10:43:49

GLM
Replies: 17

Hello,

I'm trying to use mORMot with a Standard Database having an external Table in a Oracle DB, by this way :

procedure TsrvMainDm.ConnectMainDB;
begin
  TSynLog.Enter(Self, 'ConnectMainDB');
  FOracleProps := TSQLDBOracleConnectionProperties.Create('URIOS', '', 'URIOS_INF', 'VALIDU');
  //FOracleProps := TSQLDBOracleConnectionProperties.Create('//DellTHIBAUT:1526/Urios3', '', 'URIOS_INF', 'VALIDU');

  FMainDataModel := TSQLModel.Create([]);

  FMainDataModel.AddTable(TSQLPlan);
  // Redirection d'une table du modele sur la base Oracle
  VirtualTableExternalRegister(FMainDataModel, TSQLPlan, FOracleProps, 'P_PLAN');
  FMainDataModel.Props[TSQLPlan].ExternalDB.MapField('ID', 'NO_PLAN');

  FMainDB := TSQLRestServerDB.Create(FMainDataModel, 'Main.db3', True);
  FMainDB.CreateMissingTables(0);

end;

This work fine when the Oracle database is on my computer ("URIOS" case).
But when it is on a remote one (on the local network) I lose my application during "FMainDB.CreateMissingTables(0);".

Any Idea why ?

Thank you

Board footer

Powered by FluxBB