Add sql for #265.
This commit is contained in:
parent
d3cf130d04
commit
7bef56be53
@ -30,7 +30,7 @@
|
|||||||
<url type="donation">https://martinrotter.github.io/donate/</url>
|
<url type="donation">https://martinrotter.github.io/donate/</url>
|
||||||
<content_rating type="oars-1.1" />
|
<content_rating type="oars-1.1" />
|
||||||
<releases>
|
<releases>
|
||||||
<release version="3.8.4" date="2021-02-01"/>
|
<release version="3.8.4" date="2021-02-02"/>
|
||||||
</releases>
|
</releases>
|
||||||
<content_rating type="oars-1.0">
|
<content_rating type="oars-1.0">
|
||||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
<file>sql/db_update_mysql_16_17.sql</file>
|
<file>sql/db_update_mysql_16_17.sql</file>
|
||||||
<file>sql/db_update_mysql_17_18.sql</file>
|
<file>sql/db_update_mysql_17_18.sql</file>
|
||||||
<file>sql/db_update_mysql_18_19.sql</file>
|
<file>sql/db_update_mysql_18_19.sql</file>
|
||||||
|
<file>sql/db_update_mysql_19_20.sql</file>
|
||||||
|
|
||||||
<file>sql/db_init_sqlite.sql</file>
|
<file>sql/db_init_sqlite.sql</file>
|
||||||
<file>sql/db_update_sqlite_1_2.sql</file>
|
<file>sql/db_update_sqlite_1_2.sql</file>
|
||||||
@ -39,5 +40,6 @@
|
|||||||
<file>sql/db_update_sqlite_16_17.sql</file>
|
<file>sql/db_update_sqlite_16_17.sql</file>
|
||||||
<file>sql/db_update_sqlite_17_18.sql</file>
|
<file>sql/db_update_sqlite_17_18.sql</file>
|
||||||
<file>sql/db_update_sqlite_18_19.sql</file>
|
<file>sql/db_update_sqlite_18_19.sql</file>
|
||||||
|
<file>sql/db_update_sqlite_19_20.sql</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Information (
|
|||||||
inf_value TEXT NOT NULL
|
inf_value TEXT NOT NULL
|
||||||
);
|
);
|
||||||
-- !
|
-- !
|
||||||
INSERT INTO Information VALUES (1, 'schema_version', '19');
|
INSERT INTO Information VALUES (1, 'schema_version', '20');
|
||||||
-- !
|
-- !
|
||||||
CREATE TABLE IF NOT EXISTS Accounts (
|
CREATE TABLE IF NOT EXISTS Accounts (
|
||||||
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||||
@ -110,7 +110,9 @@ CREATE TABLE IF NOT EXISTS Feeds (
|
|||||||
icon BLOB,
|
icon BLOB,
|
||||||
category INTEGER NOT NULL CHECK (category >= -1),
|
category INTEGER NOT NULL CHECK (category >= -1),
|
||||||
encoding TEXT,
|
encoding TEXT,
|
||||||
|
source_type INTEGER,
|
||||||
url VARCHAR(1000),
|
url VARCHAR(1000),
|
||||||
|
post_process TEXT,
|
||||||
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
||||||
username TEXT,
|
username TEXT,
|
||||||
password TEXT,
|
password TEXT,
|
||||||
|
@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS Information (
|
|||||||
inf_value TEXT NOT NULL
|
inf_value TEXT NOT NULL
|
||||||
);
|
);
|
||||||
-- !
|
-- !
|
||||||
INSERT INTO Information VALUES (1, 'schema_version', '19');
|
INSERT INTO Information VALUES (1, 'schema_version', '20');
|
||||||
-- !
|
-- !
|
||||||
CREATE TABLE IF NOT EXISTS Accounts (
|
CREATE TABLE IF NOT EXISTS Accounts (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
@ -104,7 +104,9 @@ CREATE TABLE IF NOT EXISTS Feeds (
|
|||||||
icon BLOB,
|
icon BLOB,
|
||||||
category INTEGER NOT NULL CHECK (category >= -1),
|
category INTEGER NOT NULL CHECK (category >= -1),
|
||||||
encoding TEXT,
|
encoding TEXT,
|
||||||
|
source_type INTEGER,
|
||||||
url TEXT,
|
url TEXT,
|
||||||
|
post_process TEXT,
|
||||||
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
||||||
username TEXT,
|
username TEXT,
|
||||||
password TEXT,
|
password TEXT,
|
||||||
|
33
resources/sql/db_update_mysql_19_20.sql
Executable file
33
resources/sql/db_update_mysql_19_20.sql
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
CREATE TABLE backup_feeds AS SELECT * FROM Feeds;
|
||||||
|
-- !
|
||||||
|
DROP TABLE Feeds;
|
||||||
|
-- !
|
||||||
|
CREATE TABLE IF NOT EXISTS Feeds (
|
||||||
|
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
title TEXT NOT NULL CHECK (title != ''),
|
||||||
|
description TEXT,
|
||||||
|
date_created BIGINT,
|
||||||
|
icon BLOB,
|
||||||
|
category INTEGER NOT NULL CHECK (category >= -1),
|
||||||
|
encoding TEXT,
|
||||||
|
source_type INTEGER,
|
||||||
|
url VARCHAR(1000),
|
||||||
|
post_process TEXT,
|
||||||
|
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
||||||
|
username TEXT,
|
||||||
|
password TEXT,
|
||||||
|
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
|
||||||
|
update_interval INTEGER NOT NULL DEFAULT 15 CHECK (update_interval >= 3),
|
||||||
|
type INTEGER,
|
||||||
|
account_id INTEGER NOT NULL,
|
||||||
|
custom_id TEXT,
|
||||||
|
|
||||||
|
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
||||||
|
);
|
||||||
|
-- !
|
||||||
|
INSERT INTO Feeds (id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type, account_id, custom_id)
|
||||||
|
SELECT id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type, account_id, custom_id FROM backup_feeds;
|
||||||
|
-- !
|
||||||
|
DROP TABLE backup_feeds;
|
||||||
|
-- !
|
||||||
|
UPDATE Information SET inf_value = '20' WHERE inf_key = 'schema_version';
|
33
resources/sql/db_update_sqlite_19_20.sql
Executable file
33
resources/sql/db_update_sqlite_19_20.sql
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
CREATE TABLE backup_feeds AS SELECT * FROM Feeds;
|
||||||
|
-- !
|
||||||
|
DROP TABLE Feeds;
|
||||||
|
-- !
|
||||||
|
CREATE TABLE IF NOT EXISTS Feeds (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
title TEXT NOT NULL CHECK (title != ''),
|
||||||
|
description TEXT,
|
||||||
|
date_created INTEGER,
|
||||||
|
icon BLOB,
|
||||||
|
category INTEGER NOT NULL CHECK (category >= -1),
|
||||||
|
encoding TEXT,
|
||||||
|
source_type INTEGER,
|
||||||
|
url TEXT,
|
||||||
|
post_process TEXT,
|
||||||
|
protected INTEGER(1) NOT NULL CHECK (protected >= 0 AND protected <= 1),
|
||||||
|
username TEXT,
|
||||||
|
password TEXT,
|
||||||
|
update_type INTEGER(1) NOT NULL CHECK (update_type >= 0),
|
||||||
|
update_interval INTEGER NOT NULL CHECK (update_interval >= 3) DEFAULT 15,
|
||||||
|
type INTEGER,
|
||||||
|
account_id INTEGER NOT NULL,
|
||||||
|
custom_id TEXT,
|
||||||
|
|
||||||
|
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
||||||
|
);
|
||||||
|
-- !
|
||||||
|
INSERT INTO Feeds (id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type, account_id, custom_id)
|
||||||
|
SELECT id, title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type, account_id, custom_id FROM backup_feeds;
|
||||||
|
-- !
|
||||||
|
DROP TABLE backup_feeds;
|
||||||
|
-- !
|
||||||
|
UPDATE Information SET inf_value = '20' WHERE inf_key = 'schema_version';
|
@ -146,7 +146,7 @@
|
|||||||
#define APP_DB_SQLITE_FILE "database.db"
|
#define APP_DB_SQLITE_FILE "database.db"
|
||||||
|
|
||||||
// Keep this in sync with schema versions declared in SQL initialization code.
|
// Keep this in sync with schema versions declared in SQL initialization code.
|
||||||
#define APP_DB_SCHEMA_VERSION "19"
|
#define APP_DB_SCHEMA_VERSION "20"
|
||||||
#define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
|
#define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
|
||||||
#define APP_DB_COMMENT_SPLIT "-- !\n"
|
#define APP_DB_COMMENT_SPLIT "-- !\n"
|
||||||
#define APP_DB_NAME_PLACEHOLDER "##"
|
#define APP_DB_NAME_PLACEHOLDER "##"
|
||||||
@ -207,15 +207,17 @@
|
|||||||
#define FDS_DB_ICON_INDEX 4
|
#define FDS_DB_ICON_INDEX 4
|
||||||
#define FDS_DB_CATEGORY_INDEX 5
|
#define FDS_DB_CATEGORY_INDEX 5
|
||||||
#define FDS_DB_ENCODING_INDEX 6
|
#define FDS_DB_ENCODING_INDEX 6
|
||||||
#define FDS_DB_URL_INDEX 7
|
#define FDS_DB_SOURCE_TYPE_INDEX 7
|
||||||
#define FDS_DB_PROTECTED_INDEX 8
|
#define FDS_DB_URL_INDEX 8
|
||||||
#define FDS_DB_USERNAME_INDEX 9
|
#define FDS_DB_POST_PROCESS 9
|
||||||
#define FDS_DB_PASSWORD_INDEX 10
|
#define FDS_DB_PROTECTED_INDEX 10
|
||||||
#define FDS_DB_UPDATE_TYPE_INDEX 11
|
#define FDS_DB_USERNAME_INDEX 11
|
||||||
#define FDS_DB_UPDATE_INTERVAL_INDEX 12
|
#define FDS_DB_PASSWORD_INDEX 12
|
||||||
#define FDS_DB_TYPE_INDEX 13
|
#define FDS_DB_UPDATE_TYPE_INDEX 13
|
||||||
#define FDS_DB_ACCOUNT_ID_INDEX 14
|
#define FDS_DB_UPDATE_INTERVAL_INDEX 14
|
||||||
#define FDS_DB_CUSTOM_ID_INDEX 15
|
#define FDS_DB_TYPE_INDEX 15
|
||||||
|
#define FDS_DB_ACCOUNT_ID_INDEX 16
|
||||||
|
#define FDS_DB_CUSTOM_ID_INDEX 17
|
||||||
|
|
||||||
// Indexes of columns for feed models.
|
// Indexes of columns for feed models.
|
||||||
#define FDS_MODEL_TITLE_INDEX 0
|
#define FDS_MODEL_TITLE_INDEX 0
|
||||||
|
@ -123,7 +123,7 @@ void FormAddEditEmail::onOkClicked() {
|
|||||||
.arg(QString(m_ui.m_txtSubject->text().toUtf8().toBase64(QByteArray::Base64Option::Base64UrlEncoding)))
|
.arg(QString(m_ui.m_txtSubject->text().toUtf8().toBase64(QByteArray::Base64Option::Base64UrlEncoding)))
|
||||||
.toStdString();
|
.toStdString();
|
||||||
msg.set_plain(m_ui.m_txtMessage->toPlainText().toStdString());
|
msg.set_plain(m_ui.m_txtMessage->toPlainText().toStdString());
|
||||||
msg.set_header("Content-Type", "text/plain; charset=utf-8");
|
msg.set_header(HTTP_HEADERS_CONTENT_TYPE, "text/plain; charset=utf-8");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
m_root->network()->sendEmail(msg, m_root->networkProxy(), m_originalMessage);
|
m_root->network()->sendEmail(msg, m_root->networkProxy(), m_originalMessage);
|
||||||
|
@ -70,7 +70,7 @@ QNetworkReply::NetworkError GreaderNetwork::editLabels(const QString& state,
|
|||||||
output,
|
output,
|
||||||
QNetworkAccessManager::Operation::PostOperation,
|
QNetworkAccessManager::Operation::PostOperation,
|
||||||
{ authHeader(),
|
{ authHeader(),
|
||||||
{ QSL("Content-Type").toLocal8Bit(),
|
{ QSL(HTTP_HEADERS_CONTENT_TYPE).toLocal8Bit(),
|
||||||
QSL("application/x-www-form-urlencoded").toLocal8Bit() } },
|
QSL("application/x-www-form-urlencoded").toLocal8Bit() } },
|
||||||
false,
|
false,
|
||||||
{},
|
{},
|
||||||
@ -425,7 +425,7 @@ QString GreaderNetwork::serviceToString(GreaderServiceRoot::Service service) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QPair<QByteArray, QByteArray> GreaderNetwork::authHeader() const {
|
QPair<QByteArray, QByteArray> GreaderNetwork::authHeader() const {
|
||||||
return { QSL("Authorization").toLocal8Bit(), QSL("GoogleLogin auth=%1").arg(m_authAuth).toLocal8Bit() };
|
return { QSL(HTTP_HEADERS_AUTHORIZATION).toLocal8Bit(), QSL("GoogleLogin auth=%1").arg(m_authAuth).toLocal8Bit() };
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GreaderNetwork::ensureLogin(const QNetworkProxy& proxy, QNetworkReply::NetworkError* output) {
|
bool GreaderNetwork::ensureLogin(const QNetworkProxy& proxy, QNetworkReply::NetworkError* output) {
|
||||||
|
@ -34,6 +34,7 @@ StandardFeed::StandardFeed(RootItem* parent_item)
|
|||||||
: Feed(parent_item) {
|
: Feed(parent_item) {
|
||||||
m_networkError = QNetworkReply::NetworkError::NoError;
|
m_networkError = QNetworkReply::NetworkError::NoError;
|
||||||
m_type = Type::Rss0X;
|
m_type = Type::Rss0X;
|
||||||
|
m_sourceType = SourceType::Url;
|
||||||
m_encoding = QString();
|
m_encoding = QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ StandardFeed::StandardFeed(const StandardFeed& other)
|
|||||||
: Feed(other) {
|
: Feed(other) {
|
||||||
m_networkError = other.networkError();
|
m_networkError = other.networkError();
|
||||||
m_type = other.type();
|
m_type = other.type();
|
||||||
|
m_sourceType = other.sourceType();
|
||||||
m_encoding = other.encoding();
|
m_encoding = other.encoding();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +141,14 @@ void StandardFeed::fetchMetadataForItself() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StandardFeed::SourceType StandardFeed::sourceType() const {
|
||||||
|
return m_sourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StandardFeed::setSourceType(const SourceType& source_type) {
|
||||||
|
m_sourceType = source_type;
|
||||||
|
}
|
||||||
|
|
||||||
QPair<StandardFeed*, QNetworkReply::NetworkError> StandardFeed::guessFeed(const QString& url,
|
QPair<StandardFeed*, QNetworkReply::NetworkError> StandardFeed::guessFeed(const QString& url,
|
||||||
const QString& username,
|
const QString& username,
|
||||||
const QString& password,
|
const QString& password,
|
||||||
@ -406,6 +416,7 @@ bool StandardFeed::editItself(StandardFeed* new_feed_data) {
|
|||||||
original_feed->setAutoUpdateType(new_feed_data->autoUpdateType());
|
original_feed->setAutoUpdateType(new_feed_data->autoUpdateType());
|
||||||
original_feed->setAutoUpdateInitialInterval(new_feed_data->autoUpdateInitialInterval());
|
original_feed->setAutoUpdateInitialInterval(new_feed_data->autoUpdateInitialInterval());
|
||||||
original_feed->setType(new_feed_data->type());
|
original_feed->setType(new_feed_data->type());
|
||||||
|
original_feed->setSourceType(new_feed_data->sourceType());
|
||||||
|
|
||||||
// Editing is done.
|
// Editing is done.
|
||||||
return true;
|
return true;
|
||||||
@ -506,6 +517,7 @@ QNetworkReply::NetworkError StandardFeed::networkError() const {
|
|||||||
|
|
||||||
StandardFeed::StandardFeed(const QSqlRecord& record) : Feed(record) {
|
StandardFeed::StandardFeed(const QSqlRecord& record) : Feed(record) {
|
||||||
setEncoding(record.value(FDS_DB_ENCODING_INDEX).toString());
|
setEncoding(record.value(FDS_DB_ENCODING_INDEX).toString());
|
||||||
|
setSourceType(SourceType(record.value(FDS_DB_SOURCE_TYPE_INDEX).toInt()));
|
||||||
|
|
||||||
StandardFeed::Type type = static_cast<StandardFeed::Type>(record.value(FDS_DB_TYPE_INDEX).toInt());
|
StandardFeed::Type type = static_cast<StandardFeed::Type>(record.value(FDS_DB_TYPE_INDEX).toInt());
|
||||||
|
|
||||||
@ -520,5 +532,5 @@ StandardFeed::StandardFeed(const QSqlRecord& record) : Feed(record) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_networkError = QNetworkReply::NoError;
|
m_networkError = QNetworkReply::NetworkError::NoError;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,12 @@ class StandardFeed : public Feed {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum class SourceType {
|
||||||
|
Url = 0,
|
||||||
|
Script = 1,
|
||||||
|
LocalFile = 2
|
||||||
|
};
|
||||||
|
|
||||||
enum class Type {
|
enum class Type {
|
||||||
Rss0X = 0,
|
Rss0X = 0,
|
||||||
Rss2X = 1,
|
Rss2X = 1,
|
||||||
@ -59,6 +65,9 @@ class StandardFeed : public Feed {
|
|||||||
Type type() const;
|
Type type() const;
|
||||||
void setType(Type type);
|
void setType(Type type);
|
||||||
|
|
||||||
|
SourceType sourceType() const;
|
||||||
|
void setSourceType(const SourceType& source_type);
|
||||||
|
|
||||||
QString encoding() const;
|
QString encoding() const;
|
||||||
void setEncoding(const QString& encoding);
|
void setEncoding(const QString& encoding);
|
||||||
|
|
||||||
@ -83,6 +92,7 @@ class StandardFeed : public Feed {
|
|||||||
void fetchMetadataForItself();
|
void fetchMetadataForItself();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
SourceType m_sourceType;
|
||||||
Type m_type;
|
Type m_type;
|
||||||
|
|
||||||
QNetworkReply::NetworkError m_networkError;
|
QNetworkReply::NetworkError m_networkError;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user