Feed column in Messages table is now TEXT.
This commit is contained in:
parent
cff9c84b5a
commit
3d026ec955
@ -74,7 +74,7 @@ CREATE TABLE IF NOT EXISTS Messages (
|
|||||||
is_read INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_read >= 0 AND is_read <= 1),
|
is_read INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_read >= 0 AND is_read <= 1),
|
||||||
is_deleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_deleted >= 0 AND is_deleted <= 1),
|
is_deleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_deleted >= 0 AND is_deleted <= 1),
|
||||||
is_important INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_important >= 0 AND is_important <= 1),
|
is_important INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_important >= 0 AND is_important <= 1),
|
||||||
feed INTEGER NOT NULL,
|
feed TEXT,
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
title TEXT NOT NULL CHECK (title != ''),
|
||||||
url TEXT NOT NULL,
|
url TEXT NOT NULL,
|
||||||
author TEXT NOT NULL,
|
author TEXT NOT NULL,
|
||||||
|
@ -69,7 +69,7 @@ CREATE TABLE IF NOT EXISTS Messages (
|
|||||||
is_read INTEGER(1) NOT NULL CHECK (is_read >= 0 AND is_read <= 1) DEFAULT (0),
|
is_read INTEGER(1) NOT NULL CHECK (is_read >= 0 AND is_read <= 1) DEFAULT (0),
|
||||||
is_deleted INTEGER(1) NOT NULL CHECK (is_deleted >= 0 AND is_deleted <= 1) DEFAULT (0),
|
is_deleted INTEGER(1) NOT NULL CHECK (is_deleted >= 0 AND is_deleted <= 1) DEFAULT (0),
|
||||||
is_important INTEGER(1) NOT NULL CHECK (is_important >= 0 AND is_important <= 1) DEFAULT (0),
|
is_important INTEGER(1) NOT NULL CHECK (is_important >= 0 AND is_important <= 1) DEFAULT (0),
|
||||||
feed INTEGER NOT NULL,
|
feed TEXT,
|
||||||
title TEXT NOT NULL CHECK (title != ''),
|
title TEXT NOT NULL CHECK (title != ''),
|
||||||
url TEXT NOT NULL,
|
url TEXT NOT NULL,
|
||||||
author TEXT NOT NULL,
|
author TEXT NOT NULL,
|
||||||
|
@ -37,4 +37,7 @@ ADD COLUMN custom_id TEXT;
|
|||||||
ALTER TABLE Messages
|
ALTER TABLE Messages
|
||||||
DROP FOREIGN KEY feed;
|
DROP FOREIGN KEY feed;
|
||||||
-- !
|
-- !
|
||||||
|
ALTER TABLE Messages
|
||||||
|
MODIFY Feeds TEXT;
|
||||||
|
-- !
|
||||||
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';
|
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';
|
@ -34,4 +34,31 @@ ADD COLUMN custom_id TEXT;
|
|||||||
ALTER TABLE Categories
|
ALTER TABLE Categories
|
||||||
ADD COLUMN custom_id TEXT;
|
ADD COLUMN custom_id TEXT;
|
||||||
-- !
|
-- !
|
||||||
|
CREATE TABLE backup_Messages AS SELECT * FROM Messages;
|
||||||
|
-- !
|
||||||
|
DROP TABLE Messages;
|
||||||
|
-- !
|
||||||
|
CREATE TABLE Messages (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
is_read INTEGER(1) NOT NULL CHECK (is_read >= 0 AND is_read <= 1) DEFAULT (0),
|
||||||
|
is_deleted INTEGER(1) NOT NULL CHECK (is_deleted >= 0 AND is_deleted <= 1) DEFAULT (0),
|
||||||
|
is_important INTEGER(1) NOT NULL CHECK (is_important >= 0 AND is_important <= 1) DEFAULT (0),
|
||||||
|
feed TEXT,
|
||||||
|
title TEXT NOT NULL CHECK (title != ''),
|
||||||
|
url TEXT NOT NULL,
|
||||||
|
author TEXT NOT NULL,
|
||||||
|
date_created INTEGER NOT NULL CHECK (date_created != 0),
|
||||||
|
contents TEXT,
|
||||||
|
is_pdeleted INTEGER(1) NOT NULL DEFAULT 0 CHECK (is_pdeleted >= 0 AND is_pdeleted <= 1),
|
||||||
|
enclosures TEXT,
|
||||||
|
account_id INTEGER NOT NULL,
|
||||||
|
custom_id TEXT,
|
||||||
|
|
||||||
|
FOREIGN KEY (account_id) REFERENCES Accounts (id)
|
||||||
|
);
|
||||||
|
-- !
|
||||||
|
INSERT INTO Messages SELECT * FROM backup_Messages;
|
||||||
|
-- !
|
||||||
|
DROP TABLE backup_Messages;
|
||||||
|
-- !
|
||||||
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';
|
UPDATE Information SET inf_value = '4' WHERE inf_key = 'schema_version';
|
@ -26,8 +26,6 @@ LabelWithStatus::LabelWithStatus(QWidget *parent)
|
|||||||
: WidgetWithStatus(parent) {
|
: WidgetWithStatus(parent) {
|
||||||
m_wdgInput = new QLabel(this);
|
m_wdgInput = new QLabel(this);
|
||||||
|
|
||||||
qobject_cast<QLabel*>(m_wdgInput)->setWordWrap(true);
|
|
||||||
|
|
||||||
// Set correct size for the tool button.
|
// Set correct size for the tool button.
|
||||||
int label_height = m_wdgInput->sizeHint().height();
|
int label_height = m_wdgInput->sizeHint().height();
|
||||||
m_btnStatus->setFixedSize(label_height, label_height);
|
m_btnStatus->setFixedSize(label_height, label_height);
|
||||||
|
@ -189,14 +189,14 @@ void StandardFeed::updateCounts(bool including_total_count) {
|
|||||||
query_all.setForwardOnly(true);
|
query_all.setForwardOnly(true);
|
||||||
|
|
||||||
if (including_total_count) {
|
if (including_total_count) {
|
||||||
if (query_all.exec(QString("SELECT count(*) FROM Messages WHERE feed = %1 AND is_deleted = 0 AND account_id = %2;").arg(QString::number(id()),
|
if (query_all.exec(QString("SELECT count(*) FROM Messages WHERE feed = '%1' AND is_deleted = 0 AND account_id = %2;").arg(QString::number(id()),
|
||||||
QString::number(const_cast<StandardFeed*>(this)->serviceRoot()->accountId()))) && query_all.next()) {
|
QString::number(const_cast<StandardFeed*>(this)->serviceRoot()->accountId()))) && query_all.next()) {
|
||||||
m_totalCount = query_all.value(0).toInt();
|
m_totalCount = query_all.value(0).toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtain count of unread messages.
|
// Obtain count of unread messages.
|
||||||
if (query_all.exec(QString("SELECT count(*) FROM Messages WHERE feed = %1 AND is_deleted = 0 AND is_read = 0 AND account_id = %2;").arg(QString::number(id()),
|
if (query_all.exec(QString("SELECT count(*) FROM Messages WHERE feed = '%1' AND is_deleted = 0 AND is_read = 0 AND account_id = %2;").arg(QString::number(id()),
|
||||||
QString::number(const_cast<StandardFeed*>(this)->serviceRoot()->accountId()))) && query_all.next()) {
|
QString::number(const_cast<StandardFeed*>(this)->serviceRoot()->accountId()))) && query_all.next()) {
|
||||||
int new_unread_count = query_all.value(0).toInt();
|
int new_unread_count = query_all.value(0).toInt();
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ bool FeedsImportExportModel::importAsOPML20(const QByteArray &data) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
StandardServiceRoot *root_item = new StandardServiceRoot(false);
|
StandardServiceRoot *root_item = new StandardServiceRoot();
|
||||||
QStack<RootItem*> model_items; model_items.push(root_item);
|
QStack<RootItem*> model_items; model_items.push(root_item);
|
||||||
QStack<QDomElement> elements_to_process; elements_to_process.push(opml_document.documentElement().elementsByTagName(QSL("body")).at(0).toElement());
|
QStack<QDomElement> elements_to_process; elements_to_process.push(opml_document.documentElement().elementsByTagName(QSL("body")).at(0).toElement());
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ QStringList StandardServiceRoot::textualFeedIds(const QList<Feed*> &feeds) {
|
|||||||
stringy_ids.reserve(feeds.size());
|
stringy_ids.reserve(feeds.size());
|
||||||
|
|
||||||
foreach (Feed *feed, feeds) {
|
foreach (Feed *feed, feeds) {
|
||||||
stringy_ids.append(QString::number(feed->id()));
|
stringy_ids.append(QString("'%1'").arg(QString::number(feed->id())));
|
||||||
}
|
}
|
||||||
|
|
||||||
return stringy_ids;
|
return stringy_ids;
|
||||||
@ -632,13 +632,7 @@ bool StandardServiceRoot::loadMessagesForItem(RootItem *item, QSqlTableModel *mo
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QList<Feed*> children = item->getSubTreeFeeds();
|
QList<Feed*> children = item->getSubTreeFeeds();
|
||||||
QStringList stringy_ids;
|
QString filter_clause = textualFeedIds(children).join(QSL(", "));
|
||||||
|
|
||||||
foreach (Feed *child, children) {
|
|
||||||
stringy_ids.append(QString::number(child->id()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString filter_clause = stringy_ids.join(QSL(", "));
|
|
||||||
|
|
||||||
model->setFilter(QString(QSL("feed IN (%1) AND is_deleted = 0 AND is_pdeleted = 0")).arg(filter_clause));
|
model->setFilter(QString(QSL("feed IN (%1) AND is_deleted = 0 AND is_pdeleted = 0")).arg(filter_clause));
|
||||||
qDebug("Loading messages from feeds: %s.", qPrintable(filter_clause));
|
qDebug("Loading messages from feeds: %s.", qPrintable(filter_clause));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user