#1 Re: mORMot 1 » ODBC Error » 2018-02-08 18:17:41

Thanks Egonhugeist
I set TZReadOnlyQuery to unidirectional mode. The fault still occurs. the function fetches only 1 record at a time as the 'partno' is unique.
The function is used in a loop returning max 20 'partno' for each session. The fault occurs after about 10 sessions. As a new programmer i am trying
to understand the text 'memory allocation error'. I am going to learn how to use fastmm to see if there is a memory leak. I am also weary
because in my short programming career i have learnt that it is possible for a error message to lead you down a wrong direction. Many
thanks for your help. If I shut the server down and start again it works again for approx another ten sessions. The server works correctly for all
sqlite calls using mormot functionality.

#2 Re: mORMot 1 » ODBC Error » 2018-02-05 19:12:39

Thanks AB
Its unfortunately a little known database used only in its own business application. My only connection to this database is an ODBC driver.
I had a look at SynDBODBC but it is my understanding that Mormot supports certain drivers but not all. I will read the documentation more closely
for SynDODBC and SynOleDB. Thanks for the tip.

#3 Re: mORMot 1 » ODBC Error » 2018-02-04 22:36:28

Many Thanks will do

#4 mORMot 1 » ODBC Error » 2018-02-04 21:06:53

ianc
Replies: 6

Hi All Any help will be appreciated
Im running a SOA server which functions perfectly with authentication and a SQLite database. I needed to extract data from a propitiatory database. initial tests where positive. 
However when I extract many records I get an out of memory error. I hope someone can advise me how to trace the source of the error. I think its in the ODBC driver for the propitiatory database. I would need to trap the error as i have to restart the server for it to continue operating. I am using Delphi Berlin 1.1 Starter edition and a zeos TZConnection and TZReadOnlyQuery
The code and the error are listed below.

function TServiceAttache.OneAttache(partNo: RawUTF8; var Desc: string):double;
var
  ta: TZConnection;
  qu: TZReadOnlyQuery;
