현재 델마당에서 다른분이 올려주신 넷서버프로그램을 수정중인데
xp에서는 잘 작동이 되는데 server2003에서는 open이 되지않습니다
현재 에러나는부분은
procedure TNetServerDataSetSQL.ExecuteStreamCursor;
에서 Open하는부분입니다.
unit NetServerDataSetSQL;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
NetStreamTypes, NetMessage, NetDataSetSQL, StreamCompress;
// Db, DBTables, DBClient, Provider;
type
TNetServerDataSetSQL = class(TNetDataSetSQL)
private
Header: TStreamHeader;
FCompress : Boolean;
FServerErrorCode : Integer;
FDataSetStream, FSendStream : TMemoryStream;
function GetSendStream : TStream;
function GetSendStreamSize : Integer;
procedure CompressSendStream;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ExecuteStreamCursor;
published
property StreamCompress : Boolean read FCompress write FCompress;
property ErrorCode : Integer read FServerErrorCode;
property SendStream: TStream read GetSendStream;
property SendStreamSize: Integer read GetSendStreamSize;
end;
implementation
constructor TNetServerDataSetSQL.Create(AOwner: TComponent);
begin
FCompress := False;
FServerErrorCode := SM_SUCCESS;
FDataSetStream := TMemoryStream.Create;
FSendStream := TMemoryStream.Create;
inherited Create(AOwner);
end;
destructor TNetServerDataSetSQL.Destroy;
begin
inherited Destroy;
FDataSetStream.Free;
FSendStream.Free;
end;
procedure TNetServerDataSetSQL.ExecuteStreamCursor;
begin
Close;
try
FServerErrorCode := SM_GENSQL_ERR;
Open;
FServerErrorCode := SM_SAVESTREAM_ERR;
SaveToStream( FDataSetStream );
FServerErrorCode := SM_COMPRESS_ERR;
if FCompress then CompressSendStream;
FServerErrorCode := SM_SUCCESS;
except
end;
end;
function TNetServerDataSetSQL.GetSendStream: TStream;
begin
FDataSetStream.Position := 0;
Header.ErrorCode := FServerErrorCode;
FSendStream.Write( Header, SizeOf( Header ) );
FSendStream.CopyFrom( FDataSetStream, FDataSetStream.Size );
Result := FSendStream;
end;
function TNetServerDataSetSQL.GetSendStreamSize: Integer;
begin
Result := FSendStream.Size;
end;
procedure TNetServerDataSetSQL.CompressSendStream;
var
CompressStream : TMemoryStream;
begin
CompressStream := TMemoryStream.Create;
try
try
CompressStream.LoadFromStream( FDataSetStream );
FDataSetStream.Clear;
LZHCompressBlobStream( CompressStream, FDataSetStream );
except
FServerErrorCode := SM_COMPRESS_ERR;
end;
finally
CompressStream.Free;
end;
end;
end.