home | |||
links |
|
||
developer's mag main page article part 1 part 2 part 3 part 4 part 5 part 6 part 7 part 8 |
6 - Record MovementsAdding data to an ebm database is a matter of copying strings into each field of a specified (new or old) record:
DBErr RecordAdd(const ebo_name_t *fileName,char**field) { CFMRecord record(&m_fMgr); DBErr error=record.New(); if ( DB_OK!=error ) return error; int totalField=m_fMgr.GetNumFields(); for (int fieldNo=0;fieldNo<totalField;fieldNo++) { // for each field, add the equivalent string from // the array passed in if (record.PutField(fieldNo,(U8*)field[fieldNo])) // failed? { GUI_NeedFileSpace( fileName ); // ask OS & retry if ( 0 != (error=record.PutField(fieldNo,(U8*)field[fieldNo])) ) return error; } } // see if we can add record, and deal with OS if not able to if ( DB_OUT_OF_MEMORY==record.Add() ) { GUI_NeedFileSpace( fileName ); error=record.Add(); if ( DB_OUT_OF_MEMORY==error ) return error; } return record.Close(); } Previous Section Next Section |
||
Copyright © 2001-2006 ebmDevMag.com - Legal Notice |