Recent

Author Topic: DataSnap Alternative for Lazarus  (Read 35535 times)

jixian.yang

  • Full Member
  • ***
  • Posts: 173
DataSnap Alternative for Lazarus
« on: August 05, 2011, 07:18:54 pm »
Here we can download it:
http://sourceforge.net/projects/laz-n-tier/

It include:
1. Socket event drive component using Synapse.
2. Another version Rx memory dataset with the name changed but XE is supported.
3. Yield sql statement in memory dataset and send it to server with or without cache.
4. Blod field is supported.
5. Can be Lazarus Server and Delphi Client, and vice versa.
6. Client may get verification.
7. Table updating rights can be difined.
and so on.




nicke85

  • Jr. Member
  • **
  • Posts: 92
  • #13#10
Re: DataSnap Alternative for Lazarus
« Reply #1 on: August 05, 2011, 08:13:33 pm »
Sounds good but can't install.It say that need zeosvcl package..
ArchLinux X64 (XFCE) & Windows 7 SP1 Ultimate X64
FPC 2.7.1 / Lazarus 1.1 / ZeosDBO / fortes4lazarus -- all svn

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: DataSnap Alternative for Lazarus
« Reply #2 on: August 06, 2011, 02:42:37 am »
Just delete the "zosvcl" from "required packages", it can be replaced by zeoslib official library. The "zeosvcl" is a modified version of zeoslib but it is not prerequisite.

UIB is required if the UIB server is needed.

And it is easy to write a new database component support server for OnlineDataProc.


jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: DataSnap Alternative for Lazarus
« Reply #3 on: August 06, 2011, 02:44:34 am »
And to compile the server demo, the UTF8Process property should be delete from object ZConnection1 in ServerUnit.lfm.


Tankard

  • New Member
  • *
  • Posts: 14
Re: DataSnap Alternative for Lazarus
« Reply #4 on: September 12, 2011, 09:13:57 pm »
Hi,
i get some compiler errors.

{$IFDEF FPC}
        Initialize(PMemBlobArray(FBlobs)^[0],Value.BlobFieldCount);
{$ELSE}
        Initialize(PMemBlobArray(FBlobs)[0], Value.BlobFieldCount);
{$ENDIF}


C:\lazarus\components\OnLineDataProc\MemDataBase.pas(430,67) Error: Wrong number of parameters specified for call to "Initialize"

how i can fix them?

lazarus: version 0.9.30 date 2011-03-08 fpc 2.4.2 svn 29749

greetings
tankard

Tankard

  • New Member
  • *
  • Posts: 14
Re: DataSnap Alternative for Lazarus
« Reply #5 on: October 11, 2011, 06:54:21 pm »
hi

in your server demo call to

function ZeosDataServer1CustInternalCall(CustInstruc, CustSubInstruc: byte;
      CliParam: PChar; DataQuery: TServerSockQuery; DataSQLProc: TServerSockQuery;
      DataStoredProc: TServerSockQuery; User, SubFunctions: OnlineDataString): OnlineDataString;

user: OnlineDataString; is always ''

and how i can set the CliParam ? (i hope it stands for ClientParam)

how to modify data on the server.

could you please post a complete demo.
thanx in advance

please also change the following lines (to red marked stuff). so it will compile on an 64bit machine. (windows)

line 887:

    if not (State in [dsCalcFields, dsFilter, dsNewValue]) then
      DataEvent(deFieldChange, PtrInt(Field));
  end;

line 1637:

destructor TMemBlobStream.Destroy;
begin
  if FOpened and FModified then
    FField.Modified := True;
  if FModified then
  try
    FDataSet.DataEvent(deFieldChange, PtrInt(FField));
  except
    Application.HandleException(Self);
  end;
end;
« Last Edit: October 11, 2011, 07:36:04 pm by Tankard »

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: DataSnap Alternative for Lazarus
« Reply #6 on: October 12, 2011, 04:22:05 pm »
Thanks for your test.

I am so sorry for the delay response.

But I did not get a window 64 bit system so I could not test MemDataBase.pas which is from rxlib memory dataset unit.

There is another method that the rxlib for lazarus might support Win64, would you like to install rxlib for lazarus on you machine? Also TMemBlobStream is from rxlib.

There is a simple method like Midas and Asta, the client can yield SQL string to server.

And for internal call it means that the SQL string was yielded on server side, DataQuery here is TZQuery,

with DataQuery do
begin
  Close;
  SQL.Clear;
  SQL.Add('...');
  ExecSQL;
