What are the consequences of leaving the system without closing the tables?

5

What are the consequences of Exiting / Closing of a system without closing the database tables? Does it detract from anything in the database?

Should I close the system tables or not?

procedure TfrmTelaPrincipal.EncerraSistema;
begin
  Beep;
  if Application.MessageBox('Deseja Realmente Encerrar o Sistema?','Pergunta',
                        MB_YESNO+MB_ICONQUESTION+MB_DEFBUTTON2) <> IDNO then
  begin
    ReciclarLixoDeSistema;
    DMGeral.tbParametros.Edit;
    DMGeral.tbParametrosNUMERO_ESTACOES_LOGADAS.AsInteger := DMGeral.tbParametrosNUMERO_ESTACOES_LOGADAS.AsInteger-1;
    DMGeral.tbParametros.Post;
    MinimizarClick(Self);
    frmTelaPrincipal.Close;
  end;
end;

I use the client / server structure and the database stays on the server and my connection component is FireDAC / p>     

asked by anonymous 10.10.2018 / 21:49

2 answers

2

It does not corrupt the bank, but if any operation stays active, it can leave the bank with lock, "locked" for other operations in the same table / registry.

This type of behavior varies from one database to another, so it is a good practice to deallocate resources, close connections through resource protection structures like try finally

    
11.10.2018 / 05:08
2

In the current system I am working on, the end user license is done through the transactional control between the application and the Firebird database.

That is, in this model, we know how many connections are currently active, so the application does not run if it exceeds the number of transactions, it is a cheap and simple way to do it.

So, in our case, transactional control is very important.

Each query we perform consists of an increase in the client process there on the server side, follows ...

DataSetCliente := 'SELECT NOME, CPF, FROM CLIENTES WHERE CODIGO > 2500'

Now that DataSetCliente is loaded with selected data, however, we did not fetchall , considering that we have 50,000 records in this table, the database does not immediately deliver the remaining 47,500 records, only one parcel of this.

In this case, the client process of this transaction stays in standby on the server side waiting to be requested more data, either through Next or Last .

We then destroy DataSetCliente at the end of its use:

DataSetCliente.Close; //Aqui ele interrompe a transação, mas não a finaliza
DataSetCliente.Free; //Agora liberamos a transação

The importance depends on the connection model you are using, but as commented, it is very important for the server side that this control exists.

It is important to note that in this scenario, we are using DelphiXe10.2 and the connection component is from Devrace, FibPlus.

    
16.10.2018 / 13:20