mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
use scoped mutex locker in qMakePreparedStmtId()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f1991ac598
commit
20ae5a4e83
1 changed files with 3 additions and 5 deletions
|
@ -520,14 +520,12 @@ static QString qCreateParamString(const QVector<QVariant> &boundValues, const QS
|
|||
return params;
|
||||
}
|
||||
|
||||
Q_GLOBAL_STATIC(QMutex, qMutex)
|
||||
Q_GLOBAL_STATIC(QMutex, qPSqlMutex)
|
||||
QString qMakePreparedStmtId()
|
||||
{
|
||||
qMutex()->lock();
|
||||
QMutexLocker locker(qPSqlMutex());
|
||||
static unsigned int qPreparedStmtCount = 0;
|
||||
QString id = QLatin1String("qpsqlpstmt_") + QString::number(++qPreparedStmtCount, 16);
|
||||
qMutex()->unlock();
|
||||
return id;
|
||||
return QString::fromLatin1("qpsqlpstmt_%1").arg(QString::number(++qPreparedStmtCount, 16));
|
||||
}
|
||||
|
||||
bool QPSQLResult::prepare(const QString &query)
|
||||
|
|
Loading…
Add table
Reference in a new issue