#1 Re: mORMot 1 » File not found:'Contnrs.dcu' while trying to run through iOS simulator » 2014-12-04 09:44:20

@AB: Yes, I understood and fixed in the Client side and Model class. But how can I use only SynCrossPlatform* units in the mORMot Server side program?

It says Error on these lines when trying to compile mORmot Server. If I try to remove any of the Uses classes in the code below, then the error increases.

FYI, I am using MSSQL as a backend database.

Uses
SynLog,  mORMot,  mORMotSQLite3,  SynSQLite3Static,  mORMotDB,  mORMotHttpServer,  SynDB,  SynDBODBC,  mORMotWrappers,  SynOleDB,  SynCrossPlatformREST,  RESTModel;

VirtualTableExternalRegister(aModel, TWareHouses, aProps); // my aModel class uses only SynCrossPlatform* units
 try
  aRestServer := TSQLRestServerDB.Create(aModel,':memory:',false); 

  aRestServer.AcquireExecutionMode[execORMGet] := amBackgroundORMSharedThread;
  aRestServer.AcquireExecutionMode[execORMWrite] := amBackgroundORMSharedThread; 
  aRestServer.CreateMissingTables;
  AddToServerWrapperMethod(aRestServer, ['..\..\..\CrossPlatform\templates','..\..\..\..\CrossPlatform\templates']);
 
   aHttpServer := TSQLHttpServer.Create(SERVER_PORT,[aRestServer],'+',useHttpApiRegisteringURI);

    try
     aHttpServer.AccessControlAllowOrigin := '*';

     writeln('Background server is running.'#10);
     write('Press [Enter] to close the server.');
     readln;
    finally
      aHttpServer.Free;
    end;
  finally
   aRestServer.Free;
  end;

I know that I am not using appropriate methods or classes in this mORMot server side, but I don't know what are they?

Kindly help me to fix this. Any available example for the Server side program for iOS/mobile applications?

Thanks in advance.

#2 Re: mORMot 1 » File not found:'Contnrs.dcu' while trying to run through iOS simulator » 2014-12-03 11:48:11

I have updated the fix now. But again, it's shows an Error: [DCC Fatal Error] SynCommons.pas(675): F1026 File not found: 'Contnrs.dcu'

Still, it hasn't solved. Any other suggestions please.

Btw, Thanks AB and Wim314 .

#3 Re: mORMot 1 » File not found:'Contnrs.dcu' while trying to run through iOS simulator » 2014-12-02 09:06:21

Thanks, but another Error popped up: File not found: 'Windows.dcu'

This error is shown under 'SynCrossPlatformSpecific' class.

Now I have removed mORMotHttpClient and using only SynCrossPlatformREST.

Any suggestions?

#4 Re: mORMot 1 » File not found:'Contnrs.dcu' while trying to run through iOS simulator » 2014-12-01 14:18:06

Hi AB!

I have already used these 2 units under my Uses section: SynCrossPlatformREST, SynCrossPlatformSpecific

FYI: These are my units in the Uses section of Client side other than standard Firemonkey units:

SynCommons,
mORMot,
SynCrossPlatformREST, SynCrossPlatformSpecific,
mORMotHttpClient, // HTTP client to a mORMot RESTful server
RESTModel; // data model unit, shared between server and client

#5 mORMot 1 » File not found:'Contnrs.dcu' while trying to run through iOS simulator » 2014-12-01 12:54:37

aruncs08
Replies: 11

Hi,

I am working with the iOS application. I am using latest mORMotNightlyBuild version.

On the client side when I am trying to compile through an activated iOS Simulator, I got an error- File not found:'Contnrs.dcu'.

And also, do we have any example for iOS application using mORMot client and server?

Could anyone help me regarding this issue?

Thanks in advance.

#7 Re: mORMot 1 » Accessing multiple tables in the Client Server Application! » 2014-11-10 11:15:09

I mean, at the runtime if I need to fetch data from a different table for different purpose.

I didn't mean JOIN, anyhow I need to use JOIN function for later purposes. Thanks for your references, I will also look into those links.

Example Server side source code:

 aModel := fetchModel; // TSQL Record Class for fetching data from 'Row1' table.
 VirtualTableExternalRegister(aModel, TRow, aProps, 'Row1');
    aModel.Props[TRow].ExternalDB.MapField('ID','IDNo');
    try
      aRestServer := TSQLRestServerDB.Create(aModel,':memory:',false); 

In the above code, I am using a 'fetchModel' TSQLRecord Class for fetching data from a 'Row1' table. If I need to use another TSQLRecord Class like 'createModel' from a 'Package1' table for different purpose, what I need to do?

Kindly let me know, if I am not clear with my question.

Thanks in advance.

#8 mORMot 1 » Accessing multiple tables in the Client Server Application! » 2014-11-10 09:57:28

aruncs08
Replies: 4

Hi,

I am working on a client server application. I have a REST Model which has more than one TSQL Record class for accessing many tables. For now, I can share one data model between client and server.

Problem:
Now I need to access more than one table between client and server at the same time. I don't know how to access many shared data models at a time.

Question:
How do I access multiple tables in the Client Server Application? Any examples available?

Thanks in advance.

#9 Re: mORMot 1 » 'TSQLRecord.CreateAndFillPrepare' returns null values while retrieving » 2014-11-07 15:47:48

@Admin: Thanks for your quick reply. It works like a charm now. And your new HTML documentation is much comfortable than the PDF, well done work smile

#10 Re: mORMot 1 » 'TSQLRecord.CreateAndFillPrepare' returns null values while retrieving » 2014-11-07 15:08:33

Thank you very much for your reply Admin.

So, whichever table I am using should contain the primary key INTEGER ID column?

#11 Re: mORMot 1 » 'TSQLRecord.CreateAndFillPrepare' returns null values while retrieving » 2014-11-07 13:43:50

@Admin: Now I have found the exact problem of not fetching from the existing table.

Problem:
In my existing table I don't have the Column name 'ID', which the REST server is expecting. While debugging in the Server side, I got to know this problem.

Question:
Can't we have a table without an 'ID' column (which is automatically created by TSQLRecord in a REST Model)?  If so, how could I do it?

Thanks in advance.

#12 Re: mORMot 1 » 'TSQLRecord.CreateAndFillPrepare' returns null values while retrieving » 2014-11-05 21:04:40

Yes, I call CreateMissingTables method in my Server side. Actually, I retained most of the source code from the sample 28 Rest Server.

Question:
How/Where can I cross check whether the application reads my table records from the DB?

#13 Re: mORMot 1 » 'TSQLRecord.CreateAndFillPrepare' returns null values while retrieving » 2014-11-05 19:01:21

Thanks for your reply. I am using the latest 1.18 nightly build version of the source code.

In the IDE debugger, it says JSON Format is False and I couldn't see computed SQL and JSON.

Problem:
For your information, the Table which I am accessing is not created through mORMot (REST Model). It means I am trying to access the existing Table (which I have created manually) from my DB.

Working Scenario:
If I am retrieving a Table record which is created through mORMot (REST Model), then I can retrieve those table records.

Kindly let me know if I am confusing or you couldn't understand. Thanks in advance.

#14 mORMot 1 » 'TSQLRecord.CreateAndFillPrepare' returns null values while retrieving » 2014-11-05 13:51:46

aruncs08
Replies: 9

Hi!

I am working with a small application in which I have to retrieve my existing Table records from Server to Client using mORMot. I have followed Sample 28, which is a bit similar to my application.

Problem:
Now I have a problem while retrieving my table records. I am using 'TSQLRecord. CreateAndFillPrepare' pattern, but it returns a NULL value in all the fields of my table records.

Below I have shared my Client and REST Model source code in which I think I have some issues. The Server Source Code is working fine.

Client Source Code:

var
  aList: TObjectList<TRows>;
begin
  aModel := fetchModel;
  try
    aClient := TSQLHttpClientWinHTTP.Create('localhost', SERVER_PORT, aModel);
    aRow := TRows.CreateAndFillPrepare(aClient, 'Side LIKE ?', ['A']);                            // while Debugging, all the fields in aRow contains null value in this line.
    try
      while aRow.FillOne do
        ShowMessage('Row ID: ' + IntToString(aRow.RowsID));
    finally
      aRow.Free;
    end;
  finally
    aClient.Free;
  end;

REST Model Source Code:

TRows = class(TSQLRecord)
function fetchModel: TSQLModel;
begin
  Result:= TSQLModel.Create([TRows],SERVER_ROOT);
  TRows.AddFilterOrValidate('RowsID', TSynValidateText.Create);
  TRows.AddFilterOrValidate('PositionX', TSynValidateText.Create);
  TRows.AddFilterOrValidate('PositionY', TSynValidateText.Create);
  TRows.AddFilterOrValidate('Side', TSynValidateText.Create);
end;

Kindly waiting for some solutions to this issue. Please have patience with me!

Thanks in advance.

#16 mORMot 1 » mORMot with Postgre 'Connection Error' in Sample 28 program (!Newbie!) » 2014-11-03 13:09:32

aruncs08
Replies: 3

Hi!

I am just trying to run the mORMot Sample 28. I have installed Postgre 9.3 and created DataSourceName for PostgreSQL Unicode(x64) driver in ODBC Data Source Administrator.

My Postgre Data source name is 'PostgreSQL35W' and I don't know where to mention this Data source name in this below sample code?

My Source Code:

aProps := TODBCConnectionProperties.Create('','Driver=PostgreSQL Unicode'+
      {$ifdef CPU64}'(x64)'+{$endif}';Database=postgres;'+
      'Server=localhost;Port=5433;UID=postgres;Pwd=password','','');

Error:
First chance exception at $763DC42D. Exception class EODBCException with message
'TODBCLib error: [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0)
'.
Process RESTserver.exe (2300)

My Question:
In the above Source Code, I gave all my Postgre credentials as it is. But where do I give Data source name which I have created in ODBC Data Source Administrator?
And my doubt was, without mentioning this DSN name how could the program knows which driver or database does we have?

Thanks in advance.

#17 Re: mORMot 1 » What could be the Server_Root and Server_Port for MSSQL in RESTModel? » 2014-10-23 16:40:59

Sorry, I was confused between the REST Server and MSSQL Server in that part.

Actually, now I am following the Sample 28. But I got an error 'A connection with the server could not be established'.

Code where the program breaks:

While debugging, the program breaks in the mORMot unit which follows

function TSQLRestClientURI.EngineAdd(TableModelIndex: integer;
  const SentData: RawUTF8): integer;
var P: PUTF8Char;
    url, Head: RawUTF8;
begin
  result := 0;
  url := Model.URI[Model.Tables[TableModelIndex]];
  if URI(url,'POST',nil,@Head,@SentData).Lo<>HTML_CREATED then
    exit; // response must be '201 Created'

In the above code 'url' value is 'root/TRecord' and '@SentData' value is '{'JSON values of my TRecord'}'

And to be more detailed about this error code is followed,

function TSQLRestClientURI.ServerTimeStampSynchronize: boolean;
var status: integer;
    aResp: RawUTF8;
begin
  fServerTimeStampOffset := 0.0001; // avoid endless recursive call
  status := CallBackGet('TimeStamp',[],aResp);      // exactly on this line the error throws

I could only find where was the error, but don't know exactly what the error was?

Let me know if you couldn't understand anywhere in this question.

Thanks in advance.

#18 Re: mORMot 1 » What could be the Server_Root and Server_Port for MSSQL in RESTModel? » 2014-10-23 09:51:38

Thanks for your suggestion, with administration rights our application runs. But again, there is a problem with the URL.

Error: Class EWinHTTP with message 'winhttp.dll error 12005 (The URL is invalid)'

My Code, related to this error:

aClient := TSQLHttpClientWinHTTP.Create('.\SQLEXPRESS',SERVER_PORT,aModel); //Server is '.\SQLEXPRESS', Server_Port is 888 and aModel is a DataModel function from RESTModel.

aClient.Add(aObject,true); //aObject is the RESTModel object.

In the above code if I change the server to 'localhost' instead of '.\SQLEXPRESS', then I got an error 'A connection with the server could not be established'.

Any solutions for this issue?

Thanks in advance.

#19 Re: mORMot 1 » What could be the Server_Root and Server_Port for MSSQL in RESTModel? » 2014-10-22 14:17:35

Thanks for your reply. I have changed as you said, but now the problem with HttpSetServiceConfiguration.

Error: project raised exception class EHttpApiServer with message 'HttpSetServiceConfiguration failed: The parameter is incorrect (87)'.

The coding part is:
 
  aHttpServer: TSQLHttpServer;
  aHttpServer := TSQLHttpServer.Create(SERVER_PORT,[aRestServer],'+',useHttpApiRegisteringURI);

Here SERVER_PORT:= 888 and aRestServer:= TSQLRestServerDB.Create(aModel,':memory:',false);

Thanks in advance.

#20 Re: mORMot 1 » What could be the Server_Root and Server_Port for MSSQL in RESTModel? » 2014-10-22 12:23:22

TSQLRestServer code:

  aModel := DataModel; //Here DataModel is my RESTModel function

  aRestServer: TSQLRestServerDB;
  aRestServer:= TSQLRestServerDB.Create(aModel,':memory:',false);

Above I have followed just like the sample 28.

TOleDBConnectionProperties code:
 
  aProps: TSQLDBConnectionProperties;
  aProps := TOleDBMSSQLConnectionProperties.Create('ComputerUserName\SQLEXPRESS','Test','username','password');

As I said earlier, I don't how to access localhost connection for MSSQL database, so I have used my local database ServerName: 'ComputerUserName\SQLEXPRESS' and my Database name: 'Test'.

#21 Re: mORMot 1 » What could be the Server_Root and Server_Port for MSSQL in RESTModel? » 2014-10-22 11:36:29

@ChinaPeng: Thanks for your reply. I have another question, but I don't know whether it's a stupid question.

Question: How could I access the MSSQL local database in localhost or 127.0.0.1?

I have enabled tcp protocol(port: 1433) in mssql server configurations and mssql server is running perfectly. But I don't know how to access it in a localhost or 127.0.0.1.

@Admin: Thanks and I am using TOleDBConnectionProperties as defined in SynOleDB.pas in my application. Can you also answer my above mentioned question if possible.

Thanks in advance.

#22 mORMot 1 » What could be the Server_Root and Server_Port for MSSQL in RESTModel? » 2014-10-22 08:52:00

aruncs08
Replies: 11

Hi!

I am working with a basic application which is similar to the '28 - Simple RESTful ORM Server'. But instead of PostGRE, I am using MSSQL database.

My Question: In that sample under RESTModel unit, they have a constant value as SERVER_ROOT = 'root';  SERVER_PORT = '888'; in my case for MSSQL, what could be the values of these constants?

Thanks in advance.

#23 mORMot 1 » Retrieving Data into Objects » 2014-10-16 11:57:02

aruncs08
Replies: 1

Hi,

We are still learning about mORMot framework and we have lots of questions coming up because it is very different what we are used to working with RAD Development.

One of the questions we have right now is: How do we actually retrieving Database Data (Records) into the Object Layer? Do you have any good sample that you can point us to?

Please have patience with us!

Thanks in advance.

#24 Re: mORMot 1 » mORMot framework(a newbie) with MS SQL connection in Delphi XE7! » 2014-10-16 11:32:56

Hi Again!

In that sample "28 - Simple RESTful ORM Server", they have PostgreSQL connection by default and that doesn't work for me.

Can you tell me, what I need to change in that sample 28 for MS SQL database instead of PostgreSQL? So that I can try to understand, if it works.

Thanks in advance.

#26 Re: mORMot 1 » mORMot framework(a newbie) with MS SQL connection in Delphi XE7! » 2014-10-16 08:33:21

Thanks for your reply.

Actually, I want to get practice with mORMot framework. I don't know how to define the database (in my case MS SQL) using ORM, any idea to start from scratch?

I will also look at the samples which you have mentioned.

#27 mORMot 1 » mORMot framework(a newbie) with MS SQL connection in Delphi XE7! » 2014-10-15 07:59:13

aruncs08
Replies: 5

Hi,

I am new to this Framework in Delphi XE7. Can anyone help me with the startup?

Question: How to populate some data in a grid from MS SQL database using mORMot framework?

It will be good if any, simple examples available.

Thanks in advance.

Board footer

Powered by FluxBB