test: migrate QSqlDatabase test to QRegularExpression
This is part of the migration of qtbase from QRexExp to QRegularExpression. Task-number: QTBUG-72587 Change-Id: Id82e103d4076fed63c871385b2b0f21c04735d00 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
036e9d66f5
commit
889b1c4b28
@ -34,7 +34,8 @@
|
||||
#include <QSqlDriver>
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
#include <QDir>
|
||||
#include <QScopedPointer>
|
||||
#include <QVariant>
|
||||
@ -511,13 +512,13 @@ public:
|
||||
QSqlQuery q( "SELECT banner FROM v$version", db );
|
||||
q.next();
|
||||
|
||||
QRegExp vers( "([0-9]+)\\.[0-9\\.]+[0-9]" );
|
||||
|
||||
if ( vers.indexIn( q.value( 0 ).toString() ) ) {
|
||||
QRegularExpression vers("([0-9]+)\\.[0-9\\.]+[0-9]");
|
||||
QRegularExpressionMatch match = vers.match(q.value(0).toString());
|
||||
if (match.hasMatch()) {
|
||||
bool ok;
|
||||
ver = vers.cap( 1 ).toInt( &ok );
|
||||
ver = match.captured(1).toInt(&ok);
|
||||
|
||||
if ( !ok )
|
||||
if (!ok)
|
||||
ver = -1;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <qsqlrecord.h>
|
||||
#include <qsqlfield.h>
|
||||
#include <qsqlindex.h>
|
||||
#include <qregexp.h>
|
||||
#include <qregularexpression.h>
|
||||
#include <qvariant.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qdebug.h>
|
||||
@ -228,7 +228,7 @@ struct FieldDef {
|
||||
QString fieldName() const
|
||||
{
|
||||
QString rt = typeName;
|
||||
rt.replace(QRegExp("\\s"), QString("_"));
|
||||
rt.replace(QRegularExpression("\\s"), QString("_"));
|
||||
int i = rt.indexOf(QLatin1Char('('));
|
||||
if (i == -1)
|
||||
i = rt.length();
|
||||
|
Loading…
x
Reference in New Issue
Block a user