CPDB.Net

https://cpdb.ppcompiler.org/

4- Fields operations (CPDB library)



Introduction

In the current version, 4 types of fields are supported :



 

Read a string field

Use the following example :





Err err;
MemHandle handle;
Char *string;

err = CPDB_ReadString(mydbHandle, "FIELDNAME", &handle);
if (err == 0)
{
string = MemHandleLock(handle);
// Use the string now
// ...
// Free the string
MemHandleUnlock(handle);
MemHandleFree(handle);
}

Important : the CPDB_ReadString function allocate the memory for you, so you must free this memory after use.


 

Read a numeric field

Use the following example :


Short integer :


Int8 int8;
err = CPDB_ReadShortInt(hOREST, "FIELDNAME", &int8);

Integer :

Int16 int16;
err = CPDB_ReadInt(hOREST, "FIELDNAME", &int16);

Long integer :

Int32 int32;
err = CPDB_ReadLongInt(hOREST, "FIELDNAME", &int32);


 

More information

CPDB_ReadShortInt


CPDB_ReadInt


CPDB_ReadLongInt


CPDB_ReadString