lokalize
jobs.cpp
Go to the documentation of this file.
134 return qpsql ? (query1.next(), query1.value(0).toLongLong()) : query1.lastInsertId().toLongLong();
319 static bool doRemoveEntry(qlonglong mainId, QRegExp& rxClean1, const QString& accel, QSqlDatabase& db)
323 if (KDE_ISUNLIKELY(!query1.exec(QString("SELECT source_strings.id, source_strings.source FROM source_strings, main WHERE "
343 kWarning(TM_AREA)<<"ok delete?"<<query1.exec(QString("DELETE FROM source_strings WHERE id=%1").arg(sourceId));
435 QString sql="INSERT INTO source_strings (source, source_markup, source_accel) VALUES (?, ?, ?)";
450 sourceId=qpsql ? (query1.next(), query1.value(0).toLongLong()) : query1.lastInsertId().toLongLong();
514 if (KDE_ISUNLIKELY(!query1.exec("SELECT target, target_markup, target_accel FROM target_strings WHERE "
532 if (approvalChanged || untransStatusChanged) //only modify index if there were changes (this is not rescan)
571 ok=query1.exec("UPDATE main SET change_date=CURRENT_DATE WHERE target="%QString::number(targetId));
576 //kDebug(TM_AREA)<<target.string<<": update instead of adding record to main NOT"<<query1.executedQuery();
599 QString sql="INSERT INTO target_strings (target, target_markup, target_accel) VALUES (?, ?, ?)";
614 targetId=qpsql ? (query1.next(), query1.value(0).toLongLong()) : query1.lastInsertId().toLongLong();
668 mainId=qpsql ? (query1.next(), query1.value(0).toLongLong()) : query1.lastInsertId().toLongLong();
709 //"reusability NUMERIC DEFAULT 0" //e.g. whether the translation is context-free, see XLIFF spec (equiv-trans)
714 queryMain.exec("ALTER TABLE main ADD COLUMN change_date"); //DEFAULT CURRENT_DATE is not possible here
748 //OR: SELECT (tm_links.id) FROM tm_links,words WHERE tm_links.wordid==words.wordid AND (words.word) IN ("africa","abidjan");
764 //queryMain.exec("CREATE TEMP TRIGGER set_user_id_trigger AFTER UPDATE ON main FOR EACH ROW BEGIN UPDATE main SET change_author = 0 WHERE main.id=NEW.id; END;");
765 //CREATE TEMP TRIGGER set_user_id_trigger INSTEAD OF UPDATE ON main FOR EACH ROW BEGIN UPDATE main SET ctxt = 'test', source=NEW.source, target=NEW.target, WHERE main.id=NEW.id; END;
826 //OR: SELECT (tm_links.id) FROM tm_links,words WHERE tm_links.wordid==words.wordid AND (words.word) IN ("africa","abidjan");
850 queryMain.exec("CREATE TRIGGER set_user_id_trigger BEFORE INSERT OR UPDATE ON main FOR EACH ROW EXECUTE PROCEDURE set_user_id();");
939 OpenDBJob::OpenDBJob(const QString& name, DbType type, bool reconnect, const ConnectionParams& connParams, QObject* parent)
1073 static QString makeAcceledString(QString source, const QString& accel, const QVariant& accelPos)
1149 //TODO ??? not sure. make another loop before to create QList< QList<qlonglong> > then reorder it by size
1187 for(QVector<qlonglong>::const_iterator i=idsForWord.constBegin(); i!=idsForWord.constEnd(); i++)
1200 //split m_english for use in wordDiff later--all words are needed so we cant use list we already have
1207 //QList<uint> concordanceLevels=sortedUniqueValues(occurencies); //we start from entries with higher word-concordance level
1233 QSqlQuery queryFetch("SELECT id, source, source_accel, source_markup FROM source_strings WHERE "
1241 e.source=CatalogString( makeAcceledString(queryFetch.value(1).toString(), c.accel, queryFetch.value(2)),
1246 kWarning(TM_AREA)<<queryFetch.value(3).toByteArray().size()<<queryFetch.value(3).toByteArray();
1298 //kWarning(TM_AREA) <<"SelectJob: addLen:"<<addLen<<" "<<9500*(pow(float(commonLen)/float(allLen),0.20))<<" / "
1302 float score=9500*(pow(float(commonLen)/float(allLen),0.12f))//this was < 1 so we have increased it
1351 "FROM main JOIN target_strings ON (target_strings.id=main.target) JOIN files ON (files.id=main.file) " % authors_table_str % "WHERE "
1364 e.target=CatalogString( makeAcceledString(queryRest.value(4).toString(), c.accel, queryRest.value(5)),
1367 QStringList matchData=queryRest.value(2).toString().split(TM_DELIMITER,QString::KeepEmptyParts);//context|plural
1527 kWarning()<<"not indexing file because target languages don't match:"<<c.targetLangCode<<"in TM vs"<<catalog.targetLangCode()<<"in file";
1994 xmlOut.writeAttribute("creationdate",QDate::fromString( query1.value(2).toString(), Qt::ISODate ).toString("yyyyMMdd"));
1995 xmlOut.writeAttribute("changedate",QDate::fromString( query1.value(9).toString(), Qt::ISODate ).toString("yyyyMMdd"));
qlonglong toLongLong(bool *ok) const
QByteArray toByteArray() const
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
CatalogString targetWithTags(const DocPosition &pos) const
Definition: catalog.cpp:211
SelectJob(const CatalogString &source, const QString &ctxt, const QString &file, const DocPosition &, const QString &dbName, QObject *parent=0)
Definition: jobs.cpp:1099
void clear()
void setUserName(const QString &name)
CloseDBJob(const QString &dbName, QObject *parent=0)
Definition: jobs.cpp:1047
ExecQueryJob(const QString &queryString, const QString &dbName, QObject *parent=0)
Definition: jobs.cpp:2058
QString wordDiff(QStringList s1, QStringList s2)
This is low-level wrapper used for evaluating translation memory search results.
Definition: diff.cpp:342
int loadFromUrl(const KUrl &url, const KUrl &saidUrl=KUrl(), int *fileSize=0, bool fast=false)
Definition: catalog.cpp:508
QString readLine(qint64 maxlen)
void append(const T &value)
bool remove()
void setMinimal(bool minimal)
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
void aboutToBeDequeued(ThreadWeaver::WeaverInterface *)
Definition: jobs.cpp:1121
QString userVisibleWordDiff(const QString &str1ForMatching, const QString &str2ForMatching, const QString &accel, const QString &markup, int options)
Definition: diff.cpp:408
bool exec(const QString &query)
const_iterator constEnd() const
const_iterator constBegin() const
const T & at(int i) const
int size() const
void chop(int n)
QSqlDatabase database(const QString &connectionName, bool open)
void removeAt(int i)
bool isEmpty() const
bool startsWith(const QByteArray &ba) const
QSqlDatabase addDatabase(const QString &type, const QString &connectionName)
Definition: jobs.h:130
OpenDBJob(const QString &dbName, DbType type=TM::Local, bool reconnect=false, const ConnectionParams &connParams=ConnectionParams(), QObject *parent=0)
Definition: jobs.cpp:939
static void addToIndex(qlonglong sourceId, QString sourceString, QRegExp &rxClean1, const QString &accel, QSqlDatabase &db)
Definition: jobs.cpp:144
QString & remove(int position, int n)
void chop(int n)
int size() const
static InlineElement getElementType(const QByteArray &)
Definition: catalogstring.cpp:58
static void getStats(const QSqlDatabase &db, int &pairsCount, int &uniqueSourcesCount, int &uniqueTranslationsCount)
Definition: jobs.cpp:910
ExportTmxJob(const QString &url, const QString &dbName, QObject *parent=0)
Definition: jobs.cpp:1917
T value(int i) const
void clear()
bool contains(const QString &connectionName)
void clear()
Definition: tmentry.h:35
QDate fromString(const QString &string, Qt::DateFormat format)
void clear()
bool prepare(const QString &query)
int elapsed() const
QString number(int n, int base)
iterator insertMulti(const Key &key, const T &value)
void removeDatabase(const QString &connectionName)
QString & insert(int position, QChar ch)
ImportTmxJob(const QString &url, const QString &dbName, QObject *parent=0)
Definition: jobs.cpp:1877
int toInt(bool *ok) const
bool isNull() const
QVariant value(int index) const
void bindValue(const QString &placeholder, const QVariant &val, QFlags< QSql::ParamTypeFlag > paramType)
int toInt(bool *ok, int base) const
bool isEmpty() const
static void removeFromIndex(qlonglong mainId, qlonglong sourceId, QString sourceString, QRegExp &rxClean1, const QString &accel, QSqlDatabase &db)
remove source string from index if there are no other 'good' entries using it but the entry specified...
Definition: jobs.cpp:232
bool isEmpty() const
Definition: catalogstring.h:51
const_iterator constEnd() const
QByteArray number(int n, int base)
QByteArray & replace(int pos, int len, const char *after)
bool next()
T & first()
bool open()
SelectJob * initSelectJob(Catalog *, DocPosition pos, QString db=QString(), int opt=Enqueue)
Definition: jobs.cpp:1084
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
ScanJob(const KUrl &url, const QString &dbName, QObject *parent=0)
Definition: jobs.cpp:1490
UpdateJob(const QString &filePath, const QString &ctxt, const CatalogString &en, const CatalogString &newTarget, int form, bool approved, const QString &dbName, QObject *parent=0)
Definition: jobs.cpp:1612
static bool doRemoveEntry(qlonglong mainId, QRegExp &rxClean1, const QString &accel, QSqlDatabase &db)
Definition: jobs.cpp:319
QString toLower() const
const T value(const Key &key) const
void reserve(int size)
bool isOpen() const
bool contains(QChar ch, Qt::CaseSensitivity cs) const
Definition: jobs.h:63
Definition: jobs.h:78
virtual void close()
Definition: jobs.h:168
void setHostName(const QString &host)
void writeAttribute(const QString &qualifiedName, const QString &value)
QString & replace(int position, int n, QChar after)
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:128
const_iterator constBegin() const
QString databaseName() const
QByteArray toLatin1() const
QString userName() const
bool isEmpty() const
void setAutoFormatting(bool enable)
CatalogString sourceWithTags(const DocPosition &pos) const
Definition: catalog.cpp:203
void writeEndDocument()
QString pattern() const
static bool doInsertEntry(CatalogString source, CatalogString target, const QString &ctxt, bool approved, qlonglong fileId, QSqlDatabase &db, QRegExp &rxClean1, const QString &accel, qlonglong priorId, qlonglong &mainId)
Definition: jobs.cpp:370
virtual bool parse(const QXmlInputSource &input)
bool contains(char ch) const
QSqlError lastError() const
void setPassword(const QString &password)
void start()
This class represents a catalog It uses CatalogStorage interface to work with catalogs in different f...
Definition: catalog.h:74
bool isEmpty() const
QString text() const
void setDatabaseName(const QString &name)
void writeStartDocument()
QMap< uint, qlonglong > invertMap(const QMap< qlonglong, uint > &source)
Definition: jobs.cpp:1127
QString value(int index) const
static const char * getElementName(InlineElement type)
Definition: catalogstring.cpp:29
void addBindValue(const QVariant &val, QFlags< QSql::ParamTypeFlag > paramType)
int size() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void writeCharacters(const QString &text)
QByteArray & remove(int pos, int len)
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString toString() const
int size() const
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:44
bool endsWith(const QByteArray &ba) const
QString driverName() const
static void doSplit(QString &cleanEn, QStringList &words, QRegExp &rxClean1, const QString &accel)
splits string into words, removing any markup
Definition: jobs.cpp:65
void writeEndElement()
void writeStartElement(const QString &qualifiedName)
QVariant lastInsertId() const
void close()
QString connectionName() const
static QString makeAcceledString(QString source, const QString &accel, const QVariant &accelPos)
Definition: jobs.cpp:1073
virtual void setContentHandler(QXmlContentHandler *handler)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.