やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

SQLite3にHTTP要求する仮想テーブルモジュールが欲しい

 HTTP送受信をSQLで行う仮想テーブルモジュールがあったらいいな。

要望

 これはただの要望であり妄想。このように実装できるかどうかもわからない。

構文

select http('GET', 'https://...');
select http('POST', 'https://...', 'データ');
select http('HEAD', 'https://...');
select http('DELETE', 'https://...');
select http('PUT', 'https://...');
create table url_query_parameter(
  key   text,
  value text
);
create table http_headers(
  key   text,
  value text
);
create table http_request(
  id integer primary key,
  runed  text current_timestamp,
  method text,
  url    text,
  header text,
  cookie text
);
create table http_response(
  req_id integer references http_request(id),
  header text,
  code   integer,
  result text,    -- MIMEタイプがテキストなら
  result blob,    -- MIMEタイプがバイナリなら
);

対象環境

$ uname -a
Linux raspberrypi 4.19.42-v7+ #1218 SMP Tue May 14 00:48:17 BST 2019 armv7l GNU/Linux