61 #ifndef __ARASTORAGE_ARA_STORAGE_H 62 #define __ARASTORAGE_ARA_STORAGE_H 72 #define INVALID_TUPLE (tuple_id_t)-1 73 #define INVALID_CURSOR_VALUE -1 75 #define DB_ERROR(result_code) ((result_code) < DB_OK) 76 #define DB_SUCCESS(result_code) !DB_ERROR(result_code) 79 #define DB_INT_MAX INT_MAX 80 #define DB_INT_MIN INT_MIN + 1 82 #define DB_LONG_MAX LONG_MAX 83 #define DB_LONG_MIN LONG_MIN + 1 85 #ifdef CONFIG_HAVE_DOUBLE 86 #define DB_DOUBLE_MAX DBL_MAX 87 #define DB_DOUBLE_MIN DBL_MIN + 1 89 #define DB_DOUBLE_MAX FLT_MAX 90 #define DB_DOUBLE_MIN FLT_MIN + 1 94 #define DB_INT_ERROR INT_MIN 95 #define DB_LONG_ERROR LONG_MIN 96 #ifdef CONFIG_HAVE_DOUBLE 97 #define DB_DOUBLE_ERROR DBL_MIN 99 #define DB_DOUBLE_ERROR FLT_MIN 105 #define DB_FINISHED_MSG "Iteration finished" 106 #define DB_OK_MSG "Operation succeeded" 107 #define DB_LIMIT_ERROR_MSG "Limit reached" 108 #define DB_ALLOCATION_ERROR_MSG "Allocation error" 109 #define DB_STORAGE_ERROR_MSG "Storage error" 110 #define DB_PARSING_ERROR_MSG "Parsing error" 111 #define DB_NAME_ERROR_MSG "Invalid name" 112 #define DB_RELATIONAL_ERROR_MSG "Semantic error" 113 #define DB_TYPE_ERROR_MSG "Type error" 114 #define DB_IMPLEMENTATION_ERROR_MSG "Implementation error" 115 #define DB_INDEX_ERROR_MSG "Index error" 116 #define DB_BUSY_ERROR_MSG "Busy with processing" 117 #define DB_INCONSISTENCY_ERROR_MSG "Inconsistent handle" 118 #define DB_ARGUMENT_ERROR_MSG "Invalid argument" 119 #define DB_FULL_ERROR_MSG "Tuple limit reached" 120 #define DB_CURSOR_ERROR_MSG "Cursor Error" 121 #define DB_UNKNOWN_ERROR_MSG "Unknown result code" 122 #define DB_EMPTY_CURSOR_ERROR_MSG "Empty Cursor" 129 DB_ALLOCATION_ERROR = -2,
130 DB_STORAGE_ERROR = -3,
131 DB_PARSING_ERROR = -4,
133 DB_RELATIONAL_ERROR = -6,
135 DB_IMPLEMENTATION_ERROR = -8,
138 DB_INCONSISTENCY_ERROR = -11,
139 DB_ARGUMENT_ERROR = -12,
141 DB_CURSOR_ERROR = -14,
142 DB_EMPTY_CURSOR_ERROR = -15
145 typedef enum db_result_e db_result_t;
148 DOMAIN_UNSPECIFIED = 0,
155 typedef enum domain_e domain_t;
159 typedef struct _db_handle_s db_handle_t;
162 typedef struct _db_cursor_s db_cursor_t;
164 typedef int db_storage_id_t;
166 typedef uint32_t cursor_row_t;
168 typedef uint32_t tuple_id_t;
170 typedef uint8_t attribute_id_t;
175 typedef int (*db_output_function_t)(
const char *, ...);
177 static db_output_function_t output = printf;
209 db_result_t
db_exec(
char *format);
219 db_cursor_t *
db_query(
char *format);
319 db_result_t
cursor_move_to(db_cursor_t *cursor, tuple_id_t row_id);
416 #ifdef CONFIG_ARCH_FLOAT_H 426 double cursor_get_double_value(db_cursor_t *cursor,
int attr_index);
db_result_t db_print_header(db_cursor_t *cursor)
Print the related information : relation, attribute name.
bool cursor_is_last_row(db_cursor_t *cursor)
Check current position of cursor is last row.
db_result_t cursor_move_last(db_cursor_t *cursor)
Move current position of cursor to last row.
db_result_t cursor_move_prev(db_cursor_t *cursor)
Move current position of cursor to previous row.
cursor_row_t cursor_get_row(db_cursor_t *cursor)
Get current position of cursor.
db_result_t cursor_move_first(db_cursor_t *cursor)
Move current position of cursor to first row.
db_result_t db_cursor_free(db_cursor_t *cursor)
free allocated cursor data. This should be called before application terminated.
domain_t cursor_get_attr_type(db_cursor_t *cursor, int attr_index)
get type of attribute of specific index in cursor
db_result_t db_print_value(db_cursor_t *cursor, int attr_index)
print current row's data where specific index
db_result_t cursor_move_next(db_cursor_t *cursor)
Move current position of cursor to next row.
char * cursor_get_attr_name(db_cursor_t *cursor, int attr_index)
get name of attribute of specific index in cursor
const char * db_get_result_message(db_result_t code)
get string of each API's result based on value of db_result_t
db_result_t db_print_tuple(db_cursor_t *cursor)
Print the tuple data.
int cursor_get_int_value(db_cursor_t *cursor, int attr_index)
Get value of current row's data where specific index if it is integer type.
db_result_t db_init(void)
initialize database's resouces, it must be called when user arastorage
db_cursor_t * db_query(char *format)
Arastorage basic query API.
cursor_row_t cursor_get_count(db_cursor_t *cursor)
get count of total row of cursor
db_result_t db_exec(char *format)
Create Component of Arastorage.
attribute_id_t cursor_get_attr_index(db_cursor_t *cursor, const char *attr_name)
Find index number where using specific attribute name.
db_result_t db_deinit(void)
de-initialize database's resouces, it must be called when terminate arastorage.
unsigned char * cursor_get_string_value(db_cursor_t *cursor, int attr_index)
Get value of current row's data where specific index if it is string type.
db_result_t cursor_move_to(db_cursor_t *cursor, tuple_id_t row_id)
Move current position of cursor to specific row.
long cursor_get_long_value(db_cursor_t *cursor, int attr_index)
Get value of current row's data where specific index if it is long type.
bool cursor_is_first_row(db_cursor_t *cursor)
Check current position of cursor is first row.