RtvdbCreateVariable

RtvdbCreateVariable creates and opens a variable.

Syntax

Copy
DWORD RtvdbCreateVariable(
  [in]    RTVDB_DIRECTORY Parent,
  [out]   RTVDB_VARIABLE_CONTROL* pVariable,
  [in]    RTVDB_VARIABLE_DESCRIPTION Description
);

Parameters

[in] Parent

A handle of the parent directory. To retrieve the corresponding handle, use RtvdbOpenDirectory, RtvdbOpenDatabase, RtvdbCreateDirectory, or RtvdbCreateDatabase.

[out] pVariable

A pointer to store the created variable handle and value pointer. See RTVDB_VARIABLE_CONTROL.

[in] Description

The name and type of the variable to create. See RTVDB_VARIABLE_DESCRIPTION.

Return Values

Error code Meaning

ERROR_SUCCESS

The function succeeded.

ERROR_NOT_READY

One of the following conditions occurred:

  • The calling process has not called RtvdbInitialize.
  • The database is currently invalidated.

ERROR_INVALID_PARAMETER

One of the following conditions occurred:

  • Parameter Parent, or pVariable is NULL.
  • Description.Name is either empty or exceeds 63 characters in length.

ERROR_UNSUPPORTED_TYPE

One of the following conditions occurred:

  • Description.DataType is below VarBool or above VarDouble.
  • Description.DataType does not match the type of the variable in the parent directory.

ERROR_INVALID_HANDLE

Parameter Parent does not point to a directory or points to a closed directory.

ERROR_ALREADY_EXISTS

A variable with this name already exists in the parent directory.

ERROR_ABANDONED_WAIT_0

Failed to acquire the synchronization lock.

ERROR_NOT_ENOUGH_MEMORY

Failed to allocate memory.

Remarks

This function cannot create buffer variables. Use RtvdbCreateBufferVariable instead.

Requirements

Minimum supported version Header Library

wRTOS 1.0 SDK

RtvdbApi.h

RtvdbApi_W64.lib (Windows), RtvdbApi.lib (RTSS)

See Also: