# EssGBeginLock

Description

EssGBeginLock() locks blocks at the database.

Syntax

    ESSG_FUNC_M EssGBeginLock (hGrid, ulOptions);

ESSG_HGRID_T | hGrid
ESSG_ULONG_T | ulOptions

Parameters

hGrid | Handle passed back from EssGNewGrid.
ulOptions | Reserved for future use. Should be set to zero.

Return Value

If successful, returns ESSG_STS_NOERR.

Notes

- Locks blocks at the database.
- This function is functionally identical to calling the EssGRetrieve function using ESSG_RET_LOCKONLY for the ulOptions parameter.
- Returns no data to the caller.
- You do not need to retrieve any rows for this operation. It is sufficient to call EssGSendRows and EssGPerformOperation.

Access

None.

Example

    ESSG_VOID_T ESSG_BeginLock (ESSG_HGRID_T hGrid)

    {
      ESSG_FUNC_M    sts = ESS_STS_NOERR;
      ESSG_PPDATA_T        ppDataIn;
      ESSG_RANGE_T         rDataRangeIn;
      ESSG_ULONG_T         ulOptions;

         /* connect the grid to a database on the server */
         sts = EssGConnect(hGrid, "Rainbow", "Admin",
               "Password", "Demo", "Basic",
               ESSG_CONNECT_DEFAULT);

      if(sts == 0)
      {
         ppDataIn = BuildTable(&rDataRangeIn);

         /* start the lock operation */
         ulOptions = 0;
         sts = EssGBeginLock(hGrid, ulOptions);
      }

      if(sts == 0)
      {
         /* send the entire grid to define the query */
         sts = EssGSendRows(hGrid, &rDataRangeIn,
               ppDataIn);
      }

      if(sts == 0)
      {
         /* perform the lock operation */
         sts = EssGPerformOperation(hGrid, 0);

         /* Free the built data */
         FreeTwoDim(ppDataIn, rDataRangeIn.ulNumRows);
      }

      if(!sts)
      {
         EssGEndOperation(hGrid, 0);
         EssGDisconnect(hGrid, 0);
      }
    }

See Also

Using the Grid API Functions
Grid API Structures