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 <QSqlDriver>
|
||||||
#include <QSqlError>
|
#include <QSqlError>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
|
#include <QRegularExpressionMatch>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@ -511,11 +512,11 @@ public:
|
|||||||
QSqlQuery q( "SELECT banner FROM v$version", db );
|
QSqlQuery q( "SELECT banner FROM v$version", db );
|
||||||
q.next();
|
q.next();
|
||||||
|
|
||||||
QRegExp vers( "([0-9]+)\\.[0-9\\.]+[0-9]" );
|
QRegularExpression vers("([0-9]+)\\.[0-9\\.]+[0-9]");
|
||||||
|
QRegularExpressionMatch match = vers.match(q.value(0).toString());
|
||||||
if ( vers.indexIn( q.value( 0 ).toString() ) ) {
|
if (match.hasMatch()) {
|
||||||
bool ok;
|
bool ok;
|
||||||
ver = vers.cap( 1 ).toInt( &ok );
|
ver = match.captured(1).toInt(&ok);
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
ver = -1;
|
ver = -1;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <qsqlrecord.h>
|
#include <qsqlrecord.h>
|
||||||
#include <qsqlfield.h>
|
#include <qsqlfield.h>
|
||||||
#include <qsqlindex.h>
|
#include <qsqlindex.h>
|
||||||
#include <qregexp.h>
|
#include <qregularexpression.h>
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <qdatetime.h>
|
#include <qdatetime.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
@ -228,7 +228,7 @@ struct FieldDef {
|
|||||||
QString fieldName() const
|
QString fieldName() const
|
||||||
{
|
{
|
||||||
QString rt = typeName;
|
QString rt = typeName;
|
||||||
rt.replace(QRegExp("\\s"), QString("_"));
|
rt.replace(QRegularExpression("\\s"), QString("_"));
|
||||||
int i = rt.indexOf(QLatin1Char('('));
|
int i = rt.indexOf(QLatin1Char('('));
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
i = rt.length();
|
i = rt.length();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user