2022-06-30 13:23:48 +02:00
|
|
|
#include "sqlite3_query_builder.h"
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
#include "sqlite3_connection.h"
|
2022-06-30 13:23:48 +02:00
|
|
|
#include "sqlite3_database.h"
|
2024-04-27 18:23:31 +02:00
|
|
|
#include "sqlite3_prepared_statement.h"
|
2024-04-27 18:37:56 +02:00
|
|
|
#include "sqlite3_query_result.h"
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::select() {
|
|
|
|
query_result += "SELECT ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::update() {
|
|
|
|
query_result += "UPDATE ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::del() {
|
|
|
|
query_result += "DELETE FROM ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::cvalues() {
|
2022-12-20 23:54:50 +01:00
|
|
|
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
|
|
|
|
2024-04-27 18:54:12 +02:00
|
|
|
String qr = query_result.as_string();
|
|
|
|
|
|
|
|
qr[qr.length() - 2] = ' ';
|
|
|
|
|
|
|
|
query_result.clear();
|
|
|
|
query_result.append(qr);
|
2022-06-30 13:23:48 +02:00
|
|
|
query_result += ") ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::next_value() {
|
2022-12-20 23:54:50 +01:00
|
|
|
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
|
|
|
|
2024-04-27 18:54:12 +02:00
|
|
|
String qr = query_result.as_string();
|
|
|
|
|
|
|
|
qr[qr.length() - 2] = ' ';
|
|
|
|
|
|
|
|
query_result.clear();
|
|
|
|
query_result.append(qr);
|
2022-06-30 13:23:48 +02:00
|
|
|
query_result += "), (";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::begin_transaction() {
|
|
|
|
query_result += "BEGIN TRANSACTION;";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::commit() {
|
|
|
|
query_result += "COMMIT;";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::str() {
|
|
|
|
query_result += "'";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::cstr() {
|
|
|
|
query_result += "'";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::like(const String &str) {
|
2022-12-20 17:35:24 +01:00
|
|
|
if (str.empty()) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "LIKE ";
|
|
|
|
} else {
|
|
|
|
nlike(escape(str));
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::nselect(const String ¶ms) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "SELECT ";
|
|
|
|
query_result += params;
|
|
|
|
query_result += " ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::nupdate(const String ¶ms) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "UPDATE ";
|
|
|
|
query_result += params;
|
|
|
|
query_result += " ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::ndel(const String ¶ms) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "DELETE FROM ";
|
|
|
|
query_result += params;
|
|
|
|
query_result += " ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::nwhere(const String ¶ms) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "WHERE ";
|
|
|
|
|
2022-12-27 18:20:01 +01:00
|
|
|
if (!params.empty()) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += params;
|
|
|
|
query_result += " ";
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::nfrom(const String ¶ms) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "FROM ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
2022-12-27 18:20:01 +01:00
|
|
|
if (!params.empty()) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += params;
|
|
|
|
query_result += " ";
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-07-06 22:14:37 +02:00
|
|
|
|
2022-06-30 13:23:48 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::insert(const String &table_name, const String &columns) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "INSERT INTO ";
|
|
|
|
|
2022-12-27 18:20:01 +01:00
|
|
|
if (!table_name.empty()) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += table_name;
|
|
|
|
query_result += " ";
|
|
|
|
}
|
|
|
|
|
2022-12-27 18:20:01 +01:00
|
|
|
if (!columns.empty()) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "(";
|
|
|
|
query_result += columns;
|
|
|
|
query_result += ") ";
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::nvalues(const String ¶ms_str) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "VALUES(";
|
|
|
|
|
2022-12-27 18:20:01 +01:00
|
|
|
if (!params_str.empty()) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += params_str;
|
|
|
|
query_result += ") ";
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::val() {
|
|
|
|
//query_result += "DEFAULT, ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::nval(const String ¶m) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "'";
|
|
|
|
query_result += param;
|
|
|
|
query_result += "', ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::vals(const String ¶m) {
|
|
|
|
query_result += "'";
|
2022-12-20 17:35:24 +01:00
|
|
|
query_result += escape(param);
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "', ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::vals(const char *param) {
|
|
|
|
query_result += "'";
|
2022-12-20 17:35:24 +01:00
|
|
|
query_result += escape(String(param));
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "', ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
return this;
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::vali(const int param) {
|
|
|
|
query_result += itos(param);
|
|
|
|
query_result += ", ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::valb(const bool param) {
|
|
|
|
if (param) {
|
2022-06-30 13:23:48 +02:00
|
|
|
query_result += "1, ";
|
2022-07-06 22:14:37 +02:00
|
|
|
} else {
|
2022-06-30 13:23:48 +02:00
|
|
|
query_result += "0, ";
|
2022-07-06 22:14:37 +02:00
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::valf(const float param) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += String::num(param);
|
|
|
|
query_result += ", ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::vald(const double param) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += String::num(param);
|
|
|
|
query_result += ", ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2024-04-27 20:37:23 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::valph() {
|
|
|
|
psph();
|
|
|
|
query_result += ", ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::valphi(const String &p_id) {
|
|
|
|
psphi(p_id);
|
|
|
|
query_result += ", ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::valphr(const String &p_raw_id) {
|
|
|
|
psphi(p_raw_id);
|
|
|
|
query_result += ", ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::nlike(const String &str) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "LIKE '";
|
|
|
|
query_result += str;
|
|
|
|
query_result += "' ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::sets() {
|
2022-06-30 13:23:48 +02:00
|
|
|
query_result += "SET ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::cset() {
|
2022-12-20 23:54:50 +01:00
|
|
|
ERR_FAIL_COND_V(query_result.length() <= 2, this);
|
2024-04-27 18:23:31 +02:00
|
|
|
|
2024-04-27 18:54:12 +02:00
|
|
|
String qr = query_result.as_string();
|
|
|
|
|
|
|
|
qr[qr.length() - 2] = ' ';
|
|
|
|
|
|
|
|
query_result.clear();
|
|
|
|
query_result.append(qr);
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::nsetp(const String &col, const String ¶m) {
|
2022-12-18 13:17:58 +01:00
|
|
|
query_result += col;
|
|
|
|
query_result += "='";
|
|
|
|
query_result += param;
|
|
|
|
query_result += "', ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::setps(const String &col, const char *param) {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "='";
|
2022-12-20 17:35:24 +01:00
|
|
|
query_result += escape(String(param));
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "', ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::setpi(const String &col, const int param) {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "=";
|
|
|
|
query_result += itos(param);
|
|
|
|
query_result += ", ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::setpb(const String &col, const bool param) {
|
|
|
|
if (param) {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "=1, ";
|
|
|
|
} else {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "=0, ";
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::setpf(const String &col, const float param) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += col;
|
|
|
|
query_result += "=";
|
|
|
|
query_result += String::num(param);
|
|
|
|
query_result += ", ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::setpd(const String &col, const double param) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += col;
|
|
|
|
query_result += "=";
|
|
|
|
query_result += String::num(param);
|
|
|
|
query_result += ", ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2024-04-27 20:37:23 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::setph(const String &col) {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "=";
|
|
|
|
psph();
|
|
|
|
query_result += ", ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::setphi(const String &col, const String &p_id) {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "=";
|
|
|
|
psphi(p_id);
|
|
|
|
query_result += ", ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::setphr(const String &col, const String &p_raw_id) {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "=";
|
|
|
|
psphr(p_raw_id);
|
|
|
|
query_result += ", ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::nwp(const String &col, const String ¶m) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += col;
|
|
|
|
query_result += "='";
|
|
|
|
query_result += param;
|
|
|
|
query_result += "' ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::wps(const String &col, const char *param) {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "='";
|
2022-12-20 17:35:24 +01:00
|
|
|
query_result += escape(String(param));
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "' ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::wpi(const String &col, const int param) {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "=";
|
|
|
|
query_result += itos(param);
|
|
|
|
query_result += " ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-07-06 22:14:37 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::wpb(const String &col, const bool param) {
|
|
|
|
if (param) {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "=1 ";
|
|
|
|
} else {
|
|
|
|
query_result += col;
|
|
|
|
query_result += "=0 ";
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2024-04-27 20:37:23 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::wph(const String &col) {
|
|
|
|
query_result += col;
|
2024-04-27 21:00:28 +02:00
|
|
|
query_result += "=";
|
2024-04-27 20:37:23 +02:00
|
|
|
psph();
|
2024-04-27 21:00:28 +02:00
|
|
|
query_result += " ";
|
2024-04-27 20:37:23 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::wphi(const String &col, const String &p_id) {
|
|
|
|
query_result += col;
|
2024-04-27 21:00:28 +02:00
|
|
|
query_result += "=";
|
2024-04-27 20:37:23 +02:00
|
|
|
psphi(p_id);
|
2024-04-27 21:00:28 +02:00
|
|
|
query_result += " ";
|
2024-04-27 20:37:23 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::wphr(const String &col, const String &p_raw_id) {
|
|
|
|
query_result += col;
|
2024-04-27 21:00:28 +02:00
|
|
|
query_result += "=";
|
2024-04-27 20:37:23 +02:00
|
|
|
psphr(p_raw_id);
|
2024-04-27 21:00:28 +02:00
|
|
|
query_result += " ";
|
2024-04-27 20:37:23 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::limit(const int num) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "LIMIT ";
|
|
|
|
query_result += itos(num);
|
|
|
|
query_result += " ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::offset(const int num) {
|
2022-07-06 22:14:37 +02:00
|
|
|
query_result += "OFFSET ";
|
|
|
|
query_result += itos(num);
|
|
|
|
query_result += " ";
|
2022-06-30 13:23:48 +02:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::land() {
|
|
|
|
query_result += "AND ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::lor() {
|
|
|
|
query_result += "OR ";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::wildcard() {
|
|
|
|
query_result += "%";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2024-04-27 18:37:56 +02:00
|
|
|
// Prepared statement placeholders
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::psph() {
|
|
|
|
query_result += "?";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::psphi(const String &p_id) {
|
|
|
|
if (p_id.is_valid_unsigned_integer()) {
|
|
|
|
query_result += "?" + p_id;
|
|
|
|
} else {
|
|
|
|
query_result += ":" + p_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::psphr(const String &p_raw_id) {
|
|
|
|
query_result += p_raw_id;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2022-06-30 13:23:48 +02:00
|
|
|
String SQLite3QueryBuilder::escape(const String ¶ms) {
|
2022-12-20 17:35:24 +01:00
|
|
|
ERR_FAIL_COND_V(!_connection.is_valid(), String());
|
2022-06-30 13:23:48 +02:00
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
return _connection->escape(params);
|
2022-06-30 13:23:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QueryBuilder *SQLite3QueryBuilder::end_command() {
|
|
|
|
query_result += ";";
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<QueryResult> SQLite3QueryBuilder::run() {
|
2022-07-06 22:14:37 +02:00
|
|
|
if (!_connection.is_valid()) {
|
2022-06-30 13:23:48 +02:00
|
|
|
printf("SQLite3QueryBuilder::run !db!\n");
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
return _connection->query(query_result);
|
2022-06-30 13:23:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void SQLite3QueryBuilder::run_query() {
|
2022-07-06 22:14:37 +02:00
|
|
|
if (!_connection.is_valid()) {
|
2022-06-30 13:23:48 +02:00
|
|
|
printf("SQLite3QueryBuilder::run_query !db!\n");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-06 22:14:37 +02:00
|
|
|
_connection->query_run(query_result);
|
2022-06-30 13:23:48 +02:00
|
|
|
}
|
|
|
|
|
2024-04-27 18:23:31 +02:00
|
|
|
Ref<PreparedStatement> SQLite3QueryBuilder::create_prepared_statement() {
|
|
|
|
ERR_FAIL_COND_V(!_connection.is_valid(), Ref<PreparedStatement>());
|
|
|
|
|
2024-04-27 19:06:38 +02:00
|
|
|
Ref<PreparedStatement> stmt = _connection->create_prepared_statement();
|
|
|
|
|
|
|
|
if (stmt.is_valid()) {
|
|
|
|
stmt->set_sql(get_result());
|
|
|
|
}
|
|
|
|
|
|
|
|
return stmt;
|
2024-04-27 18:23:31 +02:00
|
|
|
}
|
|
|
|
|
2022-06-30 13:23:48 +02:00
|
|
|
QueryBuilder *SQLite3QueryBuilder::select_last_insert_id() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
SQLite3QueryBuilder::SQLite3QueryBuilder() {
|
|
|
|
}
|
|
|
|
SQLite3QueryBuilder::~SQLite3QueryBuilder() {
|
2022-07-06 22:14:37 +02:00
|
|
|
}
|