harmony 鸿蒙oh_data_value.h

  • 2025-06-12
  • 浏览 (4)

oh_data_value.h

Overview

Defines APIs and enums related to a single data value.

Since API version 18, OH_ColumnType is moved from oh_cursor.h to this file. This type is supported in versions earlier than API version 18 and can be used in all versions.

File to include: <database/data/oh_data_value.h>

Library: libnative_rdb_ndk.z.so

System capability: SystemCapability.DistributedDataManager.RelationalStore.Core

Since: 18

Related module: RDB

Summary

Types

Name Description
typedef enum OH_ColumnType OH_ColumnType Defines an enum for column types.
typedef struct OH_Data_Value OH_Data_Value Defines the OH_Data_Value struct.

Enums

Name Description
OH_ColumnType {
TYPE_NULL = 0, TYPE_INT64, TYPE_REAL, TYPE_TEXT,
TYPE_BLOB, TYPE_ASSET, TYPE_ASSETS, TYPE_FLOAT_VECTOR,
TYPE_UNLIMITED_INT
}
Enumerates the column types.

Functions

Name Description
OH_Data_Value * OH_Value_Create (void) Creates an OH_Data_Value instance to store a single KV pair.
int OH_Value_Destroy (OH_Data_Value *value) Destroys an OH_Data_Value instance.
int OH_Value_PutNull (OH_Data_Value *value) Adds empty data.
int OH_Value_PutInt (OH_Data_Value *value, int64_t val) Adds integer data.
int OH_Value_PutReal (OH_Data_Value *value, double val) Adds data of the REAL type.
int OH_Value_PutText (OH_Data_Value *value, const char *val) Adds data of the string type.
int OH_Value_PutBlob (OH_Data_Value *value, const unsigned char *val, size_t length) Adds data of the BLOB type.
int OH_Value_PutAsset (OH_Data_Value *value, const Data_Asset *val) Adds data of the ASSET type.
int OH_Value_PutAssets (OH_Data_Value *value, const Data_Asset *const *val, size_t length) Adds data of the ASSETS type.
int OH_Value_PutFloatVector (OH_Data_Value *value, const float *val, size_t length) Adds data of the floating-point array type.
int OH_Value_PutUnlimitedInt (OH_Data_Value *value, int sign, const uint64_t *trueForm, size_t length) Adds an integer array of any length.
int OH_Value_GetType (OH_Data_Value *value, OH_ColumnType *type) Obtains the data type.
int OH_Value_IsNull (OH_Data_Value *value, bool *val) Checks whether a value is null.
int OH_Value_GetInt (OH_Data_Value *value, int64_t *val) Obtains integer data.
int OH_Value_GetReal (OH_Data_Value *value, double *val) Obtains data of the REAL type.
int OH_Value_GetText (OH_Data_Value *value, const char **val) Obtains data of the string type.
int OH_Value_GetBlob (OH_Data_Value *value, const uint8_t **val, size_t *length) Obtains data of the BLOB type.
int OH_Value_GetAsset (OH_Data_Value *value, Data_Asset *val) Obtains data of the ASSET type.
int OH_Value_GetAssetsCount (OH_Data_Value *value, size_t *length) Obtains the length of ASSETS data.
int OH_Value_GetAssets (OH_Data_Value *value, Data_Asset **val, size_t inLen, size_t *outLen) Obtains data of the ASSETS type.
int OH_Value_GetFloatVectorCount (OH_Data_Value *value, size_t *length) Obtains the length of a floating-point array.
int OH_Value_GetFloatVector (OH_Data_Value *value, float *val, size_t inLen, size_t *outLen) Obtains data of the floating-point array type.
int OH_Value_GetUnlimitedIntBand (OH_Data_Value *value, size_t *length) Obtains the length of an integer of any length.
int OH_Value_GetUnlimitedInt (OH_Data_Value *value, int *sign, uint64_t *trueForm, size_t inLen, size_t *outLen) Obtains integer data of any length.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkData (ArkData Management)

harmony 鸿蒙Data

harmony 鸿蒙OH_Cursor

harmony 鸿蒙OH_Predicates

harmony 鸿蒙OH_Rdb_Config

harmony 鸿蒙OH_Rdb_Store

harmony 鸿蒙OH_VBucket

harmony 鸿蒙OH_VObject

harmony 鸿蒙Preferences

harmony 鸿蒙_r_d_b

0  赞