5#include "PAHGeometry.h"
7#include <mysql++/mysql++.h>
8#include <mysql++/ssqls.h>
10sql_create_18(sql_properties, 1, 0, mysqlpp::sql_int_unsigned, uid,
11 mysqlpp::sql_int_unsigned, n_h, mysqlpp::sql_int_unsigned, n_c,
12 mysqlpp::sql_int_unsigned, n_n, mysqlpp::sql_int_unsigned, n_o,
13 mysqlpp::sql_int_unsigned, n_mg, mysqlpp::sql_int_unsigned, n_si,
14 mysqlpp::sql_int_unsigned, n_fe, mysqlpp::sql_int, charge,
15 mysqlpp::sql_int_unsigned, n_solo, mysqlpp::sql_int_unsigned,
16 n_duo, mysqlpp::sql_int_unsigned, n_trio,
17 mysqlpp::sql_int_unsigned, n_quartet, mysqlpp::sql_int_unsigned,
18 n_quintet, mysqlpp::sql_int_unsigned, n_ch,
19 mysqlpp::sql_int_unsigned, n_ch2, mysqlpp::sql_int_unsigned,
20 n_ch3, mysqlpp::sql_int_unsigned, n_chx);
31 const char *pre[3] = {
"",
"exp_",
"anharmonic_"};
34 enum class Database :
char { Theory, Experiment, Anharmonic };
36 void connect(std::string_view database,
const std::string_view host,
37 std::string_view username,
const std::string_view password,
38 int port,
bool compress,
int timeout,
39 const std::string_view socket);
41 void setTable(Database table);
43 void setProgress(
double progress);
45 void setError(
const char *error);
47 std::vector<std::vector<std::pair<double, double>>>
48 getTransitionsFromUIDsAndVersion(
const std::vector<int> &uids,
int version);
50 std::vector<std::vector<std::pair<double, double>>>
51 getTransitionsFromUIDAndVersion(
int uid,
int version);
53 std::vector<std::vector<std::pair<double, double>>>
54 getTransitionsFromVersion(
int version, std::vector<int> &ids);
56 std::vector<std::vector<std::pair<double, double>>>
57 getTransitionsFromIds(
const std::vector<int> &ids);
59 std::vector<std::vector<std::pair<double, double>>>
60 getTransitionsFromId(
int id);
62 std::vector<std::vector<std::pair<double, double>>>
63 getExperimentalAndTheoreticalTransitionsFromId(
int id);
65 std::vector<PAHGeometry> getGeometriesFromIds(
const std::vector<int> &ids);
67 std::vector<sql_properties>
68 getPropertiesByUIDsAndVersion(
const std::vector<int> &uids,
int version);
70 std::vector<sql_properties> getPropertiesByIDs(
const std::vector<int> &ids);
72 std::vector<std::string> getFormulaeFromIds(
const std::vector<int> &ids);
75 mysqlpp::Connection _connection;
80inline void PAHdb::setTable(Database table) { _table = table; }
82inline std::vector<std::vector<std::pair<double, double>>>
83PAHdb::getTransitionsFromId(
int id) {
84 return (getTransitionsFromIds(std::vector<int>(1,
id)));
87inline std::vector<std::vector<std::pair<double, double>>>
88PAHdb::getTransitionsFromUIDAndVersion(
int uid,
int version) {
89 return (getTransitionsFromUIDsAndVersion(std::vector<int>(1, uid), version));