Subject | Re: TIB_Session + TIB_Connection + TIB_Transaction + TIB_Cursor + Thread |
---|---|
Author | |
Post date | 2015-08-17T22:25:36Z |
function TEmpresasController.pegaConexao: TIBODatabase;
var
Conexao: TIBODatabase;
begin
try
Conexao := TIBODatabase.CreateForSession(nil,pegaSecao);
Conexao.DatabaseName := Caminho('PATH=');
Conexao.Username := Caminho('USERNAME=');
Conexao.PassWord := Caminho('PASSWORD=');
Conexao.IB_Session := pegaSecao;
Conexao.Activate;
Result := Conexao;
except
on e: exception do gera_log(e.message);
end;
end;
function TEmpresasController.pegaTransacao: TIBOTransaction;
var
Transacao: TIBOTransaction;
begin
try
Transacao := TIBOTransaction.Create(nil);
Transacao.IB_Connection := pegaConexao;
Transacao.AutoCommit := True;
Transacao.Isolation := tiConcurrency;
Transacao.IB_Session := pegaSecao;
Transacao.Activate;
Result := Transacao;
except
on e: exception do gera_log(e.message);
end;
end;
function TEmpresasController.pegaSecao: TIB_Session;
var
Secao: TIB_Session;
begin
try
Secao := TIB_Session.Create(nil);
Result := Secao;
except
on e: exception do gera_log(e.message);
end;
end;
function TEmpresasController.Abre_Tabelas(F_SQL:String):TIBOQuery;
var
Query : TIBOQuery;
begin
Query := TIBOQuery.Create(nil);
Query.IB_Connection := pegaConexao;
Query.IB_Transaction := pegaTransacao;
Query.IB_Session := pegaSecao();
try
with Query do
begin
Close;
UnPrepare;
Sql.Clear;
Sql.Add(F_SQL);
Prepare;
Open;
end;
result := Query;
except
on e: exception do gera_log(e.message);
end;
end;
help please, report message: "transacion is not valid the current connection"
var
Conexao: TIBODatabase;
begin
try
Conexao := TIBODatabase.CreateForSession(nil,pegaSecao);
Conexao.DatabaseName := Caminho('PATH=');
Conexao.Username := Caminho('USERNAME=');
Conexao.PassWord := Caminho('PASSWORD=');
Conexao.IB_Session := pegaSecao;
Conexao.Activate;
Result := Conexao;
except
on e: exception do gera_log(e.message);
end;
end;
function TEmpresasController.pegaTransacao: TIBOTransaction;
var
Transacao: TIBOTransaction;
begin
try
Transacao := TIBOTransaction.Create(nil);
Transacao.IB_Connection := pegaConexao;
Transacao.AutoCommit := True;
Transacao.Isolation := tiConcurrency;
Transacao.IB_Session := pegaSecao;
Transacao.Activate;
Result := Transacao;
except
on e: exception do gera_log(e.message);
end;
end;
function TEmpresasController.pegaSecao: TIB_Session;
var
Secao: TIB_Session;
begin
try
Secao := TIB_Session.Create(nil);
Result := Secao;
except
on e: exception do gera_log(e.message);
end;
end;
function TEmpresasController.Abre_Tabelas(F_SQL:String):TIBOQuery;
var
Query : TIBOQuery;
begin
Query := TIBOQuery.Create(nil);
Query.IB_Connection := pegaConexao;
Query.IB_Transaction := pegaTransacao;
Query.IB_Session := pegaSecao();
try
with Query do
begin
Close;
UnPrepare;
Sql.Clear;
Sql.Add(F_SQL);
Prepare;
Open;
end;
result := Query;
except
on e: exception do gera_log(e.message);
end;
end;
help please, report message: "transacion is not valid the current connection"