-
Notifications
You must be signed in to change notification settings - Fork 4
/
ZeosBlock.txt
95 lines (72 loc) · 1.83 KB
/
ZeosBlock.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
conConnection: TZConnection;
sqlScript: TZSQLProcessor;
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
procedure TForm1.Button1Click(Sender: TObject);
var i:integer; My_DateTime:TDateTime;
begin
Button1.Caption:='o';
Button2.Caption:='o';
sqlScript.Script.Clear;
memo1.Lines.Clear;
// memo1.Lines.LoadFromFile('e:\demos\adb.txt');
// memo1.Lines.Assign(sqlscript.Script);
// sqlScript.LoadFromFile('e:\demos\adb.txt');
memo1.Hide;
for i:=0 to 100000 do
begin
//sqlScript.Script.Add('insert into namen values('+IntToStr(i)+','+'''aaa'''+');');
memo1.Lines.Add('insert into namen values('+IntToStr(i)+','+'''aaa'''+');');
if (i mod 300)=0 then
Caption:=IntToStr(i);
end;
memo1.Show;
memo1.Update;
My_DateTime:=now;
sqlScript.Script.Assign(memo1.Lines);
Button1.Caption:=FloatToStr((now-My_DateTime)*24*60*60);
My_DateTime:=now;
conConnection.StartTransaction;
Try
sqlScript.Execute;
Except
conConnection.Rollback;
End;
// conConnection.Commit;
Button2.Caption:=FloatToStr((now-My_DateTime)*24*60*60);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
conConnection.Commit;
Close;
end;
测试时在
conConnection.Commit;
之前数据未写入库中,执行后写入了。
CREATE TABLE NAMEN (
RECNO NUMERIC(9,0),
NAME VARCHAR(28)
);
以下语句在IBExpert个人版中测试通过,加入三十万记录,不用多长时间的,稍候而已。
不过用ZEOSLIB时我用上面的示例TZSQLProcessor装入以下语句通不过。你可以自己测试或用其它控件试试。
试好了别忘了到这里公布一下。
CREATE TABLE CCC (
ID INTEGER,
CUSTID VARCHAR(10)
);
delete from ccc;
EXECUTE BLOCK
AS
DECLARE I INT = 0;
DECLARE N INT = 300000;
DECLARE S VARCHAR(255);
BEGIN
--set transaction;
WHILE (i < N) DO
BEGIN
insert into ccc values (:i, 'aaa');
i = i + 1;
END
--commit transaction;
END