PA_IsDataBaseLocked

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_IsDataBaseLocked char

ParameterTypeDescription
This command does not require any parameters
Function resultchar1 if the database is locked, otherwise 0

Description

The command PA_IsDataBaseLocked returns 1 if the database is locked, otherwise it returns 0.

A database is considered "locked" when the data file has is set as read-only or is on a locked volume. The database may be locked, for example, when running on a CD-ROM. It is important to check this flag to prevent your plug-in from modifying records in a locked database.

Example

Alert user at kInitEvent if the data is locked:


   void PluginMain( long selector, PA_PluginParameters params )
   {
      switch ( selector )
      {
         case kInitPlugin :
            if ( PA_IsDataBaseLocked() )
            {
               PA_Alert( "The data base is locked, the plug-in can't run" );
               gPluginIsRunning = false;
            }
            else
            {
               // enter initialization code here if needed/
               gPluginIsRunning = true;
            }
            break;
   
         case 1:
            if ( gPluginIsRunning )
               aRoutine( params );
            break;
      }
   }

See Also

No reference.

Error Handling

PA_GetLastError always returns eER_NoErr


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next