Squashed commit of the following:
commit e48c78765ca1e2e5a68fd93bac7191eaf6918352 Author: Jordan Sherer <jordan@widefido.com> Date: Wed Jan 2 12:23:28 2019 -0500 Transition to persistent inbox for later retrieval Fixed issue with inbox items disappearing due to aging. commit 1df07595bf6507438c1488839f7a2075a432a1a1 Author: Jordan Sherer <jordan@widefido.com> Date: Wed Jan 2 09:23:28 2019 -0500 Filtered value and count queries for the inbox commit c93a93a1c43a65fae4a31ddeb40c77c53204bbdb Author: Jordan Sherer <jordan@widefido.com> Date: Tue Jan 1 22:58:07 2019 -0500 Initial cut of inbox storage
This commit is contained in:
parent
0405dba3fc
commit
bdfc1cff8e
@ -178,6 +178,7 @@ set (wsjt_qt_CXXSRCS
|
|||||||
HRDTransceiver.cpp
|
HRDTransceiver.cpp
|
||||||
DXLabSuiteCommanderTransceiver.cpp
|
DXLabSuiteCommanderTransceiver.cpp
|
||||||
NetworkMessage.cpp
|
NetworkMessage.cpp
|
||||||
|
Message.cpp
|
||||||
MessageClient.cpp
|
MessageClient.cpp
|
||||||
LettersSpinBox.cpp
|
LettersSpinBox.cpp
|
||||||
HintedSpinBox.cpp
|
HintedSpinBox.cpp
|
||||||
@ -242,6 +243,7 @@ set (wsjtx_CXXSRCS
|
|||||||
messagereplydialog.cpp
|
messagereplydialog.cpp
|
||||||
keyeater.cpp
|
keyeater.cpp
|
||||||
APRSISClient.cpp
|
APRSISClient.cpp
|
||||||
|
Inbox.cpp
|
||||||
mainwindow.cpp
|
mainwindow.cpp
|
||||||
Configuration.cpp
|
Configuration.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
@ -550,6 +552,10 @@ set (qra_CSRCS
|
|||||||
lib/qra/qracodes/normrnd.c
|
lib/qra/qracodes/normrnd.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set (sqlite3_CSRCS
|
||||||
|
vendor/sqlite3/sqlite3.c
|
||||||
|
)
|
||||||
|
|
||||||
set (wsjt_CSRCS
|
set (wsjt_CSRCS
|
||||||
${ka9q_CSRCS}
|
${ka9q_CSRCS}
|
||||||
lib/ftrsd/ftrsdap.c
|
lib/ftrsd/ftrsdap.c
|
||||||
@ -621,6 +627,7 @@ set (all_CXXSRCS
|
|||||||
)
|
)
|
||||||
|
|
||||||
set (all_C_and_CXXSRCS
|
set (all_C_and_CXXSRCS
|
||||||
|
${sqlite3_CSRCS}
|
||||||
${wsjt_CSRCS}
|
${wsjt_CSRCS}
|
||||||
${wsprsim_CSRCS}
|
${wsprsim_CSRCS}
|
||||||
${wsprd_CSRCS}
|
${wsprd_CSRCS}
|
||||||
@ -1112,6 +1119,7 @@ endif (${OPENMP_FOUND} OR APPLE)
|
|||||||
|
|
||||||
# build the main application
|
# build the main application
|
||||||
add_executable (js8call MACOSX_BUNDLE
|
add_executable (js8call MACOSX_BUNDLE
|
||||||
|
${sqlite3_CSRCS}
|
||||||
${wsjtx_CXXSRCS}
|
${wsjtx_CXXSRCS}
|
||||||
${wsjtx_GENUISRCS}
|
${wsjtx_GENUISRCS}
|
||||||
wsjtx.rc
|
wsjtx.rc
|
||||||
|
311
Inbox.cpp
Normal file
311
Inbox.cpp
Normal file
@ -0,0 +1,311 @@
|
|||||||
|
/**
|
||||||
|
* This file is part of JS8Call.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* (C) 2018 Jordan Sherer <kn4crd@gmail.com> - All Rights Reserved
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "Inbox.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
|
const char* SCHEMA = "CREATE TABLE IF NOT EXISTS inbox_v1 ("
|
||||||
|
" id INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||||
|
" blob TEXT"
|
||||||
|
");"
|
||||||
|
"CREATE INDEX IF NOT EXISTS idx_inbox_v1__type ON"
|
||||||
|
" inbox_v1(json_extract(blob, '$.type'));"
|
||||||
|
"CREATE INDEX IF NOT EXISTS idx_inbox_v1__params_from ON"
|
||||||
|
" inbox_v1(json_extract(blob, '$.params.FROM'));"
|
||||||
|
"CREATE INDEX IF NOT EXISTS idx_inbox_v1__params_to ON"
|
||||||
|
" inbox_v1(json_extract(blob, '$.params.TO'))";
|
||||||
|
|
||||||
|
Inbox::Inbox(QString path) :
|
||||||
|
path_{ path },
|
||||||
|
db_{ nullptr }
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Inbox::~Inbox(){
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Low-Level Interface
|
||||||
|
**/
|
||||||
|
|
||||||
|
bool Inbox::isOpen(){
|
||||||
|
return db_ != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Inbox::open(){
|
||||||
|
int rc = sqlite3_open(path_.toLocal8Bit().data(), &db_);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = sqlite3_exec(db_, SCHEMA, nullptr, nullptr, nullptr);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inbox::close(){
|
||||||
|
if(db_){
|
||||||
|
sqlite3_close(db_);
|
||||||
|
db_ = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Inbox::error(){
|
||||||
|
if(db_){
|
||||||
|
return QString::fromLocal8Bit(sqlite3_errmsg(db_));
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
int Inbox::count(QString type, QString query, QString match){
|
||||||
|
if(!isOpen()){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* sql = "SELECT COUNT(*) FROM inbox_v1 "
|
||||||
|
"WHERE json_extract(blob, '$.type') = ? "
|
||||||
|
"AND json_extract(blob, ?) LIKE ?;";
|
||||||
|
|
||||||
|
sqlite3_stmt *stmt;
|
||||||
|
int rc = sqlite3_prepare_v2(db_, sql, -1, &stmt, nullptr);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto t8 = type.toLocal8Bit();
|
||||||
|
auto q8 = query.toLocal8Bit();
|
||||||
|
auto m8 = match.toLocal8Bit();
|
||||||
|
rc = sqlite3_bind_text(stmt, 1, t8.data(), -1, nullptr);
|
||||||
|
rc = sqlite3_bind_text(stmt, 2, q8.data(), -1, nullptr);
|
||||||
|
rc = sqlite3_bind_text(stmt, 3, m8.data(), -1, nullptr);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
rc = sqlite3_step(stmt);
|
||||||
|
if(rc == SQLITE_ROW) {
|
||||||
|
count = sqlite3_column_int(stmt, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = sqlite3_finalize(stmt);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QPair<int, Message> > Inbox::values(QString type, QString query, QString match, int offset, int limit){
|
||||||
|
if(!isOpen()){
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* sql = "SELECT id, blob FROM inbox_v1 "
|
||||||
|
"WHERE json_extract(blob, '$.type') = ? "
|
||||||
|
"AND json_extract(blob, ?) LIKE ? "
|
||||||
|
"ORDER BY id ASC "
|
||||||
|
"LIMIT ? OFFSET ?;";
|
||||||
|
|
||||||
|
sqlite3_stmt *stmt;
|
||||||
|
int rc = sqlite3_prepare_v2(db_, sql, -1, &stmt, nullptr);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto t8 = type.toLocal8Bit();
|
||||||
|
auto q8 = query.toLocal8Bit();
|
||||||
|
auto m8 = match.toLocal8Bit();
|
||||||
|
rc = sqlite3_bind_text(stmt, 1, t8.data(), -1, nullptr);
|
||||||
|
rc = sqlite3_bind_text(stmt, 2, q8.data(), -1, nullptr);
|
||||||
|
rc = sqlite3_bind_text(stmt, 3, m8.data(), -1, nullptr);
|
||||||
|
rc = sqlite3_bind_int(stmt, 4, limit);
|
||||||
|
rc = sqlite3_bind_int(stmt, 5, offset);
|
||||||
|
|
||||||
|
qDebug() << "exec" << sqlite3_expanded_sql(stmt);
|
||||||
|
|
||||||
|
QList<QPair<int, Message>> v;
|
||||||
|
|
||||||
|
while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
|
||||||
|
Message m;
|
||||||
|
|
||||||
|
int i = sqlite3_column_int(stmt, 0);
|
||||||
|
|
||||||
|
auto msg = QByteArray((const char*)sqlite3_column_text(stmt, 1), sqlite3_column_bytes(stmt, 1));
|
||||||
|
|
||||||
|
QJsonParseError e;
|
||||||
|
QJsonDocument d = QJsonDocument::fromJson(msg, &e);
|
||||||
|
if(e.error != QJsonParseError::NoError){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!d.isObject()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m.read(d.object());
|
||||||
|
v.append({ i, m });
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = sqlite3_finalize(stmt);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
Message Inbox::value(int key){
|
||||||
|
if(!isOpen()){
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* sql = "SELECT blob FROM inbox_v1 WHERE id = ? LIMIT 1;";
|
||||||
|
|
||||||
|
sqlite3_stmt *stmt;
|
||||||
|
int rc = sqlite3_prepare_v2(db_, sql, -1, &stmt, nullptr);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = sqlite3_bind_int(stmt, 1, key);
|
||||||
|
|
||||||
|
Message m;
|
||||||
|
while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
|
||||||
|
auto msg = QByteArray((const char*)sqlite3_column_text(stmt, 0), sqlite3_column_bytes(stmt, 0));
|
||||||
|
|
||||||
|
QJsonParseError e;
|
||||||
|
QJsonDocument d = QJsonDocument::fromJson(msg, &e);
|
||||||
|
if(e.error != QJsonParseError::NoError){
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!d.isObject()){
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
m.read(d.object());
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = sqlite3_finalize(stmt);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Inbox::append(Message value){
|
||||||
|
if(!isOpen()){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* sql = "INSERT INTO inbox_v1 (blob) VALUES (?);";
|
||||||
|
|
||||||
|
sqlite3_stmt *stmt;
|
||||||
|
int rc = sqlite3_prepare_v2(db_, sql, -1, &stmt, nullptr);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto j8 = value.toJson();
|
||||||
|
rc = sqlite3_bind_text(stmt, 1, j8.data(), -1, nullptr);
|
||||||
|
rc = sqlite3_step(stmt);
|
||||||
|
|
||||||
|
rc = sqlite3_finalize(stmt);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sqlite3_last_insert_rowid(db_);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Inbox::set(int key, Message value){
|
||||||
|
if(!isOpen()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* sql = "UPDATE inbox_v1 SET blob = ? WHERE id = ?;";
|
||||||
|
|
||||||
|
sqlite3_stmt *stmt;
|
||||||
|
int rc = sqlite3_prepare_v2(db_, sql, -1, &stmt, nullptr);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto j8 = value.toJson();
|
||||||
|
rc = sqlite3_bind_text(stmt, 1, j8.data(), -1, nullptr);
|
||||||
|
rc = sqlite3_bind_int(stmt, 2, key);
|
||||||
|
|
||||||
|
rc = sqlite3_step(stmt);
|
||||||
|
|
||||||
|
rc = sqlite3_finalize(stmt);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Inbox::del(int key){
|
||||||
|
if(!isOpen()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* sql = "DELETE FROM inbox_v1 WHERE id = ?;";
|
||||||
|
|
||||||
|
sqlite3_stmt *stmt;
|
||||||
|
int rc = sqlite3_prepare_v2(db_, sql, -1, &stmt, nullptr);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = sqlite3_bind_int(stmt, 1, key);
|
||||||
|
rc = sqlite3_step(stmt);
|
||||||
|
|
||||||
|
rc = sqlite3_finalize(stmt);
|
||||||
|
if(rc != SQLITE_OK){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* High-Level Interface
|
||||||
|
**/
|
||||||
|
|
||||||
|
int Inbox::countUnreadFrom(QString from){
|
||||||
|
return count("UNREAD", "$.params.FROM", from);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPair<int, Message> Inbox::firstUnreadFrom(QString from){
|
||||||
|
auto v = values("UNREAD", "$.params.FROM", from, 0, 1);
|
||||||
|
if(v.isEmpty()){
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return v.first();
|
||||||
|
}
|
||||||
|
|
49
Inbox.h
Normal file
49
Inbox.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef INBOX_H
|
||||||
|
#define INBOX_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (C) 2018 Jordan Sherer <kn4crd@gmail.com> - All Rights Reserved
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <QPair>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
#include "vendor/sqlite3/sqlite3.h"
|
||||||
|
|
||||||
|
#include "Message.h"
|
||||||
|
|
||||||
|
|
||||||
|
class Inbox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit Inbox(QString path);
|
||||||
|
~Inbox();
|
||||||
|
|
||||||
|
// Low-Level Interface
|
||||||
|
bool isOpen();
|
||||||
|
bool open();
|
||||||
|
void close();
|
||||||
|
QString error();
|
||||||
|
int count(QString type, QString query, QString match);
|
||||||
|
QList<QPair<int, Message>> values(QString type, QString query, QString match, int offset, int limit);
|
||||||
|
Message value(int key);
|
||||||
|
int append(Message value);
|
||||||
|
bool set(int key, Message value);
|
||||||
|
bool del(int key);
|
||||||
|
|
||||||
|
// High-Level Interface
|
||||||
|
int countUnreadFrom(QString from);
|
||||||
|
QPair<int, Message> firstUnreadFrom(QString from);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString path_;
|
||||||
|
sqlite3 * db_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INBOX_H
|
76
Message.cpp
Normal file
76
Message.cpp
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
* This file is part of JS8Call.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* (C) 2018 Jordan Sherer <kn4crd@gmail.com> - All Rights Reserved
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "Message.h"
|
||||||
|
|
||||||
|
Message::Message()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Message::Message(QString const &type, QString const &value):
|
||||||
|
type_{ type },
|
||||||
|
value_{ value }
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Message::Message(QString const &type, QString const &value, QMap<QString, QVariant> const ¶ms):
|
||||||
|
type_{ type },
|
||||||
|
value_{ value },
|
||||||
|
params_{ params }
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Message::read(const QJsonObject &json){
|
||||||
|
if(json.contains("type") && json["type"].isString()){
|
||||||
|
type_ = json["type"].toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(json.contains("value") && json["value"].isString()){
|
||||||
|
value_ = json["value"].toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(json.contains("params") && json["params"].isObject()){
|
||||||
|
params_.clear();
|
||||||
|
|
||||||
|
QJsonObject params = json["params"].toObject();
|
||||||
|
foreach(auto key, params.keys()){
|
||||||
|
params_[key] = params[key].toVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Message::write(QJsonObject &json) const{
|
||||||
|
json["type"] = type_;
|
||||||
|
json["value"] = value_;
|
||||||
|
|
||||||
|
QJsonObject params;
|
||||||
|
foreach(auto key, params_.keys()){
|
||||||
|
params.insert(key, QJsonValue::fromVariant(params_[key]));
|
||||||
|
}
|
||||||
|
json["params"] = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray Message::toJson() const {
|
||||||
|
QJsonObject o;
|
||||||
|
write(o);
|
||||||
|
|
||||||
|
QJsonDocument d(o);
|
||||||
|
return d.toJson(QJsonDocument::Compact);
|
||||||
|
}
|
42
Message.h
Normal file
42
Message.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef MESSAGE_H
|
||||||
|
#define MESSAGE_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (C) 2018 Jordan Sherer <kn4crd@gmail.com> - All Rights Reserved
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
||||||
|
class Message {
|
||||||
|
public:
|
||||||
|
Message();
|
||||||
|
Message(QString const &type, QString const &value="");
|
||||||
|
Message(QString const &type, QString const &value, QMap<QString, QVariant> const ¶ms);
|
||||||
|
|
||||||
|
void read(const QJsonObject &json);
|
||||||
|
void write(QJsonObject &json) const;
|
||||||
|
|
||||||
|
QByteArray toJson() const;
|
||||||
|
|
||||||
|
QString type() const { return type_; }
|
||||||
|
void setType(QString type){ type_ = type; }
|
||||||
|
|
||||||
|
QString value() const { return value_; }
|
||||||
|
void setValue(QString value){ value_ = value; }
|
||||||
|
|
||||||
|
QMap<QString, QVariant> params() const { return params_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString type_;
|
||||||
|
QString value_;
|
||||||
|
QMap<QString, QVariant> params_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MESSAGE_H
|
@ -19,61 +19,6 @@
|
|||||||
|
|
||||||
#include "moc_MessageClient.cpp"
|
#include "moc_MessageClient.cpp"
|
||||||
|
|
||||||
Message::Message()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Message::Message(QString const &type, QString const &value):
|
|
||||||
type_{ type },
|
|
||||||
value_{ value }
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Message::Message(QString const &type, QString const &value, QMap<QString, QVariant> const ¶ms):
|
|
||||||
type_{ type },
|
|
||||||
value_{ value },
|
|
||||||
params_{ params }
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Message::read(const QJsonObject &json){
|
|
||||||
if(json.contains("type") && json["type"].isString()){
|
|
||||||
type_ = json["type"].toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(json.contains("value") && json["value"].isString()){
|
|
||||||
value_ = json["value"].toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(json.contains("params") && json["params"].isObject()){
|
|
||||||
params_.clear();
|
|
||||||
|
|
||||||
QJsonObject params = json["params"].toObject();
|
|
||||||
foreach(auto key, params.keys()){
|
|
||||||
params_[key] = params[key].toVariant();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Message::write(QJsonObject &json) const{
|
|
||||||
json["type"] = type_;
|
|
||||||
json["value"] = value_;
|
|
||||||
|
|
||||||
QJsonObject params;
|
|
||||||
foreach(auto key, params_.keys()){
|
|
||||||
params.insert(key, QJsonValue::fromVariant(params_[key]));
|
|
||||||
}
|
|
||||||
json["params"] = params;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray Message::toJson() const {
|
|
||||||
QJsonObject o;
|
|
||||||
write(o);
|
|
||||||
|
|
||||||
QJsonDocument d(o);
|
|
||||||
return d.toJson();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class MessageClient::impl
|
class MessageClient::impl
|
||||||
: public QUdpSocket
|
: public QUdpSocket
|
||||||
|
@ -6,9 +6,8 @@
|
|||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonObject>
|
|
||||||
|
|
||||||
|
#include "Message.h"
|
||||||
#include "Radio.hpp"
|
#include "Radio.hpp"
|
||||||
#include "pimpl_h.hpp"
|
#include "pimpl_h.hpp"
|
||||||
|
|
||||||
@ -16,29 +15,6 @@ class QByteArray;
|
|||||||
class QHostAddress;
|
class QHostAddress;
|
||||||
class QColor;
|
class QColor;
|
||||||
|
|
||||||
|
|
||||||
class Message {
|
|
||||||
public:
|
|
||||||
Message();
|
|
||||||
Message(QString const &type, QString const &value="");
|
|
||||||
Message(QString const &type, QString const &value, QMap<QString, QVariant> const ¶ms);
|
|
||||||
|
|
||||||
void read(const QJsonObject &json);
|
|
||||||
void write(QJsonObject &json) const;
|
|
||||||
|
|
||||||
QByteArray toJson() const;
|
|
||||||
|
|
||||||
QString type() const { return type_; }
|
|
||||||
QString value() const { return value_; }
|
|
||||||
QMap<QString, QVariant> params() const { return params_; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString type_;
|
|
||||||
QString value_;
|
|
||||||
QMap<QString, QVariant> params_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// MessageClient - Manage messages sent and replies received from a
|
// MessageClient - Manage messages sent and replies received from a
|
||||||
// matching server (MessageServer) at the other end of
|
// matching server (MessageServer) at the other end of
|
||||||
|
182
mainwindow.cpp
182
mainwindow.cpp
@ -65,6 +65,7 @@
|
|||||||
#include "DriftingDateTime.h"
|
#include "DriftingDateTime.h"
|
||||||
#include "jsc.h"
|
#include "jsc.h"
|
||||||
#include "jsc_checker.h"
|
#include "jsc_checker.h"
|
||||||
|
#include "Inbox.h"
|
||||||
|
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
||||||
@ -1519,7 +1520,7 @@ void MainWindow::checkStartupWarnings ()
|
|||||||
{
|
{
|
||||||
MessageBox::critical_message (this,
|
MessageBox::critical_message (this,
|
||||||
QString("This version of %1 is a pre-release development\n"
|
QString("This version of %1 is a pre-release development\n"
|
||||||
"build and will expire after %2 (UTC), upon which you\n"
|
"build andw will expire after %2 (UTC), upon which you\n"
|
||||||
"will need to upgrade to the latest version. \n\n"
|
"will need to upgrade to the latest version. \n\n"
|
||||||
"Use of development versions of JS8Call are at your own risk \n"
|
"Use of development versions of JS8Call are at your own risk \n"
|
||||||
"and carry a responsiblity to report any problems to:\n"
|
"and carry a responsiblity to report any problems to:\n"
|
||||||
@ -1535,6 +1536,28 @@ void MainWindow::initializeDummyData(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto path = QDir::toNativeSeparators(m_config.writeable_data_dir ().absoluteFilePath(QString("test.db3")));
|
||||||
|
auto inbox = Inbox(path);
|
||||||
|
if(inbox.open()){
|
||||||
|
qDebug() << "test inbox opened" << inbox.count("test", "$", "%") << "messages";
|
||||||
|
|
||||||
|
int i = inbox.append(Message("test", "booya1"));
|
||||||
|
|
||||||
|
i = inbox.append(Message("test", "booya2"));
|
||||||
|
qDebug() << "i" << i;
|
||||||
|
|
||||||
|
qDebug() << inbox.set(i, Message("test", "booya3"));
|
||||||
|
|
||||||
|
auto m = inbox.value(i);
|
||||||
|
qDebug() << QString(m.toJson());
|
||||||
|
|
||||||
|
qDebug() << inbox.del(i);
|
||||||
|
|
||||||
|
foreach(auto pair, inbox.values("test", "$", "%", 0, 5)){
|
||||||
|
qDebug() << pair.first << QString(pair.second.toJson());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto d = DecodedText("h+vWp6mRPprH", 6);
|
auto d = DecodedText("h+vWp6mRPprH", 6);
|
||||||
qDebug() << d.message() << buildMessageFrames(d.message());
|
qDebug() << d.message() << buildMessageFrames(d.message());
|
||||||
|
|
||||||
@ -5371,6 +5394,7 @@ void MainWindow::clearActivity(){
|
|||||||
m_rxCommandQueue.clear();
|
m_rxCommandQueue.clear();
|
||||||
m_lastTxMessage.clear();
|
m_lastTxMessage.clear();
|
||||||
|
|
||||||
|
refreshInboxCounts();
|
||||||
resetTimeDeltaAverage();
|
resetTimeDeltaAverage();
|
||||||
|
|
||||||
clearTableWidget(ui->tableWidgetCalls);
|
clearTableWidget(ui->tableWidgetCalls);
|
||||||
@ -7647,11 +7671,42 @@ void MainWindow::on_tableWidgetCalls_cellDoubleClicked(int row, int col){
|
|||||||
|
|
||||||
auto call = callsignSelected();
|
auto call = callsignSelected();
|
||||||
|
|
||||||
if(m_rxCallsignCommandQueue.contains(call) && !m_rxCallsignCommandQueue[call].isEmpty()){
|
if(m_rxInboxCountCache.value(call, 0) > 0){
|
||||||
CommandDetail d = m_rxCallsignCommandQueue[call].first();
|
|
||||||
m_rxCallsignCommandQueue[call].removeFirst();
|
|
||||||
|
|
||||||
processAlertReplyForCommand(d, d.relayPath, d.cmd);
|
// TODO:
|
||||||
|
// CommandDetail d = m_rxCallsignInboxCountCache[call].first();
|
||||||
|
// m_rxCallsignInboxCountCache[call].removeFirst();
|
||||||
|
//
|
||||||
|
// processAlertReplyForCommand(d, d.relayPath, d.cmd);
|
||||||
|
|
||||||
|
Inbox i(inboxPath());
|
||||||
|
if(i.open()){
|
||||||
|
auto pair = i.firstUnreadFrom(call);
|
||||||
|
auto id = pair.first;
|
||||||
|
auto msg = pair.second;
|
||||||
|
auto params = msg.params();
|
||||||
|
|
||||||
|
CommandDetail d;
|
||||||
|
d.cmd = params.value("CMD").toString();
|
||||||
|
d.extra = params.value("EXTRA").toString();
|
||||||
|
d.freq = params.value("OFFSET").toInt();
|
||||||
|
d.from = params.value("FROM").toString();
|
||||||
|
d.grid = params.value("GRID").toString();
|
||||||
|
d.relayPath = params.value("PATH").toString();
|
||||||
|
d.snr = params.value("SNR").toInt();
|
||||||
|
d.tdrift = params.value("TDRIFT").toFloat();
|
||||||
|
d.text = params.value("TEXT").toString();
|
||||||
|
d.to = params.value("TO").toString();
|
||||||
|
d.utcTimestamp = QDateTime::fromString(params.value("UTC").toString(), "yyyy-MM-dd hh:mm:ss");
|
||||||
|
d.utcTimestamp.setUtcOffset(0);
|
||||||
|
|
||||||
|
msg.setType("READ");
|
||||||
|
i.set(id, msg);
|
||||||
|
|
||||||
|
m_rxInboxCountCache[call] = max(0, m_rxInboxCountCache.value(call) - 1);
|
||||||
|
|
||||||
|
processAlertReplyForCommand(d, d.relayPath, d.cmd);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
addMessageText(call);
|
addMessageText(call);
|
||||||
@ -9594,14 +9649,11 @@ void MainWindow::processCommandActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
calls.prepend(d.from);
|
calls.prepend(d.from);
|
||||||
|
d.relayPath = calls.join('>');
|
||||||
|
|
||||||
auto relayPath = calls.join('>');
|
reply = QString("%1 ACK").arg(d.relayPath);
|
||||||
|
|
||||||
reply = QString("%1 ACK").arg(relayPath);
|
addCommandToInbox(d);
|
||||||
|
|
||||||
// put message in inbox instead...
|
|
||||||
d.relayPath = relayPath;
|
|
||||||
m_rxCallsignCommandQueue[d.from].append(d);
|
|
||||||
|
|
||||||
QTimer::singleShot(500, this, [this, d](){
|
QTimer::singleShot(500, this, [this, d](){
|
||||||
MessageBox::information_message(this, QString("A new message was received at %1 UTC").arg(d.utcTimestamp.time().toString()));
|
MessageBox::information_message(this, QString("A new message was received at %1 UTC").arg(d.utcTimestamp.time().toString()));
|
||||||
@ -9763,20 +9815,86 @@ void MainWindow::processCommandActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::writeDirectedCommandToFile(CommandDetail d){
|
QString MainWindow::inboxPath(){
|
||||||
// open file /save/messages/[callsign].txt and append a message log entry...
|
return QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("inbox.db3"));
|
||||||
QFile f(QDir::toNativeSeparators(m_config.writeable_data_dir ().absolutePath()) + QString("/save/messages/%1.txt").arg(Radio::base_callsign(d.from)));
|
}
|
||||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
|
||||||
QTextStream out(&f);
|
void MainWindow::refreshInboxCounts(){
|
||||||
auto df = dialFrequency();
|
auto inbox = Inbox(inboxPath());
|
||||||
auto text = QString("%1\t%2MHz\t%3Hz\t%4dB\t%5");
|
if(inbox.open()){
|
||||||
text = text.arg(d.utcTimestamp.toString("yyyy-MM-dd hh:mm:ss"));
|
// reset inbox counts
|
||||||
text = text.arg(Radio::frequency_MHz_string(df));
|
m_rxInboxCountCache.clear();
|
||||||
text = text.arg(d.freq);
|
|
||||||
text = text.arg(Varicode::formatSNR(d.snr));
|
// compute new counts from db
|
||||||
text = text.arg(d.text.isEmpty() ? QString("%1 %2").arg(d.cmd).arg(d.extra).trimmed() : d.text);
|
auto v = inbox.values("UNREAD", "$", "%", 0, 10000);
|
||||||
out << text << endl;
|
foreach(auto pair, v){
|
||||||
f.close();
|
auto params = pair.second.params();
|
||||||
|
auto to = params.value("TO").toString();
|
||||||
|
if(to.isEmpty() || (to != m_config.my_callsign() && to != Radio::base_callsign(m_config.my_callsign()))){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto from = params.value("FROM").toString();
|
||||||
|
if(from.isEmpty()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_rxInboxCountCache[from] = m_rxInboxCountCache.value(from, 0) + 1;
|
||||||
|
|
||||||
|
if(!m_callActivity.contains(from)){
|
||||||
|
auto utc = params.value("UTC").toString();
|
||||||
|
auto snr = params.value("SNR").toInt();
|
||||||
|
auto freq = params.value("OFFSET").toInt();
|
||||||
|
auto tdrift = params.value("TDRIFT").toInt();
|
||||||
|
|
||||||
|
CallDetail cd;
|
||||||
|
cd.call = from;
|
||||||
|
cd.snr = snr;
|
||||||
|
cd.freq = freq;
|
||||||
|
cd.tdrift = tdrift;
|
||||||
|
cd.utcTimestamp = QDateTime::fromString(utc, "yyyy-MM-dd hh:mm:ss");
|
||||||
|
cd.utcTimestamp.setUtcOffset(0);
|
||||||
|
cd.ackTimestamp = cd.utcTimestamp;
|
||||||
|
logCallActivity(cd, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addCommandToInbox(CommandDetail d){
|
||||||
|
// legacy
|
||||||
|
m_rxInboxCountCache[d.from] = m_rxInboxCountCache.value(d.from, 0) + 1;
|
||||||
|
|
||||||
|
// inbox:
|
||||||
|
auto inbox = Inbox(inboxPath());
|
||||||
|
if(inbox.open()){
|
||||||
|
auto df = dialFrequency();
|
||||||
|
|
||||||
|
QMap<QString, QVariant> v = {
|
||||||
|
{"UTC", QVariant(d.utcTimestamp.toString("yyyy-MM-dd hh:mm:ss"))},
|
||||||
|
{"TO", QVariant(d.to)},
|
||||||
|
{"FROM", QVariant(d.from)},
|
||||||
|
{"PATH", QVariant(d.relayPath)},
|
||||||
|
{"DIAL", QVariant((quint64)df)},
|
||||||
|
{"TDRIFT", QVariant(d.tdrift)},
|
||||||
|
{"OFFSET", QVariant(d.freq)},
|
||||||
|
{"CMD", QVariant(d.cmd)},
|
||||||
|
{"SNR", QVariant(d.snr)},
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!d.grid.isEmpty()){
|
||||||
|
v["GRID"] = QVariant(d.grid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!d.extra.isEmpty()){
|
||||||
|
v["EXTRA"] = QVariant(d.extra);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!d.text.isEmpty()){
|
||||||
|
v["TEXT"] = QVariant(d.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto m = Message("UNREAD", "", v);
|
||||||
|
inbox.append(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10295,8 +10413,8 @@ void MainWindow::displayCallActivity() {
|
|||||||
|
|
||||||
// pin messages to the top
|
// pin messages to the top
|
||||||
qStableSort(keys.begin(), keys.end(), [this](const QString left, QString right){
|
qStableSort(keys.begin(), keys.end(), [this](const QString left, QString right){
|
||||||
int leftHas = (int)!(m_rxCallsignCommandQueue.contains(left) && !m_rxCallsignCommandQueue[left].isEmpty());
|
int leftHas = (int)!(m_rxInboxCountCache.value(left, 0) > 0);
|
||||||
int rightHas = (int)!(m_rxCallsignCommandQueue.contains(right) && !m_rxCallsignCommandQueue[right].isEmpty());
|
int rightHas = (int)!(m_rxInboxCountCache.value(right, 0) > 0);
|
||||||
|
|
||||||
return leftHas < rightHas;
|
return leftHas < rightHas;
|
||||||
});
|
});
|
||||||
@ -10316,7 +10434,11 @@ void MainWindow::displayCallActivity() {
|
|||||||
|
|
||||||
bool isCallSelected = (call == selectedCall);
|
bool isCallSelected = (call == selectedCall);
|
||||||
|
|
||||||
if (!isCallSelected && callsignAging && d.utcTimestamp.secsTo(now) / 60 >= callsignAging) {
|
// icon flags (flag -> star -> empty)
|
||||||
|
bool hasMessage = m_rxInboxCountCache.value(d.call, 0) > 0;
|
||||||
|
bool hasAck = d.ackTimestamp.isValid();
|
||||||
|
|
||||||
|
if (!isCallSelected && !hasMessage && callsignAging && d.utcTimestamp.secsTo(now) / 60 >= callsignAging) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10324,6 +10446,7 @@ void MainWindow::displayCallActivity() {
|
|||||||
int row = ui->tableWidgetCalls->rowCount() - 1;
|
int row = ui->tableWidgetCalls->rowCount() - 1;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
|
|
||||||
|
// icon column
|
||||||
#if SHOW_THROUGH_CALLS
|
#if SHOW_THROUGH_CALLS
|
||||||
QString displayCall = d.through.isEmpty() ? d.call : QString("%1>%2").arg(d.through).arg(d.call);
|
QString displayCall = d.through.isEmpty() ? d.call : QString("%1>%2").arg(d.through).arg(d.call);
|
||||||
#else
|
#else
|
||||||
@ -10337,9 +10460,6 @@ void MainWindow::displayCallActivity() {
|
|||||||
flag = "\u2713";
|
flag = "\u2713";
|
||||||
}
|
}
|
||||||
|
|
||||||
// icon column (flag -> star -> empty)
|
|
||||||
bool hasMessage = m_rxCallsignCommandQueue.contains(d.call) && !m_rxCallsignCommandQueue[d.call].isEmpty();
|
|
||||||
bool hasAck = d.ackTimestamp.isValid();
|
|
||||||
auto iconItem = new QTableWidgetItem(hasMessage ? "\u2691" : hasAck ? "\u2605" : "");
|
auto iconItem = new QTableWidgetItem(hasMessage ? "\u2691" : hasAck ? "\u2605" : "");
|
||||||
iconItem->setData(Qt::UserRole, QVariant((d.call)));
|
iconItem->setData(Qt::UserRole, QVariant((d.call)));
|
||||||
iconItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
iconItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
@ -817,7 +817,7 @@ private:
|
|||||||
QQueue<QString> m_txHeartbeatQueue; // ping frames to be sent
|
QQueue<QString> m_txHeartbeatQueue; // ping frames to be sent
|
||||||
QMap<QString, QDateTime> m_aprsCallCache;
|
QMap<QString, QDateTime> m_aprsCallCache;
|
||||||
|
|
||||||
QMap<QString, QList<CommandDetail>> m_rxCallsignCommandQueue; // call -> [cmd, ...]
|
QMap<QString, int> m_rxInboxCountCache; // call -> count
|
||||||
|
|
||||||
QMap<QString, QMap<QString, CallDetail>> m_callActivityCache; // band -> call activity
|
QMap<QString, QMap<QString, CallDetail>> m_callActivityCache; // band -> call activity
|
||||||
QMap<QString, QMap<int, QList<ActivityDetail>>> m_bandActivityCache; // band -> band activity
|
QMap<QString, QMap<int, QList<ActivityDetail>>> m_bandActivityCache; // band -> band activity
|
||||||
@ -942,7 +942,9 @@ private:
|
|||||||
void processBufferedActivity();
|
void processBufferedActivity();
|
||||||
QString generateStatus();
|
QString generateStatus();
|
||||||
void processCommandActivity();
|
void processCommandActivity();
|
||||||
void writeDirectedCommandToFile(CommandDetail d);
|
QString inboxPath();
|
||||||
|
void refreshInboxCounts();
|
||||||
|
void addCommandToInbox(CommandDetail d);
|
||||||
void processAlertReplyForCommand(CommandDetail d, QString from, QString cmd);
|
void processAlertReplyForCommand(CommandDetail d, QString from, QString cmd);
|
||||||
void processSpots();
|
void processSpots();
|
||||||
void processTxQueue();
|
void processTxQueue();
|
||||||
|
16507
vendor/sqlite3/shell.c
vendored
Normal file
16507
vendor/sqlite3/shell.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
220537
vendor/sqlite3/sqlite3.c
vendored
Normal file
220537
vendor/sqlite3/sqlite3.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11691
vendor/sqlite3/sqlite3.h
vendored
Normal file
11691
vendor/sqlite3/sqlite3.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
628
vendor/sqlite3/sqlite3ext.h
vendored
Normal file
628
vendor/sqlite3/sqlite3ext.h
vendored
Normal file
@ -0,0 +1,628 @@
|
|||||||
|
/*
|
||||||
|
** 2006 June 7
|
||||||
|
**
|
||||||
|
** The author disclaims copyright to this source code. In place of
|
||||||
|
** a legal notice, here is a blessing:
|
||||||
|
**
|
||||||
|
** May you do good and not evil.
|
||||||
|
** May you find forgiveness for yourself and forgive others.
|
||||||
|
** May you share freely, never taking more than you give.
|
||||||
|
**
|
||||||
|
*************************************************************************
|
||||||
|
** This header file defines the SQLite interface for use by
|
||||||
|
** shared libraries that want to be imported as extensions into
|
||||||
|
** an SQLite instance. Shared libraries that intend to be loaded
|
||||||
|
** as extensions by SQLite should #include this file instead of
|
||||||
|
** sqlite3.h.
|
||||||
|
*/
|
||||||
|
#ifndef SQLITE3EXT_H
|
||||||
|
#define SQLITE3EXT_H
|
||||||
|
#include "sqlite3.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
** The following structure holds pointers to all of the SQLite API
|
||||||
|
** routines.
|
||||||
|
**
|
||||||
|
** WARNING: In order to maintain backwards compatibility, add new
|
||||||
|
** interfaces to the end of this structure only. If you insert new
|
||||||
|
** interfaces in the middle of this structure, then older different
|
||||||
|
** versions of SQLite will not be able to load each other's shared
|
||||||
|
** libraries!
|
||||||
|
*/
|
||||||
|
struct sqlite3_api_routines {
|
||||||
|
void * (*aggregate_context)(sqlite3_context*,int nBytes);
|
||||||
|
int (*aggregate_count)(sqlite3_context*);
|
||||||
|
int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
|
||||||
|
int (*bind_double)(sqlite3_stmt*,int,double);
|
||||||
|
int (*bind_int)(sqlite3_stmt*,int,int);
|
||||||
|
int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
|
||||||
|
int (*bind_null)(sqlite3_stmt*,int);
|
||||||
|
int (*bind_parameter_count)(sqlite3_stmt*);
|
||||||
|
int (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
|
||||||
|
const char * (*bind_parameter_name)(sqlite3_stmt*,int);
|
||||||
|
int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
|
||||||
|
int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
|
||||||
|
int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
|
||||||
|
int (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
|
||||||
|
int (*busy_timeout)(sqlite3*,int ms);
|
||||||
|
int (*changes)(sqlite3*);
|
||||||
|
int (*close)(sqlite3*);
|
||||||
|
int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
|
||||||
|
int eTextRep,const char*));
|
||||||
|
int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
|
||||||
|
int eTextRep,const void*));
|
||||||
|
const void * (*column_blob)(sqlite3_stmt*,int iCol);
|
||||||
|
int (*column_bytes)(sqlite3_stmt*,int iCol);
|
||||||
|
int (*column_bytes16)(sqlite3_stmt*,int iCol);
|
||||||
|
int (*column_count)(sqlite3_stmt*pStmt);
|
||||||
|
const char * (*column_database_name)(sqlite3_stmt*,int);
|
||||||
|
const void * (*column_database_name16)(sqlite3_stmt*,int);
|
||||||
|
const char * (*column_decltype)(sqlite3_stmt*,int i);
|
||||||
|
const void * (*column_decltype16)(sqlite3_stmt*,int);
|
||||||
|
double (*column_double)(sqlite3_stmt*,int iCol);
|
||||||
|
int (*column_int)(sqlite3_stmt*,int iCol);
|
||||||
|
sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol);
|
||||||
|
const char * (*column_name)(sqlite3_stmt*,int);
|
||||||
|
const void * (*column_name16)(sqlite3_stmt*,int);
|
||||||
|
const char * (*column_origin_name)(sqlite3_stmt*,int);
|
||||||
|
const void * (*column_origin_name16)(sqlite3_stmt*,int);
|
||||||
|
const char * (*column_table_name)(sqlite3_stmt*,int);
|
||||||
|
const void * (*column_table_name16)(sqlite3_stmt*,int);
|
||||||
|
const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
|
||||||
|
const void * (*column_text16)(sqlite3_stmt*,int iCol);
|
||||||
|
int (*column_type)(sqlite3_stmt*,int iCol);
|
||||||
|
sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
|
||||||
|
void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
|
||||||
|
int (*complete)(const char*sql);
|
||||||
|
int (*complete16)(const void*sql);
|
||||||
|
int (*create_collation)(sqlite3*,const char*,int,void*,
|
||||||
|
int(*)(void*,int,const void*,int,const void*));
|
||||||
|
int (*create_collation16)(sqlite3*,const void*,int,void*,
|
||||||
|
int(*)(void*,int,const void*,int,const void*));
|
||||||
|
int (*create_function)(sqlite3*,const char*,int,int,void*,
|
||||||
|
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
|
||||||
|
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
|
||||||
|
void (*xFinal)(sqlite3_context*));
|
||||||
|
int (*create_function16)(sqlite3*,const void*,int,int,void*,
|
||||||
|
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
|
||||||
|
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
|
||||||
|
void (*xFinal)(sqlite3_context*));
|
||||||
|
int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
|
||||||
|
int (*data_count)(sqlite3_stmt*pStmt);
|
||||||
|
sqlite3 * (*db_handle)(sqlite3_stmt*);
|
||||||
|
int (*declare_vtab)(sqlite3*,const char*);
|
||||||
|
int (*enable_shared_cache)(int);
|
||||||
|
int (*errcode)(sqlite3*db);
|
||||||
|
const char * (*errmsg)(sqlite3*);
|
||||||
|
const void * (*errmsg16)(sqlite3*);
|
||||||
|
int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
|
||||||
|
int (*expired)(sqlite3_stmt*);
|
||||||
|
int (*finalize)(sqlite3_stmt*pStmt);
|
||||||
|
void (*free)(void*);
|
||||||
|
void (*free_table)(char**result);
|
||||||
|
int (*get_autocommit)(sqlite3*);
|
||||||
|
void * (*get_auxdata)(sqlite3_context*,int);
|
||||||
|
int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
|
||||||
|
int (*global_recover)(void);
|
||||||
|
void (*interruptx)(sqlite3*);
|
||||||
|
sqlite_int64 (*last_insert_rowid)(sqlite3*);
|
||||||
|
const char * (*libversion)(void);
|
||||||
|
int (*libversion_number)(void);
|
||||||
|
void *(*malloc)(int);
|
||||||
|
char * (*mprintf)(const char*,...);
|
||||||
|
int (*open)(const char*,sqlite3**);
|
||||||
|
int (*open16)(const void*,sqlite3**);
|
||||||
|
int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
|
||||||
|
int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
|
||||||
|
void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
|
||||||
|
void (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
|
||||||
|
void *(*realloc)(void*,int);
|
||||||
|
int (*reset)(sqlite3_stmt*pStmt);
|
||||||
|
void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
|
||||||
|
void (*result_double)(sqlite3_context*,double);
|
||||||
|
void (*result_error)(sqlite3_context*,const char*,int);
|
||||||
|
void (*result_error16)(sqlite3_context*,const void*,int);
|
||||||
|
void (*result_int)(sqlite3_context*,int);
|
||||||
|
void (*result_int64)(sqlite3_context*,sqlite_int64);
|
||||||
|
void (*result_null)(sqlite3_context*);
|
||||||
|
void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
|
||||||
|
void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
|
||||||
|
void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
|
||||||
|
void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
|
||||||
|
void (*result_value)(sqlite3_context*,sqlite3_value*);
|
||||||
|
void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
|
||||||
|
int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
|
||||||
|
const char*,const char*),void*);
|
||||||
|
void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
|
||||||
|
char * (*xsnprintf)(int,char*,const char*,...);
|
||||||
|
int (*step)(sqlite3_stmt*);
|
||||||
|
int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
|
||||||
|
char const**,char const**,int*,int*,int*);
|
||||||
|
void (*thread_cleanup)(void);
|
||||||
|
int (*total_changes)(sqlite3*);
|
||||||
|
void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
|
||||||
|
int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
|
||||||
|
void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
|
||||||
|
sqlite_int64),void*);
|
||||||
|
void * (*user_data)(sqlite3_context*);
|
||||||
|
const void * (*value_blob)(sqlite3_value*);
|
||||||
|
int (*value_bytes)(sqlite3_value*);
|
||||||
|
int (*value_bytes16)(sqlite3_value*);
|
||||||
|
double (*value_double)(sqlite3_value*);
|
||||||
|
int (*value_int)(sqlite3_value*);
|
||||||
|
sqlite_int64 (*value_int64)(sqlite3_value*);
|
||||||
|
int (*value_numeric_type)(sqlite3_value*);
|
||||||
|
const unsigned char * (*value_text)(sqlite3_value*);
|
||||||
|
const void * (*value_text16)(sqlite3_value*);
|
||||||
|
const void * (*value_text16be)(sqlite3_value*);
|
||||||
|
const void * (*value_text16le)(sqlite3_value*);
|
||||||
|
int (*value_type)(sqlite3_value*);
|
||||||
|
char *(*vmprintf)(const char*,va_list);
|
||||||
|
/* Added ??? */
|
||||||
|
int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
|
||||||
|
/* Added by 3.3.13 */
|
||||||
|
int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
|
||||||
|
int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
|
||||||
|
int (*clear_bindings)(sqlite3_stmt*);
|
||||||
|
/* Added by 3.4.1 */
|
||||||
|
int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
|
||||||
|
void (*xDestroy)(void *));
|
||||||
|
/* Added by 3.5.0 */
|
||||||
|
int (*bind_zeroblob)(sqlite3_stmt*,int,int);
|
||||||
|
int (*blob_bytes)(sqlite3_blob*);
|
||||||
|
int (*blob_close)(sqlite3_blob*);
|
||||||
|
int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
|
||||||
|
int,sqlite3_blob**);
|
||||||
|
int (*blob_read)(sqlite3_blob*,void*,int,int);
|
||||||
|
int (*blob_write)(sqlite3_blob*,const void*,int,int);
|
||||||
|
int (*create_collation_v2)(sqlite3*,const char*,int,void*,
|
||||||
|
int(*)(void*,int,const void*,int,const void*),
|
||||||
|
void(*)(void*));
|
||||||
|
int (*file_control)(sqlite3*,const char*,int,void*);
|
||||||
|
sqlite3_int64 (*memory_highwater)(int);
|
||||||
|
sqlite3_int64 (*memory_used)(void);
|
||||||
|
sqlite3_mutex *(*mutex_alloc)(int);
|
||||||
|
void (*mutex_enter)(sqlite3_mutex*);
|
||||||
|
void (*mutex_free)(sqlite3_mutex*);
|
||||||
|
void (*mutex_leave)(sqlite3_mutex*);
|
||||||
|
int (*mutex_try)(sqlite3_mutex*);
|
||||||
|
int (*open_v2)(const char*,sqlite3**,int,const char*);
|
||||||
|
int (*release_memory)(int);
|
||||||
|
void (*result_error_nomem)(sqlite3_context*);
|
||||||
|
void (*result_error_toobig)(sqlite3_context*);
|
||||||
|
int (*sleep)(int);
|
||||||
|
void (*soft_heap_limit)(int);
|
||||||
|
sqlite3_vfs *(*vfs_find)(const char*);
|
||||||
|
int (*vfs_register)(sqlite3_vfs*,int);
|
||||||
|
int (*vfs_unregister)(sqlite3_vfs*);
|
||||||
|
int (*xthreadsafe)(void);
|
||||||
|
void (*result_zeroblob)(sqlite3_context*,int);
|
||||||
|
void (*result_error_code)(sqlite3_context*,int);
|
||||||
|
int (*test_control)(int, ...);
|
||||||
|
void (*randomness)(int,void*);
|
||||||
|
sqlite3 *(*context_db_handle)(sqlite3_context*);
|
||||||
|
int (*extended_result_codes)(sqlite3*,int);
|
||||||
|
int (*limit)(sqlite3*,int,int);
|
||||||
|
sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
|
||||||
|
const char *(*sql)(sqlite3_stmt*);
|
||||||
|
int (*status)(int,int*,int*,int);
|
||||||
|
int (*backup_finish)(sqlite3_backup*);
|
||||||
|
sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
|
||||||
|
int (*backup_pagecount)(sqlite3_backup*);
|
||||||
|
int (*backup_remaining)(sqlite3_backup*);
|
||||||
|
int (*backup_step)(sqlite3_backup*,int);
|
||||||
|
const char *(*compileoption_get)(int);
|
||||||
|
int (*compileoption_used)(const char*);
|
||||||
|
int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
|
||||||
|
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
|
||||||
|
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
|
||||||
|
void (*xFinal)(sqlite3_context*),
|
||||||
|
void(*xDestroy)(void*));
|
||||||
|
int (*db_config)(sqlite3*,int,...);
|
||||||
|
sqlite3_mutex *(*db_mutex)(sqlite3*);
|
||||||
|
int (*db_status)(sqlite3*,int,int*,int*,int);
|
||||||
|
int (*extended_errcode)(sqlite3*);
|
||||||
|
void (*log)(int,const char*,...);
|
||||||
|
sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
|
||||||
|
const char *(*sourceid)(void);
|
||||||
|
int (*stmt_status)(sqlite3_stmt*,int,int);
|
||||||
|
int (*strnicmp)(const char*,const char*,int);
|
||||||
|
int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
|
||||||
|
int (*wal_autocheckpoint)(sqlite3*,int);
|
||||||
|
int (*wal_checkpoint)(sqlite3*,const char*);
|
||||||
|
void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
|
||||||
|
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
|
||||||
|
int (*vtab_config)(sqlite3*,int op,...);
|
||||||
|
int (*vtab_on_conflict)(sqlite3*);
|
||||||
|
/* Version 3.7.16 and later */
|
||||||
|
int (*close_v2)(sqlite3*);
|
||||||
|
const char *(*db_filename)(sqlite3*,const char*);
|
||||||
|
int (*db_readonly)(sqlite3*,const char*);
|
||||||
|
int (*db_release_memory)(sqlite3*);
|
||||||
|
const char *(*errstr)(int);
|
||||||
|
int (*stmt_busy)(sqlite3_stmt*);
|
||||||
|
int (*stmt_readonly)(sqlite3_stmt*);
|
||||||
|
int (*stricmp)(const char*,const char*);
|
||||||
|
int (*uri_boolean)(const char*,const char*,int);
|
||||||
|
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
|
||||||
|
const char *(*uri_parameter)(const char*,const char*);
|
||||||
|
char *(*xvsnprintf)(int,char*,const char*,va_list);
|
||||||
|
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
|
||||||
|
/* Version 3.8.7 and later */
|
||||||
|
int (*auto_extension)(void(*)(void));
|
||||||
|
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
|
||||||
|
void(*)(void*));
|
||||||
|
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
|
||||||
|
void(*)(void*),unsigned char);
|
||||||
|
int (*cancel_auto_extension)(void(*)(void));
|
||||||
|
int (*load_extension)(sqlite3*,const char*,const char*,char**);
|
||||||
|
void *(*malloc64)(sqlite3_uint64);
|
||||||
|
sqlite3_uint64 (*msize)(void*);
|
||||||
|
void *(*realloc64)(void*,sqlite3_uint64);
|
||||||
|
void (*reset_auto_extension)(void);
|
||||||
|
void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
|
||||||
|
void(*)(void*));
|
||||||
|
void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
|
||||||
|
void(*)(void*), unsigned char);
|
||||||
|
int (*strglob)(const char*,const char*);
|
||||||
|
/* Version 3.8.11 and later */
|
||||||
|
sqlite3_value *(*value_dup)(const sqlite3_value*);
|
||||||
|
void (*value_free)(sqlite3_value*);
|
||||||
|
int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);
|
||||||
|
int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);
|
||||||
|
/* Version 3.9.0 and later */
|
||||||
|
unsigned int (*value_subtype)(sqlite3_value*);
|
||||||
|
void (*result_subtype)(sqlite3_context*,unsigned int);
|
||||||
|
/* Version 3.10.0 and later */
|
||||||
|
int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int);
|
||||||
|
int (*strlike)(const char*,const char*,unsigned int);
|
||||||
|
int (*db_cacheflush)(sqlite3*);
|
||||||
|
/* Version 3.12.0 and later */
|
||||||
|
int (*system_errno)(sqlite3*);
|
||||||
|
/* Version 3.14.0 and later */
|
||||||
|
int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
|
||||||
|
char *(*expanded_sql)(sqlite3_stmt*);
|
||||||
|
/* Version 3.18.0 and later */
|
||||||
|
void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
|
||||||
|
/* Version 3.20.0 and later */
|
||||||
|
int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
|
||||||
|
sqlite3_stmt**,const char**);
|
||||||
|
int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
|
||||||
|
sqlite3_stmt**,const void**);
|
||||||
|
int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
|
||||||
|
void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
|
||||||
|
void *(*value_pointer)(sqlite3_value*,const char*);
|
||||||
|
int (*vtab_nochange)(sqlite3_context*);
|
||||||
|
int (*value_nochange)(sqlite3_value*);
|
||||||
|
const char *(*vtab_collation)(sqlite3_index_info*,int);
|
||||||
|
/* Version 3.24.0 and later */
|
||||||
|
int (*keyword_count)(void);
|
||||||
|
int (*keyword_name)(int,const char**,int*);
|
||||||
|
int (*keyword_check)(const char*,int);
|
||||||
|
sqlite3_str *(*str_new)(sqlite3*);
|
||||||
|
char *(*str_finish)(sqlite3_str*);
|
||||||
|
void (*str_appendf)(sqlite3_str*, const char *zFormat, ...);
|
||||||
|
void (*str_vappendf)(sqlite3_str*, const char *zFormat, va_list);
|
||||||
|
void (*str_append)(sqlite3_str*, const char *zIn, int N);
|
||||||
|
void (*str_appendall)(sqlite3_str*, const char *zIn);
|
||||||
|
void (*str_appendchar)(sqlite3_str*, int N, char C);
|
||||||
|
void (*str_reset)(sqlite3_str*);
|
||||||
|
int (*str_errcode)(sqlite3_str*);
|
||||||
|
int (*str_length)(sqlite3_str*);
|
||||||
|
char *(*str_value)(sqlite3_str*);
|
||||||
|
/* Version 3.25.0 and later */
|
||||||
|
int (*create_window_function)(sqlite3*,const char*,int,int,void*,
|
||||||
|
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
|
||||||
|
void (*xFinal)(sqlite3_context*),
|
||||||
|
void (*xValue)(sqlite3_context*),
|
||||||
|
void (*xInv)(sqlite3_context*,int,sqlite3_value**),
|
||||||
|
void(*xDestroy)(void*));
|
||||||
|
/* Version 3.26.0 and later */
|
||||||
|
const char *(*normalized_sql)(sqlite3_stmt*);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This is the function signature used for all extension entry points. It
|
||||||
|
** is also defined in the file "loadext.c".
|
||||||
|
*/
|
||||||
|
typedef int (*sqlite3_loadext_entry)(
|
||||||
|
sqlite3 *db, /* Handle to the database. */
|
||||||
|
char **pzErrMsg, /* Used to set error string on failure. */
|
||||||
|
const sqlite3_api_routines *pThunk /* Extension API function pointers. */
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** The following macros redefine the API routines so that they are
|
||||||
|
** redirected through the global sqlite3_api structure.
|
||||||
|
**
|
||||||
|
** This header file is also used by the loadext.c source file
|
||||||
|
** (part of the main SQLite library - not an extension) so that
|
||||||
|
** it can get access to the sqlite3_api_routines structure
|
||||||
|
** definition. But the main library does not want to redefine
|
||||||
|
** the API. So the redefinition macros are only valid if the
|
||||||
|
** SQLITE_CORE macros is undefined.
|
||||||
|
*/
|
||||||
|
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
||||||
|
#define sqlite3_aggregate_context sqlite3_api->aggregate_context
|
||||||
|
#ifndef SQLITE_OMIT_DEPRECATED
|
||||||
|
#define sqlite3_aggregate_count sqlite3_api->aggregate_count
|
||||||
|
#endif
|
||||||
|
#define sqlite3_bind_blob sqlite3_api->bind_blob
|
||||||
|
#define sqlite3_bind_double sqlite3_api->bind_double
|
||||||
|
#define sqlite3_bind_int sqlite3_api->bind_int
|
||||||
|
#define sqlite3_bind_int64 sqlite3_api->bind_int64
|
||||||
|
#define sqlite3_bind_null sqlite3_api->bind_null
|
||||||
|
#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count
|
||||||
|
#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index
|
||||||
|
#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name
|
||||||
|
#define sqlite3_bind_text sqlite3_api->bind_text
|
||||||
|
#define sqlite3_bind_text16 sqlite3_api->bind_text16
|
||||||
|
#define sqlite3_bind_value sqlite3_api->bind_value
|
||||||
|
#define sqlite3_busy_handler sqlite3_api->busy_handler
|
||||||
|
#define sqlite3_busy_timeout sqlite3_api->busy_timeout
|
||||||
|
#define sqlite3_changes sqlite3_api->changes
|
||||||
|
#define sqlite3_close sqlite3_api->close
|
||||||
|
#define sqlite3_collation_needed sqlite3_api->collation_needed
|
||||||
|
#define sqlite3_collation_needed16 sqlite3_api->collation_needed16
|
||||||
|
#define sqlite3_column_blob sqlite3_api->column_blob
|
||||||
|
#define sqlite3_column_bytes sqlite3_api->column_bytes
|
||||||
|
#define sqlite3_column_bytes16 sqlite3_api->column_bytes16
|
||||||
|
#define sqlite3_column_count sqlite3_api->column_count
|
||||||
|
#define sqlite3_column_database_name sqlite3_api->column_database_name
|
||||||
|
#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
|
||||||
|
#define sqlite3_column_decltype sqlite3_api->column_decltype
|
||||||
|
#define sqlite3_column_decltype16 sqlite3_api->column_decltype16
|
||||||
|
#define sqlite3_column_double sqlite3_api->column_double
|
||||||
|
#define sqlite3_column_int sqlite3_api->column_int
|
||||||
|
#define sqlite3_column_int64 sqlite3_api->column_int64
|
||||||
|
#define sqlite3_column_name sqlite3_api->column_name
|
||||||
|
#define sqlite3_column_name16 sqlite3_api->column_name16
|
||||||
|
#define sqlite3_column_origin_name sqlite3_api->column_origin_name
|
||||||
|
#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16
|
||||||
|
#define sqlite3_column_table_name sqlite3_api->column_table_name
|
||||||
|
#define sqlite3_column_table_name16 sqlite3_api->column_table_name16
|
||||||
|
#define sqlite3_column_text sqlite3_api->column_text
|
||||||
|
#define sqlite3_column_text16 sqlite3_api->column_text16
|
||||||
|
#define sqlite3_column_type sqlite3_api->column_type
|
||||||
|
#define sqlite3_column_value sqlite3_api->column_value
|
||||||
|
#define sqlite3_commit_hook sqlite3_api->commit_hook
|
||||||
|
#define sqlite3_complete sqlite3_api->complete
|
||||||
|
#define sqlite3_complete16 sqlite3_api->complete16
|
||||||
|
#define sqlite3_create_collation sqlite3_api->create_collation
|
||||||
|
#define sqlite3_create_collation16 sqlite3_api->create_collation16
|
||||||
|
#define sqlite3_create_function sqlite3_api->create_function
|
||||||
|
#define sqlite3_create_function16 sqlite3_api->create_function16
|
||||||
|
#define sqlite3_create_module sqlite3_api->create_module
|
||||||
|
#define sqlite3_create_module_v2 sqlite3_api->create_module_v2
|
||||||
|
#define sqlite3_data_count sqlite3_api->data_count
|
||||||
|
#define sqlite3_db_handle sqlite3_api->db_handle
|
||||||
|
#define sqlite3_declare_vtab sqlite3_api->declare_vtab
|
||||||
|
#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache
|
||||||
|
#define sqlite3_errcode sqlite3_api->errcode
|
||||||
|
#define sqlite3_errmsg sqlite3_api->errmsg
|
||||||
|
#define sqlite3_errmsg16 sqlite3_api->errmsg16
|
||||||
|
#define sqlite3_exec sqlite3_api->exec
|
||||||
|
#ifndef SQLITE_OMIT_DEPRECATED
|
||||||
|
#define sqlite3_expired sqlite3_api->expired
|
||||||
|
#endif
|
||||||
|
#define sqlite3_finalize sqlite3_api->finalize
|
||||||
|
#define sqlite3_free sqlite3_api->free
|
||||||
|
#define sqlite3_free_table sqlite3_api->free_table
|
||||||
|
#define sqlite3_get_autocommit sqlite3_api->get_autocommit
|
||||||
|
#define sqlite3_get_auxdata sqlite3_api->get_auxdata
|
||||||
|
#define sqlite3_get_table sqlite3_api->get_table
|
||||||
|
#ifndef SQLITE_OMIT_DEPRECATED
|
||||||
|
#define sqlite3_global_recover sqlite3_api->global_recover
|
||||||
|
#endif
|
||||||
|
#define sqlite3_interrupt sqlite3_api->interruptx
|
||||||
|
#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid
|
||||||
|
#define sqlite3_libversion sqlite3_api->libversion
|
||||||
|
#define sqlite3_libversion_number sqlite3_api->libversion_number
|
||||||
|
#define sqlite3_malloc sqlite3_api->malloc
|
||||||
|
#define sqlite3_mprintf sqlite3_api->mprintf
|
||||||
|
#define sqlite3_open sqlite3_api->open
|
||||||
|
#define sqlite3_open16 sqlite3_api->open16
|
||||||
|
#define sqlite3_prepare sqlite3_api->prepare
|
||||||
|
#define sqlite3_prepare16 sqlite3_api->prepare16
|
||||||
|
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
|
||||||
|
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
|
||||||
|
#define sqlite3_profile sqlite3_api->profile
|
||||||
|
#define sqlite3_progress_handler sqlite3_api->progress_handler
|
||||||
|
#define sqlite3_realloc sqlite3_api->realloc
|
||||||
|
#define sqlite3_reset sqlite3_api->reset
|
||||||
|
#define sqlite3_result_blob sqlite3_api->result_blob
|
||||||
|
#define sqlite3_result_double sqlite3_api->result_double
|
||||||
|
#define sqlite3_result_error sqlite3_api->result_error
|
||||||
|
#define sqlite3_result_error16 sqlite3_api->result_error16
|
||||||
|
#define sqlite3_result_int sqlite3_api->result_int
|
||||||
|
#define sqlite3_result_int64 sqlite3_api->result_int64
|
||||||
|
#define sqlite3_result_null sqlite3_api->result_null
|
||||||
|
#define sqlite3_result_text sqlite3_api->result_text
|
||||||
|
#define sqlite3_result_text16 sqlite3_api->result_text16
|
||||||
|
#define sqlite3_result_text16be sqlite3_api->result_text16be
|
||||||
|
#define sqlite3_result_text16le sqlite3_api->result_text16le
|
||||||
|
#define sqlite3_result_value sqlite3_api->result_value
|
||||||
|
#define sqlite3_rollback_hook sqlite3_api->rollback_hook
|
||||||
|
#define sqlite3_set_authorizer sqlite3_api->set_authorizer
|
||||||
|
#define sqlite3_set_auxdata sqlite3_api->set_auxdata
|
||||||
|
#define sqlite3_snprintf sqlite3_api->xsnprintf
|
||||||
|
#define sqlite3_step sqlite3_api->step
|
||||||
|
#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
|
||||||
|
#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
|
||||||
|
#define sqlite3_total_changes sqlite3_api->total_changes
|
||||||
|
#define sqlite3_trace sqlite3_api->trace
|
||||||
|
#ifndef SQLITE_OMIT_DEPRECATED
|
||||||
|
#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings
|
||||||
|
#endif
|
||||||
|
#define sqlite3_update_hook sqlite3_api->update_hook
|
||||||
|
#define sqlite3_user_data sqlite3_api->user_data
|
||||||
|
#define sqlite3_value_blob sqlite3_api->value_blob
|
||||||
|
#define sqlite3_value_bytes sqlite3_api->value_bytes
|
||||||
|
#define sqlite3_value_bytes16 sqlite3_api->value_bytes16
|
||||||
|
#define sqlite3_value_double sqlite3_api->value_double
|
||||||
|
#define sqlite3_value_int sqlite3_api->value_int
|
||||||
|
#define sqlite3_value_int64 sqlite3_api->value_int64
|
||||||
|
#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type
|
||||||
|
#define sqlite3_value_text sqlite3_api->value_text
|
||||||
|
#define sqlite3_value_text16 sqlite3_api->value_text16
|
||||||
|
#define sqlite3_value_text16be sqlite3_api->value_text16be
|
||||||
|
#define sqlite3_value_text16le sqlite3_api->value_text16le
|
||||||
|
#define sqlite3_value_type sqlite3_api->value_type
|
||||||
|
#define sqlite3_vmprintf sqlite3_api->vmprintf
|
||||||
|
#define sqlite3_vsnprintf sqlite3_api->xvsnprintf
|
||||||
|
#define sqlite3_overload_function sqlite3_api->overload_function
|
||||||
|
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
|
||||||
|
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
|
||||||
|
#define sqlite3_clear_bindings sqlite3_api->clear_bindings
|
||||||
|
#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob
|
||||||
|
#define sqlite3_blob_bytes sqlite3_api->blob_bytes
|
||||||
|
#define sqlite3_blob_close sqlite3_api->blob_close
|
||||||
|
#define sqlite3_blob_open sqlite3_api->blob_open
|
||||||
|
#define sqlite3_blob_read sqlite3_api->blob_read
|
||||||
|
#define sqlite3_blob_write sqlite3_api->blob_write
|
||||||
|
#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2
|
||||||
|
#define sqlite3_file_control sqlite3_api->file_control
|
||||||
|
#define sqlite3_memory_highwater sqlite3_api->memory_highwater
|
||||||
|
#define sqlite3_memory_used sqlite3_api->memory_used
|
||||||
|
#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc
|
||||||
|
#define sqlite3_mutex_enter sqlite3_api->mutex_enter
|
||||||
|
#define sqlite3_mutex_free sqlite3_api->mutex_free
|
||||||
|
#define sqlite3_mutex_leave sqlite3_api->mutex_leave
|
||||||
|
#define sqlite3_mutex_try sqlite3_api->mutex_try
|
||||||
|
#define sqlite3_open_v2 sqlite3_api->open_v2
|
||||||
|
#define sqlite3_release_memory sqlite3_api->release_memory
|
||||||
|
#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem
|
||||||
|
#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig
|
||||||
|
#define sqlite3_sleep sqlite3_api->sleep
|
||||||
|
#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit
|
||||||
|
#define sqlite3_vfs_find sqlite3_api->vfs_find
|
||||||
|
#define sqlite3_vfs_register sqlite3_api->vfs_register
|
||||||
|
#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
|
||||||
|
#define sqlite3_threadsafe sqlite3_api->xthreadsafe
|
||||||
|
#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob
|
||||||
|
#define sqlite3_result_error_code sqlite3_api->result_error_code
|
||||||
|
#define sqlite3_test_control sqlite3_api->test_control
|
||||||
|
#define sqlite3_randomness sqlite3_api->randomness
|
||||||
|
#define sqlite3_context_db_handle sqlite3_api->context_db_handle
|
||||||
|
#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes
|
||||||
|
#define sqlite3_limit sqlite3_api->limit
|
||||||
|
#define sqlite3_next_stmt sqlite3_api->next_stmt
|
||||||
|
#define sqlite3_sql sqlite3_api->sql
|
||||||
|
#define sqlite3_status sqlite3_api->status
|
||||||
|
#define sqlite3_backup_finish sqlite3_api->backup_finish
|
||||||
|
#define sqlite3_backup_init sqlite3_api->backup_init
|
||||||
|
#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount
|
||||||
|
#define sqlite3_backup_remaining sqlite3_api->backup_remaining
|
||||||
|
#define sqlite3_backup_step sqlite3_api->backup_step
|
||||||
|
#define sqlite3_compileoption_get sqlite3_api->compileoption_get
|
||||||
|
#define sqlite3_compileoption_used sqlite3_api->compileoption_used
|
||||||
|
#define sqlite3_create_function_v2 sqlite3_api->create_function_v2
|
||||||
|
#define sqlite3_db_config sqlite3_api->db_config
|
||||||
|
#define sqlite3_db_mutex sqlite3_api->db_mutex
|
||||||
|
#define sqlite3_db_status sqlite3_api->db_status
|
||||||
|
#define sqlite3_extended_errcode sqlite3_api->extended_errcode
|
||||||
|
#define sqlite3_log sqlite3_api->log
|
||||||
|
#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64
|
||||||
|
#define sqlite3_sourceid sqlite3_api->sourceid
|
||||||
|
#define sqlite3_stmt_status sqlite3_api->stmt_status
|
||||||
|
#define sqlite3_strnicmp sqlite3_api->strnicmp
|
||||||
|
#define sqlite3_unlock_notify sqlite3_api->unlock_notify
|
||||||
|
#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint
|
||||||
|
#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint
|
||||||
|
#define sqlite3_wal_hook sqlite3_api->wal_hook
|
||||||
|
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
|
||||||
|
#define sqlite3_vtab_config sqlite3_api->vtab_config
|
||||||
|
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
|
||||||
|
/* Version 3.7.16 and later */
|
||||||
|
#define sqlite3_close_v2 sqlite3_api->close_v2
|
||||||
|
#define sqlite3_db_filename sqlite3_api->db_filename
|
||||||
|
#define sqlite3_db_readonly sqlite3_api->db_readonly
|
||||||
|
#define sqlite3_db_release_memory sqlite3_api->db_release_memory
|
||||||
|
#define sqlite3_errstr sqlite3_api->errstr
|
||||||
|
#define sqlite3_stmt_busy sqlite3_api->stmt_busy
|
||||||
|
#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly
|
||||||
|
#define sqlite3_stricmp sqlite3_api->stricmp
|
||||||
|
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
|
||||||
|
#define sqlite3_uri_int64 sqlite3_api->uri_int64
|
||||||
|
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
|
||||||
|
#define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf
|
||||||
|
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
|
||||||
|
/* Version 3.8.7 and later */
|
||||||
|
#define sqlite3_auto_extension sqlite3_api->auto_extension
|
||||||
|
#define sqlite3_bind_blob64 sqlite3_api->bind_blob64
|
||||||
|
#define sqlite3_bind_text64 sqlite3_api->bind_text64
|
||||||
|
#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
|
||||||
|
#define sqlite3_load_extension sqlite3_api->load_extension
|
||||||
|
#define sqlite3_malloc64 sqlite3_api->malloc64
|
||||||
|
#define sqlite3_msize sqlite3_api->msize
|
||||||
|
#define sqlite3_realloc64 sqlite3_api->realloc64
|
||||||
|
#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
|
||||||
|
#define sqlite3_result_blob64 sqlite3_api->result_blob64
|
||||||
|
#define sqlite3_result_text64 sqlite3_api->result_text64
|
||||||
|
#define sqlite3_strglob sqlite3_api->strglob
|
||||||
|
/* Version 3.8.11 and later */
|
||||||
|
#define sqlite3_value_dup sqlite3_api->value_dup
|
||||||
|
#define sqlite3_value_free sqlite3_api->value_free
|
||||||
|
#define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64
|
||||||
|
#define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64
|
||||||
|
/* Version 3.9.0 and later */
|
||||||
|
#define sqlite3_value_subtype sqlite3_api->value_subtype
|
||||||
|
#define sqlite3_result_subtype sqlite3_api->result_subtype
|
||||||
|
/* Version 3.10.0 and later */
|
||||||
|
#define sqlite3_status64 sqlite3_api->status64
|
||||||
|
#define sqlite3_strlike sqlite3_api->strlike
|
||||||
|
#define sqlite3_db_cacheflush sqlite3_api->db_cacheflush
|
||||||
|
/* Version 3.12.0 and later */
|
||||||
|
#define sqlite3_system_errno sqlite3_api->system_errno
|
||||||
|
/* Version 3.14.0 and later */
|
||||||
|
#define sqlite3_trace_v2 sqlite3_api->trace_v2
|
||||||
|
#define sqlite3_expanded_sql sqlite3_api->expanded_sql
|
||||||
|
/* Version 3.18.0 and later */
|
||||||
|
#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
|
||||||
|
/* Version 3.20.0 and later */
|
||||||
|
#define sqlite3_prepare_v3 sqlite3_api->prepare_v3
|
||||||
|
#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3
|
||||||
|
#define sqlite3_bind_pointer sqlite3_api->bind_pointer
|
||||||
|
#define sqlite3_result_pointer sqlite3_api->result_pointer
|
||||||
|
#define sqlite3_value_pointer sqlite3_api->value_pointer
|
||||||
|
/* Version 3.22.0 and later */
|
||||||
|
#define sqlite3_vtab_nochange sqlite3_api->vtab_nochange
|
||||||
|
#define sqlite3_value_nochange sqlite3_api->value_nochange
|
||||||
|
#define sqlite3_vtab_collation sqlite3_api->vtab_collation
|
||||||
|
/* Version 3.24.0 and later */
|
||||||
|
#define sqlite3_keyword_count sqlite3_api->keyword_count
|
||||||
|
#define sqlite3_keyword_name sqlite3_api->keyword_name
|
||||||
|
#define sqlite3_keyword_check sqlite3_api->keyword_check
|
||||||
|
#define sqlite3_str_new sqlite3_api->str_new
|
||||||
|
#define sqlite3_str_finish sqlite3_api->str_finish
|
||||||
|
#define sqlite3_str_appendf sqlite3_api->str_appendf
|
||||||
|
#define sqlite3_str_vappendf sqlite3_api->str_vappendf
|
||||||
|
#define sqlite3_str_append sqlite3_api->str_append
|
||||||
|
#define sqlite3_str_appendall sqlite3_api->str_appendall
|
||||||
|
#define sqlite3_str_appendchar sqlite3_api->str_appendchar
|
||||||
|
#define sqlite3_str_reset sqlite3_api->str_reset
|
||||||
|
#define sqlite3_str_errcode sqlite3_api->str_errcode
|
||||||
|
#define sqlite3_str_length sqlite3_api->str_length
|
||||||
|
#define sqlite3_str_value sqlite3_api->str_value
|
||||||
|
/* Version 3.25.0 and later */
|
||||||
|
#define sqlite3_create_window_function sqlite3_api->create_window_function
|
||||||
|
/* Version 3.26.0 and later */
|
||||||
|
#define sqlite3_normalized_sql sqlite3_api->normalized_sql
|
||||||
|
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
||||||
|
|
||||||
|
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
||||||
|
/* This case when the file really is being compiled as a loadable
|
||||||
|
** extension */
|
||||||
|
# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
|
||||||
|
# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v;
|
||||||
|
# define SQLITE_EXTENSION_INIT3 \
|
||||||
|
extern const sqlite3_api_routines *sqlite3_api;
|
||||||
|
#else
|
||||||
|
/* This case when the file is being statically linked into the
|
||||||
|
** application */
|
||||||
|
# define SQLITE_EXTENSION_INIT1 /*no-op*/
|
||||||
|
# define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */
|
||||||
|
# define SQLITE_EXTENSION_INIT3 /*no-op*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* SQLITE3EXT_H */
|
@ -78,7 +78,9 @@ SOURCES += \
|
|||||||
jsc.cpp \
|
jsc.cpp \
|
||||||
jsc_list.cpp \
|
jsc_list.cpp \
|
||||||
jsc_map.cpp \
|
jsc_map.cpp \
|
||||||
jsc_checker.cpp
|
jsc_checker.cpp \
|
||||||
|
Message.cpp \
|
||||||
|
Inbox.cpp
|
||||||
|
|
||||||
HEADERS += qt_helpers.hpp \
|
HEADERS += qt_helpers.hpp \
|
||||||
pimpl_h.hpp pimpl_impl.hpp \
|
pimpl_h.hpp pimpl_impl.hpp \
|
||||||
@ -107,7 +109,9 @@ HEADERS += qt_helpers.hpp \
|
|||||||
keyeater.h \
|
keyeater.h \
|
||||||
DriftingDateTime.h \
|
DriftingDateTime.h \
|
||||||
jsc.h \
|
jsc.h \
|
||||||
jsc_checker.h
|
jsc_checker.h \
|
||||||
|
Message.h \
|
||||||
|
Inbox.h
|
||||||
|
|
||||||
|
|
||||||
INCLUDEPATH += qmake_only
|
INCLUDEPATH += qmake_only
|
||||||
|
Loading…
Reference in New Issue
Block a user