annotate deita/d_connection.c @ 279:b3b547563ec7

Add Google connector service and agent wiki Implement the C/Seobeo Google Drive and Gmail connector with encrypted OAuth storage, Zenbu authentication, browser testing, AI tool discovery, chunked HTTP decoding, and Bazel coverage. Consolidate repository guidance into progressive wiki documentation and enforce arena-first allocation for new first-party C code. Co-authored-by: Copilot <[email protected]> Copilot-Session: 84c338fd-0939-4bb3-b7f3-1062eb213e5d
author MrJuneJune <me@mrjunejune.com>
date Mon, 17 Aug 2026 22:22:36 -0700
parents ae6a88e6e484
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
75
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
1 #include "deita_internal.h"
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
2 #include <stdio.h>
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
3 #include <stdlib.h>
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
4
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
5 Deita_Connection* Deita_Connection_Create(
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
6 Deita_Database_Type database_type,
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
7 const char *connection_string)
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
8 {
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
9 if (database_type == DEITA_DATABASE_TYPE_SQLITE3)
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
10 return deita__sqlite_connection_create(connection_string);
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
11
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
12 fprintf(stderr, "Deita_Connection_Create: Unsupported database type %d\n", database_type);
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
13 return NULL;
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
14 }
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
15
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
16 void Deita_Connection_Close(Deita_Connection *p_connection)
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
17 {
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
18 if (!p_connection)
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
19 return;
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
20
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
21 if (p_connection->database_type == DEITA_DATABASE_TYPE_SQLITE3)
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
22 {
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
23 deita__sqlite_connection_close(p_connection);
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
24 return;
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
25 }
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
26
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
27 fprintf(stderr, "Deita_Connection_Close: Unsupported database type %d\n", p_connection->database_type);
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
28 }
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
29
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
30 boolean Deita_Connection_Is_Open(Deita_Connection *p_connection)
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
31 {
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
32 if (!p_connection)
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
33 return FALSE;
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
34
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
35 if (p_connection->database_type == DEITA_DATABASE_TYPE_SQLITE3)
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
36 return deita__sqlite_connection_is_open(p_connection);
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
37
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
38 fprintf(stderr, "Deita_Connection_Is_Open: Unsupported database type %d\n", p_connection->database_type);
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
39 return FALSE;
ae6a88e6e484 [Deita] Simple DB connection lib.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
40 }