mf/subcommand_create.cpp

22 lines
552 B
C++
Raw Normal View History

2024-01-02 12:36:58 +00:00
#include "database.h"
#include "subcommands.h"
void subcommand_create(const Parser& parser) {
if (parser.arguments.size() != 1) {
fprintf(stderr, HELP_TEXT, parser.program_name);
exit(1);
}
Database db = Database::create_in_cwd();
Sqlite3Statement stmt(db.db, R"EOF(CREATE VIRTUAL TABLE IF NOT EXISTS memes USING fts4(
path TEXT PRIMARY KEY NOT NULL,
source TEXT NOT NULL,
description TEXT NOT NULL,
miscinfo TEXT NOT NULL,
matchinfo=fts3
))EOF");
db.db.exec(stmt);
}