Fórum Urgentissimo #381267
13/07/2010
0
begin
dsTodasLinhasF.DataSet.close;
dsTodasLinhasF.DataSet.Open; Dmfirebird.cdsTodasLinhasf.First;
while not Dmfirebird.cdsTodasLinhasf.Eof do
begin
with Dmfirebird do
begin
cdsTodasLinhasSQl.Open;
cdsTodasLinhasSQl.Append;
cdsTodasLinhasSQlNr_Linha.AsInteger := cdsTodasLInhasFLinha.AsInteger;
cdsTodasLinhasSQlDS_DDD.AsString := cdsTodasLInhasFDDD.AsString;
cdsTodasLinhasSQlDs_Fone.AsString := cdsTodasLInhasFFone.AsString;
cdsTodasLinhasSQlDs_Nome.AsString := cdsTodasLInhasFNome.AsString;
cdsTodasLinhasSQlHr_Inicio.AsString := cdsTodasLInhasFInicio.AsString;
cdsTodasLinhasSQlHr_Fim.AsString := cdsTodasLInhasFFim.AsString;
cdsTodasLinhasSQlTempoTotal.AsString := cdsTodasLInhasFTempoTotal.AsString;
cdsTodasLinhasSQlFileRecord.AsString := cdsTodasLInhasFFileRecord.AsString;
cdsTodasLinhasSQlTipo.AsInteger := cdsTodasLInhasFTipo.AsInteger;
cdsTodasLinhasSQlId_Usuario.AsString := '1';
cdsTodasLinhasSQlFiltro.AsString := cdsTodasLInhasFFiltro.AsString;
cdsTodasLinhasSQlTipoCH.AsString := cdsTodasLInhasFTipoCH.AsString;
cdsTodasLinhasSQlOPR.AsString := cdsTodasLInhasFOPR.AsString;
cdsTodasLinhasf.Next;
cdsTodasLinhasSQl.Post;
end;
Dmfirebird.cdsTodasLinhasSQl.ApplyUpdates(0);
Dmfirebird.cdsTodasLinhasSQl.EmptyDataSet;
end; Dmfirebird.cdsTodasLinhasf.First;
while not Dmfirebird.cdsTodasLinhasf.Eof do
begin
Dmfirebird.cdsTodasLinhasf.Edit;
Dmfirebird.cdsTodasLInhasFESTATUS.AsString := 'f';
Dmfirebird.cdsTodasLinhasf.Next;
end; Dmfirebird.cdsTodasLinhasf.ApplyUpdates(0);
Dmfirebird.cdsTodasLinhasf.EmptyDataSet; dsTodasLinhasSQl.DataSet.close;
dsTodasLinhasSQl.DataSet.Open; lblsql.Caption := IntToStr(dsTodasLinhasSQl.DataSet.RecordCount); end;
Carlos Faria
Curtir tópico
+ 0Posts
13/07/2010
Wesley Yamazack
O problema é que deadlock acontece no banco de dados, o componente deste camarada, deve travar o registro e não liberar o mesmo. Pois deadlock é quando o banco de dados bloqueia um registro que esta aberto, por outra pessoa.
O erro acontece em que linha ?
Att.
Wesley Y
Gostei + 0
13/07/2010
Carlos Faria
var
T: Ttransactiondesc ;
beginnen proberen
Dmfirebird.dbAcessoFirebird.StartTransaction (T) ;
Dmfirebird.cdsTodasLinhasf.First ;
terwijl niet Dmfirebird.cdsTodasLinhasf.Eof doen
beginnen
met Dmfirebird doen
beginnen
cdsTodasLinhasSQl.Open ;
cdsTodasLinhasSQl.Append ;
cdsTodasLinhasSQlNr_Linha.AsInteger : = cdsTodasLInhasFLinha.AsInteger ;
cdsTodasLinhasSQlDS_DDD.AsString : = cdsTodasLInhasFDDD.AsString ;
cdsTodasLinhasSQlDs_Fone.AsString : = cdsTodasLInhasFFone.AsString ;
cdsTodasLinhasSQlDs_Nome.AsString : = cdsTodasLInhasFNome.AsString ;
cdsTodasLinhasSQlHr_Inicio.AsString : = cdsTodasLInhasFInicio.AsString ;
cdsTodasLinhasSQlHr_Fim.AsString : = cdsTodasLInhasFFim.AsString ;
cdsTodasLinhasSQlTempoTotal.AsString : = cdsTodasLInhasFTempoTotal.AsString ;
cdsTodasLinhasSQlFileRecord.AsString : = cdsTodasLInhasFFileRecord.AsString ;
cdsTodasLinhasSQlTipo.AsInteger : = cdsTodasLInhasFTipo.AsInteger ;
cdsTodasLinhasSQlId_Usuario.AsString : = '1 ' ;
cdsTodasLinhasSQlFiltro.AsString : = cdsTodasLInhasFFiltro.AsString ;
cdsTodasLinhasSQlTipoCH.AsString : = cdsTodasLInhasFTipoCH.AsString ;
cdsTodasLinhasSQlOPR.AsString : = cdsTodasLInhasFOPR.AsString ;
cdsTodasLinhasf.Next ;
cdsTodasLinhasSQl.Post ;
einde te maken;
einde te maken;
Dmfirebird.cdsTodasLinhasSQl.ApplyUpdates (0);
Dmfirebird.dbAcessoFirebird.Commit (T) ;
behalve
Dmfirebird.dbAcessoFirebird.Rollback (T) ;
einde te maken;
Gostei + 0
13/07/2010
Carlos Faria
var
T: Ttransactiondesc;
begin try
Dmfirebird.dbAcessoFirebird.StartTransaction(T);
Dmfirebird.cdsTodasLinhasf.First;
while not Dmfirebird.cdsTodasLinhasf.Eof do
begin
with Dmfirebird do
begin
cdsTodasLinhasSQl.Open;
cdsTodasLinhasSQl.Append;
cdsTodasLinhasSQlNr_Linha.AsInteger := cdsTodasLInhasFLinha.AsInteger;
cdsTodasLinhasSQlDS_DDD.AsString := cdsTodasLInhasFDDD.AsString;
cdsTodasLinhasSQlDs_Fone.AsString := cdsTodasLInhasFFone.AsString;
cdsTodasLinhasSQlDs_Nome.AsString := cdsTodasLInhasFNome.AsString;
cdsTodasLinhasSQlHr_Inicio.AsString := cdsTodasLInhasFInicio.AsString;
cdsTodasLinhasSQlHr_Fim.AsString := cdsTodasLInhasFFim.AsString;
cdsTodasLinhasSQlTempoTotal.AsString := cdsTodasLInhasFTempoTotal.AsString;
cdsTodasLinhasSQlFileRecord.AsString := cdsTodasLInhasFFileRecord.AsString;
cdsTodasLinhasSQlTipo.AsInteger := cdsTodasLInhasFTipo.AsInteger;
cdsTodasLinhasSQlId_Usuario.AsString := '1';
cdsTodasLinhasSQlFiltro.AsString := cdsTodasLInhasFFiltro.AsString;
cdsTodasLinhasSQlTipoCH.AsString := cdsTodasLInhasFTipoCH.AsString;
cdsTodasLinhasSQlOPR.AsString := cdsTodasLInhasFOPR.AsString;
cdsTodasLinhasf.Next;
cdsTodasLinhasSQl.Post;
end;
end;
Dmfirebird.cdsTodasLinhasSQl.ApplyUpdates(0);
Dmfirebird.dbAcessoFirebird.Commit(T);
except
Dmfirebird.dbAcessoFirebird.Rollback(T);
end;
Gostei + 0
14/07/2010
Wesley Yamazack
procedure TfrmMigracaoFirebird.tmrTesteTimer(Sender: TObject);
var
T: Ttransactiondesc;
begin try
Dmfirebird.dbAcessoFirebird.StartTransaction(T);
Dmfirebird.cdsTodasLinhasf.First; cdsTodasLinhasSQl.Open; while not Dmfirebird.cdsTodasLinhasf.Eof do
begin
with Dmfirebird do
begin
cdsTodasLinhasSQl.Append;
cdsTodasLinhasSQlNr_Linha.AsInteger := cdsTodasLInhasFLinha.AsInteger;
cdsTodasLinhasSQlDS_DDD.AsString := cdsTodasLInhasFDDD.AsString;
cdsTodasLinhasSQlDs_Fone.AsString := cdsTodasLInhasFFone.AsString;
cdsTodasLinhasSQlDs_Nome.AsString := cdsTodasLInhasFNome.AsString;
cdsTodasLinhasSQlHr_Inicio.AsString := cdsTodasLInhasFInicio.AsString;
cdsTodasLinhasSQlHr_Fim.AsString := cdsTodasLInhasFFim.AsString;
cdsTodasLinhasSQlTempoTotal.AsString := cdsTodasLInhasFTempoTotal.AsString;
cdsTodasLinhasSQlFileRecord.AsString := cdsTodasLInhasFFileRecord.AsString;
cdsTodasLinhasSQlTipo.AsInteger := cdsTodasLInhasFTipo.AsInteger;
cdsTodasLinhasSQlId_Usuario.AsString := '1';
cdsTodasLinhasSQlFiltro.AsString := cdsTodasLInhasFFiltro.AsString;
cdsTodasLinhasSQlTipoCH.AsString := cdsTodasLInhasFTipoCH.AsString;
cdsTodasLinhasSQlOPR.AsString := cdsTodasLInhasFOPR.AsString;
cdsTodasLinhasf.Next;
cdsTodasLinhasSQl.Post;
end;
end;
Dmfirebird.cdsTodasLinhasSQl.ApplyUpdates(0);
Dmfirebird.dbAcessoFirebird.Commit(T);
except
Dmfirebird.dbAcessoFirebird.Rollback(T);
end;
Aparentemente esta tudo ok.
Att,
Wesley Y
Gostei + 0
15/07/2010
Carlos Faria
Gostei + 0
16/07/2010
Wesley Yamazack
Você ta usando um timer é isso ?
O timer vai disparar este evento a todo momento, e se tiverem 100 regisotrs na tabela, toda hora que ele passar no loop ele vai abrir a tabela novamente, isso não esta me parecendo correto, entendeu ?
Att,
Wesley Y
Gostei + 0
20/07/2010
Wesley Yamazack
Att,
Wesley Y
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)