"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/sync-error-service.cpp" between
seafile-client-9.0.1.tar.gz and seafile-client-9.0.2.tar.gz

About: Seafile (client) for the Seafile cloud storage system.

sync-error-service.cpp  (seafile-client-9.0.1):sync-error-service.cpp  (seafile-client-9.0.2)
skipping to change at line 53 skipping to change at line 53
seafApplet->errorAndExit(QObject::tr("failed to open sync error id datab ase")); seafApplet->errorAndExit(QObject::tr("failed to open sync error id datab ase"));
return; return;
} }
sql = "CREATE TABLE IF NOT EXISTS SyncErrorID (" sql = "CREATE TABLE IF NOT EXISTS SyncErrorID ("
" id integer NOT NULL, " " id integer NOT NULL, "
" accountsig VARCHAR(255) NOT NULL, " " accountsig VARCHAR(255) NOT NULL, "
" PRIMARY KEY (accountsig))"; " PRIMARY KEY (accountsig))";
sqlite_query_exec (db, sql); sqlite_query_exec (db, sql);
// RepoSyncError table records special type errors, which will be persistent
displayed on the RepoTreeView.
sql = "CREATE TABLE IF NOT EXISTS RepoSyncError ("
" accountsig text NOT NULL,"
" repoid text NOT NULL,"
" errid integer NOT NULL,"
" PRIMARY KEY (accountsig, repoid)"
")";
sqlite_query_exec (db, sql);
db_ = db; db_ = db;
} }
void LastSyncError::saveLatestErrorID(const int id) void LastSyncError::saveLatestErrorID(const int id)
{ {
QString account_sig = seafApplet->accountManager()->currentAccount().getSign ature(); QString account_sig = seafApplet->accountManager()->currentAccount().getSign ature();
char *zql = sqlite3_mprintf("REPLACE INTO SyncErrorID(id, accountsig)" char *zql = sqlite3_mprintf("REPLACE INTO SyncErrorID(id, accountsig)"
" VALUES (%d, %Q)", " VALUES (%d, %Q)",
id, id,
account_sig.toUtf8().data()); account_sig.toUtf8().data());
skipping to change at line 90 skipping to change at line 99
" FROM SyncErrorID" " FROM SyncErrorID"
" WHERE accountsig = %Q", " WHERE accountsig = %Q",
toCStr(account_sig)); toCStr(account_sig));
QList<SyncErrorInfo> list; QList<SyncErrorInfo> list;
sqlite_foreach_selected_row(db_, sql, collectSyncError, &list); sqlite_foreach_selected_row(db_, sql, collectSyncError, &list);
if (list.size() >= 1) { if (list.size() >= 1) {
return list[0].id; return list[0].id;
} }
return 0; return 0;
} }
bool LastSyncError::collectRepoSyncError(sqlite3_stmt *stmt, void *data)
{
RepoSyncError *repo_sync_error = static_cast<RepoSyncError *>(data);
repo_sync_error->account_sig = reinterpret_cast<const char *>(sqlite3_column
_text(stmt, 0));
repo_sync_error->repo_id = reinterpret_cast<const char *>(sqlite3_column_tex
t(stmt, 1));
repo_sync_error->err_id = sqlite3_column_int(stmt, 2);
return true;
}
int LastSyncError::getRepoSyncError(const QString repo_id)
{
QString account_sig = seafApplet->accountManager()->currentAccount().getSign
ature();
char *sql = sqlite3_mprintf("SELECT * FROM RepoSyncError WHERE accountsig =
%Q AND repoid = %Q",
toCStr(account_sig), toCStr(repo_id));
RepoSyncError repo_sync_error;
int n = sqlite_foreach_selected_row(db_, sql, collectRepoSyncError, &repo_sy
nc_error);
sqlite3_free(sql);
if (n == 0) {
return -1;
}
return repo_sync_error.err_id;
}
void LastSyncError::flagRepoSyncError(const QString repo_id, int err_id)
{
QString account_sig = seafApplet->accountManager()->currentAccount().getSign
ature();
char *sql = sqlite3_mprintf("REPLACE INTO RepoSyncError (accountsig, repoid,
errid) VALUES (%Q, %Q, %d)",
toCStr(account_sig), toCStr(repo_id), err_id);
sqlite_query_exec(db_, sql);
sqlite3_free(sql);
}
void LastSyncError::cleanRepoSyncErrors(const QString repo_id)
{
QString account_sig = seafApplet->accountManager()->currentAccount().getSign
ature();
char *sql = sqlite3_mprintf("DELETE FROM RepoSyncError WHERE accountsig = %Q
AND repoid = %Q",
toCStr(account_sig), toCStr(repo_id));
sqlite_query_exec(db_, sql);
sqlite3_free(sql);
}
void LastSyncError::cleanAllSyncErrors()
{
QString account_sig = seafApplet->accountManager()->currentAccount().getSign
ature();
char *sql = sqlite3_mprintf("DELETE FROM RepoSyncError WHERE accountsig = %Q
",
toCStr(account_sig));
sqlite_query_exec(db_, sql);
sqlite3_free(sql);
}
 End of changes. 2 change blocks. 
0 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)