end;

According to the CustInstruc, CustSubInstruc and CliParam.

The more demos will be send to SourceForge as soon as possible.








jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: DataSnap Alternative for Lazarus
« Reply #7 on: November 04, 2011, 04:22:46 am »
It is upgraded and the demo is more clear.

The "user" is not "" only when client side called the logon function and successful in.

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DataSnap Alternative for Lazarus
« Reply #8 on: November 04, 2011, 04:04:42 pm »
I downloaded today's version from sourceforge and ran into some problems with the demo.
-Editing values in the the TDBGRID raises "Invalid EditField = xxx" exceptions. It appears that TOnlineQuery.FTable, TOnlineQuery.FPrimaryKey and  TOnlineQuery.FEditFields aren't reset anywhere. They are set in TOnlineQuery.InternalOpen if they are empty but are reset nowhere. The values keep the same even if a new table is selected. Hence the wrong field names for the update query.
-There is a problem with getting the "graphic" data from biolife. Only 1 byte is returned and a stream error is raised when trying to display the image. Querying for length(graphic) returns 38886. I traced it down to the server reading a 1 byte blob. Perhaps my Zeos version is the problem (11/2010).

Tankard

  • New Member
  • *
  • Posts: 14
Re: DataSnap Alternative for Lazarus
« Reply #9 on: November 04, 2011, 04:43:40 pm »
i have the same problems.

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: DataSnap Alternative for Lazarus
« Reply #10 on: November 04, 2011, 06:54:42 pm »
Thanks for your tests.

Please download the DBNetProcessor.7z from sourceforge.

The properties is hidden so it will not be modified in design time.

For the graphic data, the newest zeoslib on its svn is recommended. I use it because it declared that Oracle stored procedure was supported now.


ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DataSnap Alternative for Lazarus
« Reply #11 on: November 04, 2011, 07:37:58 pm »
Please download the DBNetProcessor.7z from sourceforge.
That solved the "Invalid EditField = xxx" exceptions. However, if I understand your code correctly, it isn't possible anymore to specify a PrimaryKey before activating the query. TOnlineQuery.InternalOpen will always overwrite it with the auto-index consisting of the first 3 fields.  May I suggest you clear FPrimaryKey in TOnlineQuery.SetSQL and create the auto-index when FPrimaryKey='' as before.



jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: DataSnap Alternative for Lazarus
« Reply #12 on: November 05, 2011, 08:24:40 am »
That solved the "Invalid EditField = xxx" exceptions. However, if I understand your code correctly, it isn't possible anymore to specify a PrimaryKey before activating the query. TOnlineQuery.InternalOpen will always overwrite it with the auto-index consisting of the first 3 fields.  May I suggest you clear FPrimaryKey in TOnlineQuery.SetSQL and create the auto-index when FPrimaryKey='' as before.

Great idea. It is committed on svn.

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DataSnap Alternative for Lazarus
« Reply #13 on: November 05, 2011, 10:31:37 am »
Why do you close the dataset in TOnlineQuery.SetPrimaryKey?

Some more problems:
- date fields can't be updated. TOnlineQuery.GenerateUpdateData doesn't quote the date time string. TOnlineQuery.ComputePrimaryKeyForSQLData and TOnlineQuery.GenerateInsertData) have the same problem. May I suggest to create a FieldToSQL function to avoid repeating the same code?
- strings can't contain single quotes since the are not escaped. The string O'Hara should be quoted as 'O''Hara'.
- server errors, such as above, are not transmitted to the client.

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DataSnap Alternative for Lazarus
« Reply #14 on: November 05, 2011, 12:30:28 pm »
Issues on the server side:
- when port is in use the server thread exits but no exception is raised.
- server thread is not stopped in TSSocketServer.Close, only the client threads. As a result, when TZeosDataServer1.Port is changed on an active ZeosDataServer1, the server will be listening on 2 ports. To demonstrate this, add the following to the demo ServerUnit.pas:
Code: [Select]
procedure TServerForm.FormShow(Sender: TObject);
begin
  ZeosDataServer1.Port:='8081';
end;
The server in now listening on port 8080 and 8081.
- TZeosDataServer.SetPort should only call close,listen if port is different from earlier value. In the demo where active:=true and port:=8080, when loading the component a server thread listening on the same port will be created from both TZeosDataServer.SetActive and TZeosDataServer.SetPort.

 

TinyPortal © 2005-2018