#1 mORMot 1 » TDynArray.SaveToJSON Access Violation on D2007 » 2015-11-13 19:15:03

vsj
Replies: 1

Hi! Does D2007 is still supported?

This simple test on TDynArray works on XE7 but not on D2007.
When I remove the record property Valor, it works.
It looks like a bug with Integers (and Booleans).

  TRec = packed record
    Nome: string;
    Valor: Integer;
  end;
  TRecs = array of TRec;

procedure Test;
var
  t: TRecs;
  d: TDynArray;
  i: Integer;
begin
  SetLength(t, 5);
  d.Init(TypeInfo(TRecs), t);

  for i := 0 to Length(t) - 1 do
  begin
    t[i].Nome := 'Nome' + IntToStr(i);
    t[i].Valor := 1;
  end;

  ShowMessage(d.SaveToJSON);
end;

Here is the Access Violation message.

---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EAccessViolation with message 'Access violation at address 0047114F in module 'Project1.exe'. Read of address 00000001'.
---------------------------
Break   Continue   Help   
---------------------------

#2 Re: mORMot 1 » Existing project : can the server see external modifications » 2014-09-12 18:43:44

vsj

Thank you AB and Daniel for your answers.
Ours editable views use triggers for (insert/update/delete) and every primary key is an integer. Every on the pattern V_CUSTOMER_ED.ID_CUSTOMER.

I'll do some tests soon. Then, when have something to report, I will add here.

Thanks!

#3 Re: mORMot 1 » Existing project : can the server see external modifications » 2014-09-12 12:16:41

vsj

Hello AB,

How hard would be to create a view/table -> classes mapping tool for using mORMot as a REST API on our existing database?

Our main project works with a Firebird database modelled in the following way:

Almost everything is modelled to the third normal form and we use a lot of specializations. For a very simple example, an object that would represent a customer. In our database the data is splitted between at least two tables. PERSON and CUSTOMER.
To make our database application friendly, we create editable views to abstract from the application our database complexity. So, for our Delphi application there is only a V_CUSTOMER_ED which take care of saving and reading the data on the correct tables.
This allowed us to simplify our framework and CRUD operations. And we also have a lot of business rules on the database (99% I would say).

So, now I'm looking for a way to create a REST API for our database. What I think would be very easy because our views are just like objects.
I've tried a little with the TMS Aurelius trial, because they have a feature to create TMS Aurelius classes on Delphi but they only work with real tables, no views.

To be honest, we are even considering about abandoning the Pascal world and go for ServiceStacks, or some solution based on EntityFramework or even some PHP based solution. But personally I liked a lot your examples of simple server without the need of IIS/Apache etc.

I still didn't took the time to look for Embarcadero's REST solutions. And as far as I could read on mORMot documentation (I did this at least one year ago), you don't have such tool as table/view generating classes, only the other way (which I know it is obvius from an ORM point of view).

Any insights about the first question are very welcome.

#4 mORMot 1 » backbone.js » 2012-06-26 22:35:51

vsj
Replies: 11

A very nice, lightweight, framework we are looking is backbone.js (http://backbonejs.org/).

As soon as I get time for it. I will try to connect backbone.js models with a mORMot RESTful server. It looks like a perfect combination.

Here is a nice basic backbone.js tutorial which uses a RESTful server.
http://www.adobe.com/devnet/html5/artic … r-pt1.html

I would like to know if there is any efforts on this path.

Board footer

Powered by FluxBB