Mercurial
comparison deita/deita.h @ 168:f3084bca7317
[Misc] Fixed all errors and all tests should pass now.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 19 Jan 2026 16:29:02 -0800 |
| parents | ae6a88e6e484 |
| children |
comparison
equal
deleted
inserted
replaced
| 167:589bab390fb4 | 168:f3084bca7317 |
|---|---|
| 1 #ifndef DEITA | 1 #ifndef DEITA |
| 2 #define DEITA | 2 #define DEITA |
| 3 | 3 |
| 4 #include "dowa/dowa.h" | 4 #include "dowa/dowa.h" |
| 5 | 5 |
| 6 // Database types | |
| 7 typedef enum | 6 typedef enum |
| 8 { | 7 { |
| 9 DEITA_DATABASE_TYPE_SQLITE3 = 0 | 8 DEITA_DATABASE_TYPE_SQLITE3 = 0 |
| 10 // Future: DEITA_DATABASE_TYPE_POSTGRES, DEITA_DATABASE_TYPE_MYSQL | 9 // TODO: DEITA_DATABASE_TYPE_POSTGRES, DEITA_DATABASE_TYPE_MYSQL |
| 11 } Deita_Database_Type; | 10 } Deita_Database_Type; |
| 12 | 11 |
| 13 // Connection handle (opaque) | |
| 14 typedef struct Deita_Connection Deita_Connection; | 12 typedef struct Deita_Connection Deita_Connection; |
| 15 | |
| 16 // Result set (opaque) | |
| 17 typedef struct Deita_Result_Set Deita_Result_Set; | 13 typedef struct Deita_Result_Set Deita_Result_Set; |
| 18 | 14 |
| 19 // Column value type | |
| 20 typedef enum | 15 typedef enum |
| 21 { | 16 { |
| 22 DEITA_COLUMN_TYPE_NULL = 0, | 17 DEITA_COLUMN_TYPE_NULL = 0, |
| 23 DEITA_COLUMN_TYPE_INTEGER, | 18 DEITA_COLUMN_TYPE_INTEGER, |
| 24 DEITA_COLUMN_TYPE_REAL, | 19 DEITA_COLUMN_TYPE_REAL, |
| 26 DEITA_COLUMN_TYPE_BLOB | 21 DEITA_COLUMN_TYPE_BLOB |
| 27 } Deita_Column_Type; | 22 } Deita_Column_Type; |
| 28 | 23 |
| 29 // --- Connection Management --- // | 24 // --- Connection Management --- // |
| 30 | 25 |
| 31 extern Deita_Connection* Deita_Connection_Create( | 26 extern Deita_Connection *Deita_Connection_Create(Deita_Database_Type database_type, const char *connection_string); |
| 32 Deita_Database_Type database_type, | 27 extern void Deita_Connection_Close(Deita_Connection *p_connection); |
| 33 const char *connection_string | 28 extern boolean Deita_Connection_Is_Open(Deita_Connection *p_connection); |
| 34 ); | |
| 35 | |
| 36 extern void Deita_Connection_Close(Deita_Connection *p_connection); | |
| 37 | |
| 38 extern boolean Deita_Connection_Is_Open(Deita_Connection *p_connection); | |
| 39 | 29 |
| 40 // --- Query Execution --- // | 30 // --- Query Execution --- // |
| 41 | 31 |
| 42 extern Deita_Result_Set* Deita_Query_Execute( | 32 extern Deita_Result_Set *Deita_Query_Execute( Deita_Connection *p_connection, const char *query, Dowa_Arena *p_arena); |
| 43 Deita_Connection *p_connection, | 33 extern Deita_Result_Set *Deita_Query_Execute_Prepared( Deita_Connection *p_connection, const char *query, int32 parameter_count, const char **parameter_values, Dowa_Arena *p_arena); |
| 44 const char *query, | 34 extern int32 Deita_Query_Execute_Update(Deita_Connection *p_connection, const char *query); |
| 45 Dowa_Arena *p_arena | 35 extern int32 Deita_Query_Execute_Update_Prepared(Deita_Connection *p_connection, const char *query, int32 parameter_count, const char **parameter_values); |
| 46 ); | |
| 47 | |
| 48 extern Deita_Result_Set* Deita_Query_Execute_Prepared( | |
| 49 Deita_Connection *p_connection, | |
| 50 const char *query, | |
| 51 int32 parameter_count, | |
| 52 const char **parameter_values, | |
| 53 Dowa_Arena *p_arena | |
| 54 ); | |
| 55 | |
| 56 extern int32 Deita_Query_Execute_Update( | |
| 57 Deita_Connection *p_connection, | |
| 58 const char *query | |
| 59 ); | |
| 60 | |
| 61 extern int32 Deita_Query_Execute_Update_Prepared( | |
| 62 Deita_Connection *p_connection, | |
| 63 const char *query, | |
| 64 int32 parameter_count, | |
| 65 const char **parameter_values | |
| 66 ); | |
| 67 | 36 |
| 68 // --- Result Set Access --- // | 37 // --- Result Set Access --- // |
| 69 | 38 |
| 70 extern boolean Deita_Result_Set_Next(Deita_Result_Set *p_result_set); | 39 extern boolean Deita_Result_Set_Next(Deita_Result_Set *p_result_set); |
| 71 | 40 extern int32 Deita_Result_Set_Get_Column_Count(Deita_Result_Set *p_result_set); |
| 72 extern int32 Deita_Result_Set_Get_Column_Count(Deita_Result_Set *p_result_set); | 41 extern const char *Deita_Result_Set_Get_Column_Name(Deita_Result_Set *p_result_set, int32 column_index); |
| 73 | 42 extern Deita_Column_Type Deita_Result_Set_Get_Column_Type(Deita_Result_Set *p_result_set, int32 column_index); |
| 74 extern const char* Deita_Result_Set_Get_Column_Name( | 43 extern const char *Deita_Result_Set_Get_Text(Deita_Result_Set *p_result_set, int32 column_index); |
| 75 Deita_Result_Set *p_result_set, | 44 extern int64 Deita_Result_Set_Get_Integer(Deita_Result_Set *p_result_set, int32 column_index); |
| 76 int32 column_index | 45 extern double Deita_Result_Set_Get_Real(Deita_Result_Set *p_result_set, int32 column_index ); |
| 77 ); | 46 extern void Deita_Result_Set_Free(Deita_Result_Set *p_result_set); |
| 78 | |
| 79 extern Deita_Column_Type Deita_Result_Set_Get_Column_Type( | |
| 80 Deita_Result_Set *p_result_set, | |
| 81 int32 column_index | |
| 82 ); | |
| 83 | |
| 84 extern const char* Deita_Result_Set_Get_Text( | |
| 85 Deita_Result_Set *p_result_set, | |
| 86 int32 column_index | |
| 87 ); | |
| 88 | |
| 89 extern int64 Deita_Result_Set_Get_Integer( | |
| 90 Deita_Result_Set *p_result_set, | |
| 91 int32 column_index | |
| 92 ); | |
| 93 | |
| 94 extern double Deita_Result_Set_Get_Real( | |
| 95 Deita_Result_Set *p_result_set, | |
| 96 int32 column_index | |
| 97 ); | |
| 98 | |
| 99 extern void Deita_Result_Set_Free(Deita_Result_Set *p_result_set); | |
| 100 | 47 |
| 101 #endif | 48 #endif |