vttp
An HTTP backed Virtual Table extension for SQLite
Loading...
Searching...
No Matches
sql.h
1#pragma once
2#include <stddef.h>
3#include <sqlite3.h>
4#include <yyjson.h>
5
6/* Owned declaration data. All strings use SQLite's allocator. */
7typedef enum { VT_UNKNOWN, VT_INTEGER, VT_REAL, VT_TEXT, VT_NUMERIC, VT_BLOB } vt_type;
8typedef struct {
9 char *key;
10 size_t index;
11 int is_index;
12} vt_step;
13typedef struct {
14 char *name;
15 char *type_name;
16 vt_type type;
17 char *path;
18 vt_step *steps;
19 size_t step_count;
20} vt_column;
21typedef struct { char *name, *value; } vt_header;
22typedef struct {
23 char *url;
24 vt_header *headers;
25 size_t header_count;
26 vt_column *columns;
27 size_t column_count;
28} vt_config;
29
30void vt_config_free(vt_config *cfg);
31int vt_parse(int argc, const char *const *argv, vt_config *cfg, char **error);
32int vt_add_column(vt_config *cfg, const char *name, const char *type,
33 const char *path, char **error);
34yyjson_val *vt_column_value(const vt_column *column, yyjson_val *row);
Definition fetch.h:15
Definition sql.h:13
Definition sql.h:22
Definition sql.h:21
Definition sql.h:8