Download API User Manual
Transcript
LinuxDA API User Manual //normal record LDAAddRecord(g_db_handle,&rec1,cate_index1,DB_SHOW_SECURITY)); //protected record LDAAddRecord(g_db_handle,&rec2,cate_index2,DB_RECORD_SECURITY); // set the database to protected mode LDASetDBSecurity(g_db_handle,DB_HIDE_SECURITY); LDASetDBCategory(g_db_handle,cate_index1); //There is one record in Personal catalog ,num1=1 num1=LDAGetRecordNumber(g_db_handle); LDASetDBCategory(g_db_handle,cate_index2); //There is one record in Business catalog. It is protected, so num2=0 num2=LDAGetRecordNumber(g_db_handle); //total is 2. There are two records. total=LDAGetTotalRecords(g_db_handle); LDACloseDB(g_db_handle,0); } } long LDAGetTotalRecords(DBHANDLE fdidx) Get the number of all record in the database whick handle is fdidx. Sample Code: see long LDAGetRecordNumber(DBHANDLE fdidx) int LDAAddRecord(DBHANDLE fdidx,void *data, char category, char property) Add a record to the database. data is the record pointer and usually it is a structure representing a record. category is the id of the category that this record belong to, and the property is the security property which can be DB_SHOW_SECURITY or DB_HIDE_SECURITY. If you set the record property as DB_HIDE_SECURITY, the record is encrypted to some extent, for you can no longer get the record by those functions such as LDAGetRecord() unless you have used the function LDASetDBSecurity(); CAUTION: All the records that we have added are SORTED by their first fields. If we add a new record, it is insert into the database by its first field and other records Ids may be changed. Sample Code: see long LDAGetRecordNumber(DBHANDLE fdidx) long LDAFindRecordByValue(DBHANDLE fdidx,void *data,void * CompareValue, char * category, char * property) Find the record by some value of one field in the database which handle is fdidx. Data is the found record if the function succeed. If failed , return the first record whose field is greater than the CompareValue . CAUTION: now we can only find a record by the first field. Sample Code: static void SearchRecord(void) 64