异地数据共享、同步,网络数据库应用开发经验大总结,发放开发平台!! ( 积分: 200 )

  • 主题发起人 差不多算了
  • 开始时间
gameboyda@163.com
谢谢
 
cookietian@163.com
谢谢
 
不错,跟一下
 
希望能学习一下,呵呵...
 
请楼主给我一份 十分感谢
jxpushuai520@163.com
 
开发平台一: B/S和C/S技术结合的一个平台,传输采用的是http协议,终端采用C/S方式。
这种 太多了

procedure TWebModule1.WebModule1WebActionItem7Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
strsql: string;
i: integer;
ms: TMemoryStream;
begin
inc(AccessCount);
strsql := DeStr(Request.QueryFields.Values['sql']);
try

ADODataSet1.CommandText := strsql;
ADODataSet1.Open;
ms := TMemoryStream.Create;
ADOToStream(ADODataSet1, ms, i);
ADODataSet1.Close;
ms.Position := 0;

Response.ContentStream := ms;
inc(TranDataByteCount, ms.Size);

except
on E: Exception do recordEvent('/DataWithSql ' + strsql + ' ' + E.Message);

end;
//
end;

////////
function ADOToStream(DT: TCustomADODataSet; S: tstream; var ECount: integer): boolean;
var
intV, i, k, l, fc, rc: integer;
FT: TFieldType;
str, strV: string;
B: Byte;
FTList: array of TFieldType;
V: OleVariant;
DateTimeV: TDateTime;
FloatV: Extended;
booleanV: boolean;
begin
Result := false;
ECount := 0;
if not dt.Active then
exit;
try
fc := dt.FieldCount;
s.WriteBuffer(fc, 4);
setlength(FTList, fc);

for i := 0 to dt.FieldCount - 1 do
begin
str := dt.Fields.FieldName;
l := length(str);
s.WriteBuffer(l, 4);
s.Write(str[1], l);

ft := dt.Fields.DataType;
s.Write(ft, SIZEOF(ft));
FTList := ft;

l := dt.Fields.Size;
s.WriteBuffer(l, 4);

end;



with dt.Recordset do
begin
rc := RecordCount;
s.WriteBuffer(rc, 4);

if not dt.IsEmpty then
begin
MoveFirst;

for i := 0 to rc - 1 do
begin

for k := 0 to fc - 1 do
begin
v := dt.Recordset.Fields[k].Value;
if VarIsNull(V) then
b := 1
else
b := 0;
s.WriteBuffer(b, 1);
if b = 1 then
Continue;

case FTList[k] of
ftString, ftMemo, ftFixedChar, ftWideString:
begin
strV := v;
l := length(strV);
s.WriteBuffer(l, 4);
s.Write(strV[1], l);

end;
ftDate, ftTime, ftDateTime:
begin
DateTimeV := v;
s.Write(DateTimeV, 8);
end;
ftSmallint, ftInteger, ftWord:
begin
intV := v;
s.Write(intV, 4);
end;
ftFloat, ftCurrency, ftBCD:
begin
FloatV := v;
s.Write(FloatV, 10);
end;
ftBoolean:
begin
booleanV := v;
s.Write(FloatV, 1);

end;
else
;
end;

end;
Inc(ECount);
MoveNext;
end;
end;
end;
Result := true;
except;
end;
setlength(FTList, 0);

end;



function StreamToADO(DT: TADODataSet; S: tstream; var ECount: integer): boolean;
var
intV, i, k, l, fc, rc: integer;
FT: TFieldType;
str, strV: string;
B: Byte;
FTList: array of TFieldType;
V: OleVariant;
DateTimeV: TDateTime;
FloatV: Extended;
booleanV: boolean;
begin
Result := false;
ECount := 0;

try

dt.Close;
dt.DisableControls;
dt.FieldDefs.Clear;
s.ReadBuffer(fc, 4);
setlength(ftList, fc);
for i := 0 to fc - 1 do
begin
s.ReadBuffer(l, 4);
setlength(str, l);
s.ReadBuffer(str[1], l);


s.ReadBuffer(ft, SIZEOF(ft));
FTList := ft;


s.ReadBuffer(l, 4);
DT.FieldDefs.Add(str, ft, l);

end;

dt.CreateDataSet;
dt.Open;
s.ReadBuffer(rc, 4);

with dt do
for i := 1 to rc do
begin



Append;


for k := 0 to fc - 1 do
begin

s.ReadBuffer(b, 1);
if b = 1 then
begin
Fields[k].Value := null;
Continue;
end;





case FTList[k] of
ftString, ftMemo, ftFixedChar, ftWideString:
begin

s.ReadBuffer(l, 4);
setlength(strV, l);
s.ReadBuffer(strV[1], l);
Fields[k].Value := strV;
end;
ftDate, ftTime, ftDateTime:
begin

s.ReadBuffer(DateTimeV, 8);
Fields[k].Value := DateTimeV;
end;
ftSmallint, ftInteger, ftWord:
begin

s.ReadBuffer(intV, 4);
Fields[k].Value := intv;
end;
ftFloat, ftCurrency, ftBCD:
begin

s.ReadBuffer(FloatV, 10);
Fields[k].Value := FloatV;
end;
ftBoolean:
begin

s.ReadBuffer(FloatV, 1);
Fields[k].Value := booleanV;
end;
else
;
end;

end;
Inc(ECount);


end;




Result := true;
except;
end;
try
dt.First;
dt.EnableControls
except;
end;
setlength(FTList, 0);

end;
 
开发平台二:P2P技术的实时网络数据库应用开发平台。传输采用的是P2P技术,效率特别高,比第一个平台的效率要高出很多倍,并发量高,连接池处理等。

你的 数据 是 如何 存储的??????
 
帮顶一下
 
楼主能发一份给我,希望能学习一下.E-mail:daidiren@sina.com
 
顶一个!
 
to hfghfghfg:
好象写的太复杂了,我只写了一小段代码,呵呵。

其实你写的这个是我最早写的一种办法,但是效率太低了,如果几千条的话还可以,再多了,效果比较差,如果有几万,几十万条的话,根本就不能用(当然,我测试的机器比较次)。
而且要考虑高速的加密和压缩,其实数据打包只是其中一部分。

p2p只是连接的一种方式和传输的一种方式而已,数据储存和第一个平台是一样的啊。
 
楼主能发一份给我,希望能学习一下.E-mail:yflxm@126.com
 
楼主能发一份给我,希望能学习一下.E-mail:qinghh2002@yahoo.com.cn
 
给个Demo谢谢 .E-mail:gui_w@163.com
 
楼主给我一份学习一下吧,谢谢:qingwen07@hotmail.com
 
也给我一份吧,谢谢wcf99221@163.com
 
也给我一份吧,谢谢~!
yangh999@163.com
 
我们正好碰到远程中数据传输部分的问题,
希望楼主能发一份这部分的资料给我,有源代码更好。谢谢
crabking@126.com
 
也给我一份吧,谢谢~!
httymyc@163.com
 
很快发分!
 
顶部