2022-06-30 13:23:48 +02:00
|
|
|
#ifndef SQLITE3_QUERY_BUILDER_H
|
|
|
|
#define SQLITE3_QUERY_BUILDER_H
|
|
|
|
|
2022-08-17 14:19:55 +02:00
|
|
|
#include "core/string/ustring.h"
|
2022-06-30 13:23:48 +02:00
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
#include "../database/query_builder.h"
|
2022-06-30 13:23:48 +02:00
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
class SQLite3DatabaseConnection;
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
class SQLite3QueryBuilder : public QueryBuilder {
|
2022-07-06 22:14:37 +02:00
|
|
|
GDCLASS(SQLite3QueryBuilder, QueryBuilder);
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
QueryBuilder *select();
|
|
|
|
QueryBuilder *update();
|
|
|
|
QueryBuilder *del();
|
|
|
|
|
|
|
|
QueryBuilder *cvalues();
|
|
|
|
QueryBuilder *next_value();
|
|
|
|
|
|
|
|
QueryBuilder *begin_transaction();
|
|
|
|
QueryBuilder *commit();
|
|
|
|
|
|
|
|
QueryBuilder *str();
|
|
|
|
QueryBuilder *cstr();
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *like(const String &str = "");
|
2022-06-30 13:23:48 +02: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);
|
2022-07-06 22:14:37 +02:00
|
|
|
|
|
|
|
QueryBuilder *insert(const String &table_name = "", const String &columns = "");
|
2022-06-30 13:23:48 +02:00
|
|
|
QueryBuilder *nvalues(const String ¶ms_str);
|
|
|
|
QueryBuilder *val();
|
|
|
|
QueryBuilder *nval(const String ¶m);
|
2022-07-06 22:14:37 +02:00
|
|
|
|
|
|
|
QueryBuilder *vals(const String ¶m);
|
|
|
|
QueryBuilder *vals(const char *param);
|
|
|
|
QueryBuilder *vali(const int param);
|
|
|
|
QueryBuilder *valb(const bool param);
|
2022-06-30 13:23:48 +02:00
|
|
|
QueryBuilder *valf(const float param);
|
|
|
|
QueryBuilder *vald(const double param);
|
2024-04-27 20:37:23 +02:00
|
|
|
virtual QueryBuilder *valph();
|
|
|
|
virtual QueryBuilder *valphi(const String &p_id);
|
|
|
|
virtual QueryBuilder *valphr(const String &p_raw_id);
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
QueryBuilder *nlike(const String &str);
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *sets();
|
2022-06-30 13:23:48 +02:00
|
|
|
QueryBuilder *cset();
|
2022-07-06 22:14:37 +02:00
|
|
|
|
2022-06-30 13:23:48 +02:00
|
|
|
QueryBuilder *nsetp(const String &col, const String ¶m);
|
2022-07-06 22:14:37 +02:00
|
|
|
|
|
|
|
QueryBuilder *setps(const String &col, const char *param);
|
|
|
|
QueryBuilder *setpi(const String &col, const int param);
|
|
|
|
QueryBuilder *setpb(const String &col, const bool param);
|
2022-06-30 13:23:48 +02:00
|
|
|
QueryBuilder *setpf(const String &col, const float param);
|
|
|
|
QueryBuilder *setpd(const String &col, const double param);
|
2024-04-27 20:37:23 +02:00
|
|
|
virtual QueryBuilder *setph(const String &col);
|
|
|
|
virtual QueryBuilder *setphi(const String &col, const String &p_id);
|
|
|
|
virtual QueryBuilder *setphr(const String &col, const String &p_raw_id);
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
QueryBuilder *nwp(const String &col, const String ¶m);
|
2022-07-06 22:14:37 +02:00
|
|
|
|
|
|
|
QueryBuilder *wps(const String &col, const char *param);
|
|
|
|
QueryBuilder *wpi(const String &col, const int param);
|
|
|
|
QueryBuilder *wpb(const String &col, const bool param);
|
2024-04-27 20:37:23 +02:00
|
|
|
virtual QueryBuilder *wph(const String &col);
|
|
|
|
virtual QueryBuilder *wphi(const String &col, const String &p_id);
|
|
|
|
virtual QueryBuilder *wphr(const String &col, const String &p_raw_id);
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
QueryBuilder *limit(const int num);
|
|
|
|
QueryBuilder *offset(const int num);
|
|
|
|
|
|
|
|
//l=logical (and, or are operators)
|
|
|
|
QueryBuilder *land();
|
|
|
|
QueryBuilder *lor();
|
|
|
|
|
|
|
|
QueryBuilder *wildcard();
|
|
|
|
|
2024-04-27 18:37:56 +02:00
|
|
|
// Prepared statement placeholders
|
|
|
|
virtual QueryBuilder *psph();
|
|
|
|
virtual QueryBuilder *psphi(const String &p_id);
|
|
|
|
virtual QueryBuilder *psphr(const String &p_raw_id);
|
|
|
|
|
2022-06-30 13:23:48 +02:00
|
|
|
QueryBuilder *select_last_insert_id();
|
|
|
|
|
|
|
|
String escape(const String ¶ms);
|
|
|
|
|
|
|
|
QueryBuilder *end_command();
|
|
|
|
|
|
|
|
Ref<QueryResult> run();
|
|
|
|
void run_query();
|
|
|
|
|
2024-04-27 18:23:31 +02:00
|
|
|
Ref<PreparedStatement> create_prepared_statement();
|
|
|
|
|
2022-06-30 13:23:48 +02:00
|
|
|
SQLite3QueryBuilder();
|
|
|
|
~SQLite3QueryBuilder();
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
Ref<SQLite3DatabaseConnection> _connection;
|
2022-06-30 13:23:48 +02:00
|
|
|
};
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
#endif
|