| ---- | --------- | ---- | ---- |
| String | `S` | ASCII | |
| Integer | `I` | int64\_t | |
-| Double | `D` | double | |
+| Floating | `F` | double | |
| Logical | `L` | uint8\_t | 0 for false, other value for true |
| Help | `?` | ASCII | Should be just ignored |
entsize = strlen(fields[i]);
} else if(types[i] == DW_RECORD_INTEGER) {
entsize = 8;
- } else if(types[i] == DW_RECORD_DOUBLE) {
+ } else if(types[i] == DW_RECORD_FLOATING) {
entsize = sizeof(double);
} else if(types[i] == DW_RECORD_LOGICAL) {
entsize = 1;
/**
* @~english
- * @brief Double
+ * @brief Floating
*
*/
- DW_RECORD_DOUBLE = 'D',
+ DW_RECORD_FLOATING = 'F',
/**
* @~english
uint64_t mtime;
};
+/**
+ * @~english
+ * @brief Record value
+ *
+ */
+union dataworks_db_result_value {
+ /**
+ * @~english
+ * @brief Integer
+ *
+ */
+ int64_t integer;
+
+ /**
+ * @~english
+ * @brief Floating
+ *
+ */
+ double floating;
+
+ /**
+ * @~english
+ * @brief String
+ *
+ */
+ char* string;
+
+ /**
+ * @~english
+ * @brief Logical
+ *
+ */
+ uint8_t logical;
+
+ /**
+ * @~english
+ * @brief Help
+ *
+ */
+ char* help;
+};
+
+/**
+ * @~english
+ * @brief Database Record.
+ *
+ */
+struct dataworks_db_record {
+ /**
+ * @~english
+ * @brief Record value
+ *
+ */
+ union dataworks_db_result_value value;
+
+ /**
+ * @~english
+ * @brief Type. See DW_RECORD_TYPES.
+ *
+ */
+ char type;
+};
+
/**
* @~english
* @brief Creates the database.
/**
* @~english
+ * @brief Select the table.
* @param db Database
* @param table Table name
* @return Result
/**
* @~english
+ * @brief Get the table count.
* @param db Database
* @param table Table name
* @return Count
/**
* @~english
+ * @brief Set the table count.
* @param db Database
* @param table Table name
* @param count Count
if(val[k] == ':') {
val[k] = 0;
if(__dw_strcaseequ(val, "string")) {
- fieldtypes[argc] = 'S';
+ fieldtypes[argc] = DW_RECORD_STRING;
} else if(__dw_strcaseequ(val, "integer")) {
- fieldtypes[argc] = 'I';
- } else if(__dw_strcaseequ(val, "double")) {
- fieldtypes[argc] = 'D';
+ fieldtypes[argc] = DW_RECORD_INTEGER;
+ } else if(__dw_strcaseequ(val, "floating")) {
+ fieldtypes[argc] = DW_RECORD_FLOATING;
} else if(__dw_strcaseequ(val, "logical")) {
- fieldtypes[argc] = 'L';
+ fieldtypes[argc] = DW_RECORD_LOGICAL;
} else if(__dw_strcaseequ(val, "help")) {
- fieldtypes[argc] = '?';
+ fieldtypes[argc] = DW_RECORD_HELP;
}
fields[argc] = __dw_strdup(val + k + 1);
argc++;