2021-08-19 22:18:11 +02:00
|
|
|
#ifndef SQLITE3_QUERY_BUILDER_H
|
|
|
|
#define SQLITE3_QUERY_BUILDER_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
2022-02-05 15:57:40 +01:00
|
|
|
#include "database/query_builder.h"
|
2021-08-19 22:18:11 +02:00
|
|
|
|
|
|
|
class SQLite3Database;
|
|
|
|
|
|
|
|
class SQLite3QueryBuilder : public QueryBuilder {
|
2022-01-08 10:04:12 +01:00
|
|
|
RCPP_OBJECT(SQLite3QueryBuilder, QueryBuilder);
|
|
|
|
|
2021-08-19 22:18:11 +02:00
|
|
|
public:
|
|
|
|
QueryBuilder *select();
|
2021-11-01 17:00:55 +01:00
|
|
|
QueryBuilder *update();
|
2021-08-20 12:49:57 +02:00
|
|
|
QueryBuilder *del();
|
2021-08-20 12:11:27 +02:00
|
|
|
|
2021-08-20 12:49:57 +02:00
|
|
|
QueryBuilder *where();
|
2021-08-19 22:18:11 +02:00
|
|
|
QueryBuilder *from();
|
|
|
|
QueryBuilder *insert();
|
|
|
|
QueryBuilder *values();
|
|
|
|
QueryBuilder *cvalues();
|
2021-11-14 19:22:49 +01:00
|
|
|
QueryBuilder *next_value();
|
|
|
|
|
|
|
|
QueryBuilder *begin_transaction();
|
|
|
|
QueryBuilder *commit();
|
2021-08-19 22:18:11 +02:00
|
|
|
|
2021-08-22 21:44:20 +02:00
|
|
|
QueryBuilder *str();
|
|
|
|
QueryBuilder *cstr();
|
|
|
|
|
|
|
|
QueryBuilder *like();
|
|
|
|
|
2021-11-01 17:31:04 +01:00
|
|
|
QueryBuilder *nselect(const String ¶ms);
|
|
|
|
QueryBuilder *nupdate(const String ¶ms);
|
|
|
|
QueryBuilder *ndel(const String ¶ms);
|
|
|
|
|
|
|
|
QueryBuilder *nwhere(const String ¶ms);
|
|
|
|
QueryBuilder *nfrom(const String ¶ms);
|
|
|
|
QueryBuilder *insert(const String &table_name);
|
|
|
|
QueryBuilder *insert(const String &table_name, const String &columns);
|
|
|
|
QueryBuilder *nvalues(const String ¶ms_str);
|
2021-08-20 01:32:43 +02:00
|
|
|
QueryBuilder *val();
|
2021-11-01 17:31:04 +01:00
|
|
|
QueryBuilder *nval(const String ¶m);
|
2021-08-20 01:32:43 +02:00
|
|
|
QueryBuilder *val(const char *param);
|
|
|
|
QueryBuilder *val(const int param);
|
|
|
|
QueryBuilder *val(const bool param);
|
2021-11-14 21:04:48 +01:00
|
|
|
QueryBuilder *valf(const float param);
|
|
|
|
QueryBuilder *vald(const double param);
|
2021-08-19 22:18:11 +02:00
|
|
|
|
2021-11-01 17:31:04 +01:00
|
|
|
QueryBuilder *nlike(const String &str);
|
2021-08-22 21:44:20 +02:00
|
|
|
|
2021-08-20 12:11:27 +02:00
|
|
|
QueryBuilder *set();
|
|
|
|
QueryBuilder *cset();
|
2021-11-01 17:31:04 +01:00
|
|
|
QueryBuilder *nsetp(const String &col, const String ¶m);
|
|
|
|
QueryBuilder *setp(const String &col, const char *param);
|
|
|
|
QueryBuilder *setp(const String &col, const int param);
|
|
|
|
QueryBuilder *setp(const String &col, const bool param);
|
2021-11-14 21:04:48 +01:00
|
|
|
QueryBuilder *setpf(const String &col, const float param);
|
|
|
|
QueryBuilder *setpd(const String &col, const double param);
|
2021-08-20 12:11:27 +02:00
|
|
|
|
2021-11-01 17:31:04 +01:00
|
|
|
QueryBuilder *nwp(const String &col, const String ¶m);
|
|
|
|
QueryBuilder *wp(const String &col, const char *param);
|
|
|
|
QueryBuilder *wp(const String &col, const int param);
|
|
|
|
QueryBuilder *wp(const String &col, const bool param);
|
2021-08-20 12:49:57 +02:00
|
|
|
|
2021-08-19 22:18:11 +02:00
|
|
|
QueryBuilder *limit(const int num);
|
|
|
|
QueryBuilder *offset(const int num);
|
|
|
|
|
2021-08-20 13:14:06 +02:00
|
|
|
//l=logical (and, or are operators)
|
2021-08-22 21:44:20 +02:00
|
|
|
QueryBuilder *land();
|
|
|
|
QueryBuilder *lor();
|
|
|
|
|
|
|
|
QueryBuilder *wildcard();
|
2021-08-20 13:14:06 +02:00
|
|
|
|
2021-08-20 01:32:43 +02:00
|
|
|
QueryBuilder *select_last_insert_id();
|
|
|
|
|
2021-11-01 17:31:04 +01:00
|
|
|
String escape(const String ¶ms);
|
2021-08-19 22:18:11 +02:00
|
|
|
|
|
|
|
QueryBuilder *prepare();
|
2021-11-01 17:31:04 +01:00
|
|
|
QueryBuilder *set_param(const int index, const String &value);
|
2021-08-19 22:18:11 +02:00
|
|
|
QueryBuilder *set_param(const int index, const int value);
|
|
|
|
QueryBuilder *set_param(const int index, const float value);
|
|
|
|
|
2021-11-14 19:22:49 +01:00
|
|
|
QueryBuilder *end_command();
|
2021-08-19 22:18:11 +02:00
|
|
|
|
2021-11-01 16:57:22 +01:00
|
|
|
Ref<QueryResult> run();
|
2021-08-19 22:18:11 +02:00
|
|
|
void run_query();
|
|
|
|
|
|
|
|
SQLite3QueryBuilder();
|
|
|
|
~SQLite3QueryBuilder();
|
|
|
|
|
|
|
|
SQLite3Database *_db;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|