begin
  ta := nil;
  try
    ta := TZConnection.Create(nil);
    qu := TZReadOnlyQuery.Create(nil);
    ta.AutoCommit := false;
    ta.ReadOnly := true;
    ta.Version := '7.2.1-rc';
    ta.AutoEncodeStrings := false;
    ta.UseMetadata := false;
    ta.Protocol := 'ado';

    ta.Database := 'Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="DSN=att;DBQ=G:\prophet\DataHL;CODEPAGE=1252';
    ta.Connected := true;
    qu.Connection := ta;
    qu.SQL.Clear;
    qu.Active := false;
    qu.SQL.text := 'Select AverageCost, Description from ICBase where Code = ''' + partNo + '''';
    qu.Active := true;

    result := qu.FieldByName('AverageCost').AsFloat;
    Desc := qu.FieldByName('Description').AsString;
    qu.active := false;
    ta.Connected := false;
    ta.Free;
    qu.Free;
  except
    ta.free;
    qu.free;

  end;
end;

error

20180202 02431342  +    mORMotSQLite3.TSQLRestServerDB(01B0D880).URI(POST root/Attache.OneAttache?session_signature=5EE133260025BC633E826F3F inlen=23)
20180202 02431342 auth  	mORMot.TSQLRestRoutingREST(01AC0330) admin1/1591816998 fe80::9885:a7f8:6d1d:320a%13
20180202 02431342 call  	mORMotSQLite3.TSQLRestServerDB(01B0D880) IAttache.OneAttache["LVFAEA12100001R1",""]
20180202 02431412 srvr  	mORMotSQLite3.TSQLRestServerDB(01B0D880) admin1 fe80::9885:a7f8:6d1d:320a%13 POST root/Attache.OneAttache SOA-Interface -> 200 with outlen=17 in 514555 us
20180202 02431412 ret   	mORMotSQLite3.TSQLRestServerDB(01B0D880) {"result":["",0]}
20180202 02431412  -    00.516.404
20180202 02431412  +    mORMotSQLite3.TSQLRestServerDB(01B0D880).URI(POST root/Attache.OneAttache?session_signature=5EE133260025BC658EBF3D6F inlen=14)
20180202 02431412 auth  	mORMot.TSQLRestRoutingREST(01AC0330) admin1/1591816998 fe80::9885:a7f8:6d1d:320a%13
20180202 02431412 call  	mORMotSQLite3.TSQLRestServerDB(01B0D880) IAttache.OneAttache["EFV3630",""]
20180202 02431439 EXC   	EOleException 80004005 [.NET/CLR unhandled ExternalException] [.NET/CLR unhandled SEHException] ("Unspecified error") at 0077C367  stack trace API 0056F983 0056F9AC 
20180202 02431439 EXC   	EOleException 80004005 [.NET/CLR unhandled ExternalException] [.NET/CLR unhandled SEHException] ("Unspecified error") at 0077C367  stack trace API 0056F983 0056F9AC 0040B3B8 77106D4B 77106BD7 0077C367 0077C367 00AD75A9 00AD76DA 006C8B74 00AE4013 0063A0DB 
20180202 02431448 EXC   	EOleException 80040E14 ("[Simba][SimbaEngine ODBC Driver]Memory allocation error") at 0077A2CB  stack trace API 0056F983 0056F9AC 0040B3B8 77106D4B 77106BD7 0077A2CB 0077A2CB 0077A5BD 0077CBFB 0075FB61 0077B649 0041171A 004104A7 00AD7E34 00AD99D9 00ACD6F4 00ACD0E2 00ACC751 00AE4099 0063A0DB 
20180202 02431448 srvr  	mORMotSQLite3.TSQLRestServerDB(01B0D880) admin1 fe80::9885:a7f8:6d1d:320a%13 POST root/Attache.OneAttache SOA-Interface -> 200 with outlen=17 in 573163 us
20180202 02431448 ret   	mORMotSQLite3.TSQLRestServerDB(01B0D880) {"result":["",0]}
20180202 02431448  -    00.574.765
20180202 02431448  +    mORMotSQLite3.TSQLRestServerDB(01B0D880).URI(POST root/Attache.OneAttache?session_signature=5EE133260025BC675784F160 inlen=15)
20180202 02431448 auth  	mORMot.TSQLRestRoutingREST(01AC0330) admin1/1591816998 fe80::9885:a7f8:6d1d:320a%13
20180202 02431448 call  	mORMotSQLite3.TSQLRestServerDB(01B0D880) IAttache.OneAttache["EFV00160",""]
20180202 02431508 EXC   	EOleException 80040E14 ("[Simba][SimbaEngine ODBC Driver]Memory allocation error") at 0077C367  stack trace API 0056F983 0056F9AC 
20180202 02431508 EXC   	EOleException 80040E14 ("[Simba][SimbaEngine ODBC Driver]Memory allocation error") at 0077C367  stack trace API 0056F983 0056F9AC 0040B3B8 77106D4B 77106BD7 0077C367 0077C367 00AD75A9 00AD76DA 006C8B74 00AE4013 0063A0DB 
20180202 02431515 EXC   	EOleException 80004005 [.NET/CLR unhandled ExternalException] [.NET/CLR unhandled SEHException] ("[Simba][SimbaEngine ODBC Driver][DRM File Library]Out of Memory") at 0077A2CB  stack trace API 0056F983 0056F9AC 0040B3B8 77106D4B 77106BD7 0077A2CB 0077A2CB 0077A5BD 0077CBFB 0075FB61 0077B649 0041171A 004104A7 00AD7E34 00AD99D9 00ACD6F4 00ACD0E2 00ACC751 00AE4099 0063A0DB 

#5 Re: mORMot 1 » Parsing JSON » 2017-12-12 23:40:36

Thanks Igors233

Thats exactly what I was after. Much appreciated will implement

#6 mORMot 1 » Parsing JSON » 2017-12-12 20:52:10

ianc
Replies: 3

Hi All

I have SOA project working as expected. A call to the interface
returns the following.

{"rows":[{"ID":1,"Name":"BE10065","iData":{"name":"BE10065","D1":"D1","D2":"D2","D3":"D3","D4":"D4","D5":"D5","D6":"D6","D7":"D7","D8":"D8","D9":"D9","D10":"D10","D11":"D11","D12":"D12"}}]}

What function on the client side can parse the data in the variant array "iData"

Im guessing i should be using JsonGet(ObjColumn,'Obj1.Obj2.Prop') for this

I just cant work out how to use this on the client side. Any help will be appreciated

#7 Re: mORMot 1 » URL info requred » 2017-11-14 00:29:39

Hi Igor

Thank you very much for the advice, I tried but with no success
I implemented the server code from sample 4 in my server. the server runs and the logs say all is good. but i can still only access my HTML file by double clicking it. All works correctly then I am able to log in with mormot security and all my soa services function.
This URL is  ///C:/PEWeb/PeMor/Server/files/peweb.html

From my train of thought. The class and procedure TMyServer.Html(Ctxt: TSQLRestServerURIContext); Are declared in the server
Surely the client must call this procedure on the server. It this code that I don't know how to implement.???

My HTML file is generated in a Web Elevate app and my interface to mormot functions on all levels accept when trying to set the URL
http://192.168.12.131/files/peweb.html

Im assuming that the root folder is where my server executable is run from.

Apology's for my lack of understanding. I loaded Delphi Berlin starter about a year ago and am really enjoying pascal program and appreciate your patience.

#8 Re: mORMot 1 » URL info requred » 2017-11-12 15:12:27

Hi AB

I have implemented on the client side

 
type
  TMyClient = class(TSQLHttpClient)
    procedure DoMyObject(ahtml: TObject);
  end;

procedure TMyClient.DoMyObject(ahtml: TObject);
var err: integer;
begin
  Not sure what goes here
end;

Sorry to bother but I cant find doc or example of how to return the static HTML file in the client

#9 Re: mORMot 1 » URL info requred » 2017-11-10 16:28:13

Thanks AB

Now I understand

#10 Re: mORMot 1 » URL info requred » 2017-11-09 23:08:50

Hi AB

A bit of over dramatization Im sure its my code that crashed it.

This was the log

20171109 19555609 DB    pe.TMyServer(020AD560) CreateMissingTables on {"TSQLDatabase(0218ABC8)":{"FileName":"C:\\PEWeb\\PeMor\\Server\\pe.db3","IsMemory":false,"UseCache":true,"TransactionActive":false,"BusyTimeout":0,"CacheSize":10000,"PageSize":4096,"PageCount":11,"FileSize":45056,"WALMode":false,"Synchronous":"smFull","LockingMode":"lmNormal","MemoryMappedMB":0,"user_version":0,"OpenV2Flags":6,"BackupBackgroundInProcess":false,"BackupBackgroundLastTime":"","BackupBackgroundLastFileName":"","SQLite3Library":{"TSQLite3LibraryStatic(02060030)":{"Version":"3.19.2 with internal MM"}}}}
20171109 19555609 DB    pe.TMyServer(020AD560) "GetTables":["AuthGroup","AuthUser","cust","People"]
20171109 19555609 trace pe.TMyServer(020AD560) BeginCurrentThread(THttpApiServer) root=root ThreadID=00001348 ThreadCount=32
20171109 19561314 EXCOS EAccessViolation (C0000005) at 005F8AC7  stack trace API 0056165B 00561684 0040B7B6 77096D4B 77096BD7 009B3692 009C59E4 769FEF8C 770B367A 770B364D 

This was because I really do not know how to implement the method in my code TMyServer.Html(Ctxt: TSQLRestServerURIContext);
I used

AServer.html(aCtxt);  

after

TSQLRestServerDB(AServer).CreateMissingTables;

Sorry for so much code in post

#11 Re: mORMot 1 » URL info requred » 2017-11-09 21:12:24

Hi All

I guess this is where I really start to learn.

After Reading up about ReturnFileFromFolder and method based services. ive understood from your reply that I need to add a method to my TSQLRestServerDB

 
   type
    TMyServer = class(TSQLRestServerDB)
    published
    procedure Html(Ctxt: TSQLRestServerURIContext);
  end;

  procedure TMyServer.Html(Ctxt: TSQLRestServerURIContext);
  begin
    Ctxt.ReturnFileFromFolder('C:\PEWeb');
  end; 

in the code in the previous post
ive changed the line to
AServer := TMyServer.Create(aModel, ChangeFileExt(ExeVersion.ProgramFileName, '.db3'), True, '');

Not sure how to implement or even if im on the right track

Ive tried various implementations to no avail crashing the server spectacular, Am I on the right track.

#12 mORMot 1 » URL info requred » 2017-11-08 22:39:19

ianc
Replies: 9

I have my first SOA application working with authentication, and database services working correctly on localhost.

aModel := TSQLModel.Create([TSQLAuthGroup, TSQLAuthUser, TPeople, Tcust], ROOT_NAME);
  try
    AServer := TSQLRestServerDB.Create(aModel, ChangeFileExt(ExeVersion.ProgramFileName, '.db3'), True, '');
    aHTTPServer := TSQLHttpServer.Create(PORT_NAME, [AServer], '+', useHttpApiRegisteringURI);
    TSQLRestServerDB(AServer).CreateMissingTables; 

This URL ///C:/PEWeb/PeMor/Server/files/peweb.html runs my login page correctly

This URL http://192.168.12.131/files/peweb.html
produces this result with the fiddler running

[Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.

What would the correct URL be to access the login page which is generated by peweb.html 
Im trying to run the server on an intranet 

Hope this makes sense, Can anyone help - thanks

#13 Re: mORMot 1 » SOA question » 2017-10-31 06:47:37

Hi AB

Thanks for the positive response. Made good progress today and excited about the future. Its a change of mind set.
IC

#14 mORMot 1 » SOA question » 2017-10-30 03:23:40

ianc
Replies: 2

Hi All
I am working through the mormot framework samples
I have had success with CRUD and the method based servers with client database interaction
I have moved on to SOA and am able to Add and Insert into my database
I wondered if there was an example of navigating in the database using interfaces i.e. go to first or last record
I read that these verbs are not available with SOA but there must be a requirement to navigate databases tables
I am using Delphi Berlin 1.0 starter edition
My problem is navigating back to the record i have just added so to edit it

Any advice will be appreciated by this Newbie

smile

#15 Re: mORMot 1 » Sample 18 » 2017-08-20 21:19:11

Thank you very much and smile

#16 mORMot 1 » Sample 18 » 2017-08-20 18:51:09

ianc
Replies: 2

Hi
I'm a newbie to Mormot and am getting a lot of pleasure coming to grips with this vast array of code. Ive been pretty OK on windows. I have Installed Linux Mint 18 on an old laptop. I used fcupdeluxe to install the Lazarus. All went well. I think Ive done the extras to satisfy FPC. When I try to compile Sample 18. I cant get past the following error message. Im sure its something embarrassingly simple.

Error Identifier not found "useHttpApiRegisteringURI"

#17 PDF Engine » Strange Bullet characters » 2017-05-17 23:05:23

ianc
Replies: 0

Hi

Im using the code below to export a QuickReport in Delphi 5. It all works great but when I preview PDF the document in Firefox or Chrome PDF viewers Bullets in the TQRichview component
appear as a latin character. This does not occur in Internet explorer. Could someone point me in the right direction.

procedure TPamphletView.ReportExport(aReport: TQuickRep; const aFileName: TFileName);
var Pdf: TPdfDocument;
     aMeta: TMetaFile;
     i: integer;
begin
  Pdf := TPdfDocument.Create;
  try
    aReport.Prepare;
    for i := 1 to aReport.QRPrinter.PageCount do begin
      aMeta := aReport.QRPrinter.GetPage(i);
      try
        Pdf.DefaultPageWidth := MulDiv(aMeta.Width,72,Pdf.ScreenLogPixels);
        Pdf.DefaultPageHeight := MulDiv(aMeta.Height,72,Pdf.ScreenLogPixels);
        Pdf.AddPage;
        // draw the page content
        Pdf.Canvas.RenderMetaFile(aMeta,1,0,0);
      finally
        aMeta.Free;
      end;
    end;
    Pdf.SaveToFile(aFileName);
  finally
    Pdf.free;
  end;
end;

Board footer

Powered by FluxBB