60 typedef struct DB_Database* DB_Database_T;
70 typedef struct DB_Table *DB_Table_T;
80 typedef void *DB_Record_T;
85 typedef void* DB_Key_T;
95 typedef struct DB_Cursor *DB_Cursor_T;
105 typedef struct DB_Index *DB_Index_T;
112 #define URTDB_DATABASE_NAME_MAX_LENGTH 16
117 #define URTDB_TABLE_NAME_MAX_LENGTH 16
124 #define DB_TABLE_DEFAULT_INDEX 0
139 DB_RETCODE_BAD_PARAMETER,
155 DB_RETCODE_OUT_OF_RESOURCES,
161 DB_RETCODE_INVALIDATED_CURSOR,
177 DB_LOCK_LEVEL_NONE = 0,
182 DB_LOCK_LEVEL_SHARED = 1,
187 DB_LOCK_LEVEL_GLOBAL = 2
198 DB_SELECTOPCODE_EQUAL = 1,
203 DB_SELECTOPCODE_BETWEEN = 2,
208 DB_SELECTOPCODE_ALL = 3
219 struct DB_DatabaseProperty
224 RTI_SIZE_T max_tables;
229 DB_LockLevel_T lock_mode;
235 #define DB_DatabaseProperty_INITIALIZER \
244 #define DB_SELECT_OP2_AS_KEY (0x1)
249 #define DB_SELECT_OP3_AS_KEY (0x2)
254 #define DB_SELECT_OP2_IS_KEY(flags) (flags & DB_SELECT_OP2_AS_KEY)
259 #define DB_SELECT_OP3_IS_KEY(flags) (flags & DB_SELECT_OP3_AS_KEY)
279 FUNCTION_MUST_TYPEDEF(
281 (*DB_IndexCompare_T)(RTI_INT32 flags,
const DB_Record_T op1,
void *key)
292 struct DB_TableProperty
297 RTI_SIZE_T max_records;
302 RTI_SIZE_T max_indices;
308 RTI_SIZE_T max_cursors;
314 #define DB_TableProperty_INITIALIZER \
329 struct DB_IndexProperty
334 RTI_SIZE_T max_entries;
345 #define DB_IndexProperty_INITIALIZER \
369 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
370 DB_Database_create(DB_Database_T *db,
372 struct DB_DatabaseProperty *property,
395 SHOULD_CHECK_RETURN DBDllExport DB_ReturnCode_T
396 DB_Database_delete(DB_Database_T db);
419 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
420 DB_Database_lock(DB_Database_T db);
438 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
439 DB_Database_unlock(DB_Database_T db);
468 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
469 DB_Database_create_table(DB_Table_T *table,
472 RTI_SIZE_T record_size,
473 DB_IndexCompare_T compare_func,
474 struct DB_TableProperty *property);
476 #define DB_Database_create_table_type(t_,db_,name_,TYPE,prop_) \
477 DB_Database_create_table(t_,db_,name_,sizeof(TYPE),prop_)
496 SHOULD_CHECK_RETURN DBDllExport DB_ReturnCode_T
497 DB_Database_delete_table(DB_Database_T db,DB_Table_T table);
521 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
522 DB_Table_create_record(DB_Table_T table,DB_Record_T *record);
541 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
542 DB_Table_insert_record(DB_Table_T table, DB_Record_T record);
562 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
563 DB_Table_remove_record(DB_Table_T table,DB_Record_T *record,DB_Key_T key);
582 SHOULD_CHECK_RETURN DBDllExport DB_ReturnCode_T
583 DB_Table_delete_record(DB_Table_T table,DB_Record_T record);
609 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
610 DB_Table_create_index(DB_Table_T table,
612 DB_IndexCompare_T compare_func,
613 const struct DB_IndexProperty *
const property);
632 SHOULD_CHECK_RETURN DBDllExport DB_ReturnCode_T
633 DB_Table_delete_index(DB_Table_T table,DB_Index_T index);
659 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
660 DB_Table_select_all(DB_Table_T table,DB_Index_T index,DB_Cursor_T *cursor);
662 #define DB_Table_select_all_default(table_,eh_) \
663 DB_Table_select_all(table_,DB_TABLE_DEFAULT_INDEX,eh_)
686 SHOULD_CHECK_RETURN DBDllExport DB_ReturnCode_T
687 DB_Table_select_match(DB_Table_T table,DB_Index_T index,
688 DB_Record_T *record,DB_Key_T key);
710 SHOULD_CHECK_RETURN DBDllExport DB_ReturnCode_T
711 DB_Table_select_range(DB_Table_T table,DB_Index_T index,
713 DB_Key_T lower,DB_Key_T upper);
729 DBDllExport
const char*
730 DB_Table_get_name(DB_Table_T table);
744 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
745 DB_Cursor_get_count(DB_Cursor_T cursor,RTI_INT32 *count);
766 MUST_CHECK_RETURN DBDllExport DB_ReturnCode_T
767 DB_Cursor_get_next(DB_Cursor_T handle, DB_Record_T *record);
789 DB_Cursor_finish(DB_Table_T table,DB_Cursor_T cursor);