Распределенные вычисления и технологии Inprise

unit st1;
//Simple MTS server
//By N.Elmanova
//01.12.1998

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComServ, ComObj, VCLCom, StdVcl, BdeProv, BdeMts, DataBkr, DBClient,
  MtsRdm, Mtx, st_TLB, DBTables, Provider, Db;

type
  TStockDM1 = class(TMtsDataModule, IStockDM1)
    stable: TTable;
    StProvider: TProvider;
    Database1: TDatabase;
    Query1: TQuery;
    Query2: TQuery;
    Session3: TSession;
  private
    { Private declarations }
  public
    { Public declarations }
  protected
    function GetGoods: OleVariant; safecall;
    procedure AddGoods(const Gname: WideString; Gprice: Double); safecall;
    procedure DeleteGoods(Gnumber: Integer); safecall;
  end;

var
  StockDM1: TStockDM1;

implementation

{$R *.DFM}

function TStockDM1.GetGoods: OleVariant;
begin
  Result:=StProvider.Data;
  SetComplete;
end;

procedure TStockDM1.AddGoods(const Gname: WideString; Gprice: Double);
begin
try
  Database1.Open;
  Query1.Params[0].Value:=Gname;
  Query1.Params[1].Value:=Gprice;
  Query1.Prepare;
  Query1.ExecSQL;
  Database1.Сlose;
  SetComplete;
except
  SetAbort;
  raise;
end;
end;

procedure TStockDM1.DeleteGoods(Gnumber: Integer);
begin
try
  Database1.Open;
  Query2.Params[0].Value:=Gnumber;
  Query2.Prepare;
  Query2.ExecSQL;
  Database1.Сlose;
  SetComplete;
except
  SetAbort;
  raise;
end;
end;

initialization
  TComponentFactory.Create(ComServer, TStockDM1,
    Class_StockDM1, ciMultiInstance, tmApartment);
end.

возврат


Наш канал на Youtube

1999 1 2 3 4 5 6 7 8 9 10 11 12
2000 1 2 3 4 5 6 7 8 9 10 11 12
2001 1 2 3 4 5 6 7 8 9 10 11 12
2002 1 2 3 4 5 6 7 8 9 10 11 12
2003 1 2 3 4 5 6 7 8 9 10 11 12
2004 1 2 3 4 5 6 7 8 9 10 11 12
2005 1 2 3 4 5 6 7 8 9 10 11 12
2006 1 2 3 4 5 6 7 8 9 10 11 12
2007 1 2 3 4 5 6 7 8 9 10 11 12
2008 1 2 3 4 5 6 7 8 9 10 11 12
2009 1 2 3 4 5 6 7 8 9 10 11 12
2010 1 2 3 4 5 6 7 8 9 10 11 12
2011 1 2 3 4 5 6 7 8 9 10 11 12
2012 1 2 3 4 5 6 7 8 9 10 11 12
2013 1 2 3 4 5 6 7 8 9 10 11 12
Популярные статьи
КомпьютерПресс использует