P
panduola
Unregistered / Unconfirmed
GUEST, unregistred user!
我的CGI程序很慢主要是TPageProducer耗费的时间,贴出部分代码,请问这段代码耗费时间
的瓶颈在什么地方!
if Request.ContentFields.Values['a1']<>'' then
CpNo := Request.ContentFields.Values['a1']
else begin
CpNo := Request.ContentFields.Values['T1']; //彩票号码
Name := Request.ContentFields.Values['T2'];
ManId := Request.ContentFields.Values['T3'];
CpNo := Enc_Dec.StrEnc(CpNo);
end;
SQLStr := 'select tzjh,qh,wf,zzs,tzsj,tzfs,lsh from tz where cph='''+ CpNo+'''';
ADOQ.Close;
ADOQ.SQL.Clear;
ADOQ.SQL.Add(SQLStr) ;
try
ADOQ.Open;
qh := ADOQ.FieldByName('qh').AsString;
wf := ADOQ.FieldByName('wf').AsString;
tzjh := ADOQ.FieldByName('tzjh').AsString;
zzs := IntToStr(ADOQ.FieldByName('zzs').AsInteger);
tzsj := DateTimeToStr(ADOQ.FieldByName('tzsj').AsDateTime);
tzfs := ADOQ.FieldByName('tzfs').AsString;
lsh := ADOQ.FieldByName('lsh').AsString;
except
on E:Exception do
begin
Response.Content := '查询失败,错误原因:' +E.Message ;
exit;
end;
end;
case StrToInt(tzfs) of
1:begin
tzfsch := '单式';
tzfsb := '机选';
end ;
2:begin
tzfsch := '单式';
tzfsb := '自选';
end ;
3:begin
tzfsch := '复式';
tzfsb := '自选';
end ;
4:begin
tzfsch := '复式';
tzfsb := '机选';
end ;
5:begin
tzfsch := '胆拖';
tzfsb := '自选';
end ;
end;
//替换玩法,期号
if TagString='wf' then
ReplaceText := wf
else if TagString='xsqh' then
ReplaceText :=qh
else if TagString='yxqh' then
ReplaceText := qh
//替换投注时间
else if TagString='xssj' then
ReplaceText := tzsj
//替换逻辑机号
else if TagString='ljjh' then
ReplaceText := tzjh
//替换销售流水号
else if TagString='xslsh' then
ReplaceText := lsh
//替代总投注
else if TagString='zzs' then
ReplaceText := zzs
//替换兑奖流水号
else if TagString='djlsh' then
ReplaceText := '0'
//替换销售类型和投注方式
else if TagString='xslx' then
ReplaceText := tzfsch
else if TagString='tzfs' then
ReplaceText := tzfsb;
SQLStr := 'select wf from qcs where qh='''+qh+'''';
ADOQ.Close;
ADOQ.SQL.Clear;
ADOQ.SQL.Add(SQLStr) ;
try
ADOQ.Open
except
on E:Exception do
begin
Response.Content := '查询失败,错误原因:' +E.Message ;
exit;
end;
end;
if ADOQ.FieldByName('wf').AsString='0730' then
Tablenm := 'zj0730'
else if ADOQ.FieldByName('wf').AsString='0523' then
Tablenm := 'zj0523'
else if ADOQ.FieldByName('wf').AsString='0736' then
Tablenm := 'zj0736';
SQLStr := 'select djsj,jzsj,sfdj,djqh from '+Tablenm+' where cph=''' +CpNo+''' and qh='''+qh+'''';
ADOQ.Close;
ADOQ.SQL.Clear;
ADOQ.SQL.Add(SQLStr) ;
try
ADOQ.Open
except
on E:Exception do
begin
Response.Content := '查询失败,错误原因:' +E.Message ;
exit;
end;
end ;
djsj := DateTimeToStr(ADOQ.FieldByName('djsj').AsDateTime);
jzsj := DateTimeToStr(ADOQ.FieldByName('jzsj').AsDateTime);
sfdj := ADOQ.FieldByName('sfdj').AsString;
djqh := ADOQ.FieldByName('djqh').AsString;
if sfdj='False' then
sfdjch := '未兑奖'
else sfdjch := '已兑奖';
SQLStr := 'select sfzh,djr from '+Tablenm+' where cph='''+ CpNo +'''' ;
ADOQ.Close;
ADOQ.SQL.Clear;
ADOQ.SQL.Add(SQLStr) ;
ADOQ.Open ;
ManId := ADOQ.FieldByName('sfzh').AsString;
Name := ADOQ.FieldByName('djr').AsString;
//替换身份证号码
if TagString='sfzh' then
ReplaceText := ManId
//替换中奖人姓名
else if TagString='zjrxm' then
ReplaceText := Name
//替换兑奖日期
else if TagString='djrq' then
ReplaceText := djsj
//替换兑奖期限
else if TagString='djqx' then
ReplaceText := jzsj
//替换兑奖期号
else if TagString='djqh' then
ReplaceText := djqh
//替换兑奖标志
else if TagString='djbz' then
ReplaceText := sfdjch;
的瓶颈在什么地方!
if Request.ContentFields.Values['a1']<>'' then
CpNo := Request.ContentFields.Values['a1']
else begin
CpNo := Request.ContentFields.Values['T1']; //彩票号码
Name := Request.ContentFields.Values['T2'];
ManId := Request.ContentFields.Values['T3'];
CpNo := Enc_Dec.StrEnc(CpNo);
end;
SQLStr := 'select tzjh,qh,wf,zzs,tzsj,tzfs,lsh from tz where cph='''+ CpNo+'''';
ADOQ.Close;
ADOQ.SQL.Clear;
ADOQ.SQL.Add(SQLStr) ;
try
ADOQ.Open;
qh := ADOQ.FieldByName('qh').AsString;
wf := ADOQ.FieldByName('wf').AsString;
tzjh := ADOQ.FieldByName('tzjh').AsString;
zzs := IntToStr(ADOQ.FieldByName('zzs').AsInteger);
tzsj := DateTimeToStr(ADOQ.FieldByName('tzsj').AsDateTime);
tzfs := ADOQ.FieldByName('tzfs').AsString;
lsh := ADOQ.FieldByName('lsh').AsString;
except
on E:Exception do
begin
Response.Content := '查询失败,错误原因:' +E.Message ;
exit;
end;
end;
case StrToInt(tzfs) of
1:begin
tzfsch := '单式';
tzfsb := '机选';
end ;
2:begin
tzfsch := '单式';
tzfsb := '自选';
end ;
3:begin
tzfsch := '复式';
tzfsb := '自选';
end ;
4:begin
tzfsch := '复式';
tzfsb := '机选';
end ;
5:begin
tzfsch := '胆拖';
tzfsb := '自选';
end ;
end;
//替换玩法,期号
if TagString='wf' then
ReplaceText := wf
else if TagString='xsqh' then
ReplaceText :=qh
else if TagString='yxqh' then
ReplaceText := qh
//替换投注时间
else if TagString='xssj' then
ReplaceText := tzsj
//替换逻辑机号
else if TagString='ljjh' then
ReplaceText := tzjh
//替换销售流水号
else if TagString='xslsh' then
ReplaceText := lsh
//替代总投注
else if TagString='zzs' then
ReplaceText := zzs
//替换兑奖流水号
else if TagString='djlsh' then
ReplaceText := '0'
//替换销售类型和投注方式
else if TagString='xslx' then
ReplaceText := tzfsch
else if TagString='tzfs' then
ReplaceText := tzfsb;
SQLStr := 'select wf from qcs where qh='''+qh+'''';
ADOQ.Close;
ADOQ.SQL.Clear;
ADOQ.SQL.Add(SQLStr) ;
try
ADOQ.Open
except
on E:Exception do
begin
Response.Content := '查询失败,错误原因:' +E.Message ;
exit;
end;
end;
if ADOQ.FieldByName('wf').AsString='0730' then
Tablenm := 'zj0730'
else if ADOQ.FieldByName('wf').AsString='0523' then
Tablenm := 'zj0523'
else if ADOQ.FieldByName('wf').AsString='0736' then
Tablenm := 'zj0736';
SQLStr := 'select djsj,jzsj,sfdj,djqh from '+Tablenm+' where cph=''' +CpNo+''' and qh='''+qh+'''';
ADOQ.Close;
ADOQ.SQL.Clear;
ADOQ.SQL.Add(SQLStr) ;
try
ADOQ.Open
except
on E:Exception do
begin
Response.Content := '查询失败,错误原因:' +E.Message ;
exit;
end;
end ;
djsj := DateTimeToStr(ADOQ.FieldByName('djsj').AsDateTime);
jzsj := DateTimeToStr(ADOQ.FieldByName('jzsj').AsDateTime);
sfdj := ADOQ.FieldByName('sfdj').AsString;
djqh := ADOQ.FieldByName('djqh').AsString;
if sfdj='False' then
sfdjch := '未兑奖'
else sfdjch := '已兑奖';
SQLStr := 'select sfzh,djr from '+Tablenm+' where cph='''+ CpNo +'''' ;
ADOQ.Close;
ADOQ.SQL.Clear;
ADOQ.SQL.Add(SQLStr) ;
ADOQ.Open ;
ManId := ADOQ.FieldByName('sfzh').AsString;
Name := ADOQ.FieldByName('djr').AsString;
//替换身份证号码
if TagString='sfzh' then
ReplaceText := ManId
//替换中奖人姓名
else if TagString='zjrxm' then
ReplaceText := Name
//替换兑奖日期
else if TagString='djrq' then
ReplaceText := djsj
//替换兑奖期限
else if TagString='djqx' then
ReplaceText := jzsj
//替换兑奖期号
else if TagString='djqh' then
ReplaceText := djqh
//替换兑奖标志
else if TagString='djbz' then
ReplaceText := sfdjch;