LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
fhicl-write-db.cc File Reference
#include <iostream>
#include "fhiclcpp/DatabaseSupport.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 8 of file fhicl-write-db.cc.

References fhicl::parse_file_and_fill_db().

9 {
10  if (argc != 3) {
11  cerr << argv[0] << ": two arguments required\n"
12  << "Usage: " << argv[0] << " fhicl-file database-file\n\n";
13  return 1;
14  }
15 
16  char const* fhiclfile = argv[1];
17  char const* dbname = argv[2];
18 
19  sqlite3* db = nullptr;
20 
21  int rc = sqlite3_open_v2(
22  dbname, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr);
23  if (rc != SQLITE_OK) {
24  cerr << argv[0] << ": unable to open SQLite3 file " << dbname << '\n';
25  return 2;
26  }
27 
28  fhicl::parse_file_and_fill_db(fhiclfile, db);
29  rc = sqlite3_close(db);
30  if (rc != SQLITE_OK) {
31  cerr << argv[0] << ": failure closing SQLite file " << dbname
32  << "; file may be corrupt\n";
33  return 3;
34  }
35 
36  return 0;
37 }
void parse_file_and_fill_db(std::string const &filename, sqlite3 *db)