打印本文 打印本文 关闭窗口 关闭窗口
Integer GUID和Comb做主键的效率测试(Delphi+access)(二)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数4089  更新时间:2009/4/23 18:25:46  文章录入:mintao  责任编辑:mintao
o

  begin

     //combStr :=

     //combstr := copy(combstr,21,32)+copy(combstr,1,20);

     ADOCommand1.Parameters[0].Value := SSystem.GetGuidString2(SSystem.GetCombGUID(),'''''''','''''''','''''''');;

     ADOCommand1.Parameters[1].Value := i/7;

     ADOCommand1.Execute;

  end;

 

 

 

end;

 

 

 

procedure TForm1.InsertGuid(cc : integer);

var

  i : integer;

  guid : TGUID;

begin

  ADOCommand1.CommandText :=''''Insert into TGuid(PGuid,NInt) values(:PGuid,:NInt)'''';

  ADOCommand1.Prepared := true;

  For i:= 0 to cc-1 do

  begin

     CoCreateGUID(guid);

     ADOCommand1.Parameters[0].Value := SSystem.GetGuidString(guid,'''''''','''''''','''''''');

     ADOCommand1.Parameters[1].Value := i/7;

     ADOCommand1.Execute;

  end;

 

 

 

end;

 

 

 

procedure TForm1.insertInt(cc : integer);

var

  i : integer;

begin

  ADOCommand1.CommandText :=''''Insert into TInteger(NInt) values(:NInt)'''';

  ADOCommand1.Prepared := true;

  For i:= 0 to cc-1 do

  begin

     ADOCommand1.Parameters[0].Value := i/7;

     ADOCommand1.Execute;

  end;

 

 

 

end;

 

 

 

procedure TForm1.Button2Click(Sender: TObject);

var

 TotalTime : Cardinal;

begin

TotalTime := GetTickCount;

ADOCommand1.CommandText :=''''select count(*) as ttc from TInteger'''';

ADOCommand1.Execute;

TotalTime := GetTickCount - TotalTime;

Label3.Caption := inttostr(TotalTime);

 

 

 

TotalTime := GetTickCount;

ADOCommand1.CommandText :=''''select count(*) as ttc from TGuid'''';

ADOCommand1.Execute;

TotalTime := GetTickCount - TotalTime;

Label5.Caption := inttostr(TotalTime);

 

 

 

TotalTime := GetTickCount;

ADOCommand1.CommandText :=''''select count(*) as ttc from Tcomb'''';

ADOCommand1.Execute;

TotalTime := GetTickCount - TotalTime;

Label7.Caption := inttostr(TotalTime);

 

 

 

TotalTime := GetTickCount;

ADOCommand1.CommandText :=''''s

上一页  [1] [2] [3] [4]  下一页

打印本文 打印本文 关闭窗口 关闭窗口