Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-09

FBAdmin

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

patspiper

A few questions regarding FBAdmin:

- Will FBAdmin be backported to 2.6.1?

- Will more functionality be added to it? In particular the setting of Forced Writes (I could perhaps supply a patch then).

Stephano

Reply by email

Ludo Brands
to patspiper
A few questions regarding FBAdmin: - Will FBAdmin be backported to 2.6.1?

I can't comment on that.

- Will more functionality be added to it? In particular the setting of Forced Writes (I could perhaps supply a patch then).

Not from my side. Purpose of TFBAdmin was to provide access to the "day-to-day" basic admin tasks such as backup/restore, user management. The API has many more options that are not basic admin actions and that require a minimum of knowledge and precaution. Making those available in a standard component is opening a can of worms.

The code itself is quite straightforward. Copy fbadmin to your project dir and add the following:

function TFBAdmin.SetForcedWrites(Database:string; ForcedWrites: boolean):
boolean;
var
  spb:string;
begin
  result:=CheckConnected('SetForcedWrites');
spb:=chr(isc_action_svc_properties)+IBSPBParamSerialize(isc_spb_dbname,Datab
ase)+
    chr(isc_spb_prp_write_mode);
  if ForcedWrites then
    spb:=spb+chr(isc_spb_prp_wm_sync)
  else
    spb:=spb+chr(isc_spb_prp_wm_async);
  result:=isc_service_start(@FStatus[0], @FSvcHandle, nil, length(spb),
    @spb[1])=0;
  if not result then
    begin
    CheckError('SetForcedWrites',FStatus);
    exit;
    end;
end;

Ludo

Reply by email

patspiper
to Ludo Brands
Ludo Brands wrote 15 lines
> A few questions regarding FBAdmin: > > - Will FBAdmin be backported to 2.6.1? > I can't comment on that. > - Will more functionality be added to it? In particular the > setting of > Forced Writes (I could perhaps supply a patch then). > Not from my side. Purpose of TFBAdmin was to provide access to the "day-to-day" basic admin tasks such as backup/restore, user management. The API has many more options that are not basic admin actions and that require a minimum of knowledge and precaution. Making those available in a standard component is opening a can of worms.

It is already quite a useful component as is. Since you are FBAdmin's author, and are knowledgeable in the service API, what do you recommend regarding the non basic admin actions? Forced Writes in particular is interesting as it might have to be turned off when pumping data for example.

Show quoted text 26 lines
The code itself is quite straightforward. Copy fbadmin to your project dir and add the following: function TFBAdmin.SetForcedWrites(Database:string; ForcedWrites: boolean): boolean; var spb:string; begin result:=CheckConnected('SetForcedWrites'); spb:=chr(isc_action_svc_properties)+IBSPBParamSerialize(isc_spb_dbname,Datab ase)+ chr(isc_spb_prp_write_mode); if ForcedWrites then spb:=spb+chr(isc_spb_prp_wm_sync) else spb:=spb+chr(isc_spb_prp_wm_async); result:=isc_service_start(@FStatus[0], @FSvcHandle, nil, length(spb), @spb[1])=0; if not result then begin CheckError('SetForcedWrites',FStatus); exit; end; end;

It is straight forward indeed. I had started writing similar code.

Thanks,
Stephano

Reply by email

Ludo Brands
to patspiper
Show quoted text 6 lines
It is already quite a useful component as is. Since you are FBAdmin's author, and are knowledgeable in the service API, what do you recommend regarding the non basic admin actions? Forced Writes in particular is interesting as it might have to be turned off when pumping data for example.

As said before IMHO forced writes doesn't belong in a component that comes standard with Lazarus. Google for Firebird forced writes off and you get as first page http://www.firebirdsql.org/manual/qsg2-safety.html chapter "how to corrupt a database". Forced Writes is a speed hack that turns off effectively the database integrity for the time of the operation. That is integrity in the largest sense. When something goes wrong, your complete database can become unusable. Unless you are writing a db admin tool or a very specialised tool, no business application should use this.

The category of repair actions as well are only useful for db admin tools. Perhaps setting the sweep interval or forcing a sweep could be something that is useful for non db admin applications. An automated sweep that starts when your app is in peak usage can be disturbing. But then again, a crontab that launches a nightly or weekend sweep will keep you away from that also.

Ludo

Reply by email

patspiper
to Ludo Brands
Ludo Brands wrote 13 lines
> It is already quite a useful component as is. Since you are FBAdmin's > author, and are knowledgeable in the service API, what do you > recommend > regarding the non basic admin actions? Forced Writes in particular is > interesting as it might have to be turned off when pumping > data for example. As said before IMHO forced writes doesn't belong in a component that comes standard with Lazarus. Google for Firebird forced writes off and you get as first page http://www.firebirdsql.org/manual/qsg2-safety.html chapter "how to corrupt a database". Forced Writes is a speed hack that turns off effectively the database integrity for the time of the operation. That is integrity in the largest sense. When something goes wrong, your complete database can become unusable.

+1

My question was more geared towards an extension to FBAdmin, or an entirely different component such as FBServices which is derived from FBAdmin.

Unless you are writing a db admin tool or a very specialised tool, no business application should use this.

A corner case which could benefit from Forced Writes off, almost risk free: Data is pumped into a freshly created FB database, report tables are created and populated, then used for reporting purposes. Then the whole thing is discarded.

Stephano

Reply by email