The barcode database functions that will be described in this section can be used to handle all your barcode data in your application
Record size | Variable |
---|---|
Support of sorted and unsorted databases | Unsorted |
Availability of search functions | Yes |
Availability of sort functions | No |
Uses an Index file | Yes |
To be able to use the database functions, include the following header file and source file in your project.
Header file | memorize.h (source) |
---|---|
Source file | memorize.c (source) |
Low level database and indexing functions used by memorize.c
Header file | BarcodeDbase.h (source) |
---|---|
Source file | BarcodeDbase.c (source) |
Header file | INDEX.h (source) |
Source file | INDEX.c (source) |
NOTE: All functions return OK on success and ERROR on failure
The following functions can be used to create, open and close a database.
int InitStorage(int quantity_options) | Configures handling of duplicate barcodes on insertion and deleting using flags:
|
int OpenStorage(void) | Opens a database file and creates a new one if it doesn't exist. |
int CloseStorage(void) | Closes a database file that was opened |
int DeleteStorage(void) | Deletes the complete database (permanently!) |
The following functions return general properties and information of the current state of the database.
int BarcodesInMemory(void) | Gets the total number of records that are stored in the database. |
int UpdateBarcodeInMemory(struct barcode *pCode) | Stores, deletes, adds or removes the specified barcode with the given quantity. |
int DeleteCurrentBarcodeFromMemory(void) | Deletes the barcode that was last retrieved by 'ReadCurrentBarcodeFromMemory' or 'ReadNextBarcodeFromMemory'. |
int IsLastBarcodeInMemory(struct barcode *pCode) | Checks if the last barcode in memory matches the specified barcode. |
int FindFirstBarcodeInMemory(struct barcode *pCode) | Finds the first matching barcode in memory. |
int FindLastBarcodeInMemory(struct barcode *pCode) | Finds the last matching barcode in memory. |
int ReadCurrentBarcodeFromMemory(struct barcode *pCode) | Returns the first available (not-deleted) barcode from memory. |
int ReadNextBarcodeFromMemory(struct barcode *pCode) | Returns the next available (not-deleted) barcode from memory. |
int ReadFirstBarcodeFromMemory(struct barcode *pCode) | Returns the first (not-deleted) barcode in memory. |
int ReadLastBarcodeFromMemory(struct barcode *pCode) | Returns the last (not-deleted) barcode in memory. |