Skip to content

Commit

Permalink
Adjust DBMSType to DbmsType to follow conventions
Browse files Browse the repository at this point in the history
The enum was made public in f84b00c, but this
makes it follow the convention to camel case acronyms too before it's too late
to change it.

Change-Id: Ibb81e9221cb73fe0502d0a26f2d73512dd142f08
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
suy authored and Jani Heikkinen committed Nov 26, 2014
1 parent 37fb892 commit 6ea6ee7
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 75 deletions.
6 changes: 3 additions & 3 deletions src/sql/kernel/qsqldriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ bool QSqlDriver::isOpenError() const
*/

/*!
\enum QSqlDriver::DBMSType
\enum QSqlDriver::DbmsType
This enum contains DBMS types.
\value UnknownDBMS
\value UnknownDbms
\value MSSqlServer
\value MySqlServer
\value PostgreSQL
Expand Down Expand Up @@ -787,7 +787,7 @@ QSql::NumericalPrecisionPolicy QSqlDriver::numericalPrecisionPolicy() const
Returns the current DBMS type for the database connection.
*/
QSqlDriver::DBMSType QSqlDriver::dbmsType() const
QSqlDriver::DbmsType QSqlDriver::dbmsType() const
{
return d_func()->dbmsType;
}
Expand Down
6 changes: 3 additions & 3 deletions src/sql/kernel/qsqldriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class Q_SQL_EXPORT QSqlDriver : public QObject

enum NotificationSource { UnknownSource, SelfSource, OtherSource };

enum DBMSType {
UnknownDBMS,
enum DbmsType {
UnknownDbms,
MSSqlServer,
MySqlServer,
PostgreSQL,
Expand Down Expand Up @@ -123,7 +123,7 @@ class Q_SQL_EXPORT QSqlDriver : public QObject
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy);
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;

DBMSType dbmsType() const;
DbmsType dbmsType() const;

public Q_SLOTS:
virtual bool cancelQuery();
Expand Down
4 changes: 2 additions & 2 deletions src/sql/kernel/qsqldriver_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ class QSqlDriverPrivate : public QObjectPrivate
isOpen(false),
isOpenError(false),
precisionPolicy(QSql::LowPrecisionDouble),
dbmsType(QSqlDriver::UnknownDBMS)
dbmsType(QSqlDriver::UnknownDbms)
{ }

uint isOpen;
uint isOpenError;
QSqlError error;
QSql::NumericalPrecisionPolicy precisionPolicy;
QSqlDriver::DBMSType dbmsType;
QSqlDriver::DbmsType dbmsType;
};

QT_END_NAMESPACE
Expand Down
10 changes: 5 additions & 5 deletions tests/auto/sql/kernel/qsqldatabase/tst_databases.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ class tst_Databases
bool wasDropped;
QSqlQuery q( db );
QStringList dbtables=db.tables();
QSqlDriver::DBMSType dbType = getDatabaseType(db);
QSqlDriver::DbmsType dbType = getDatabaseType(db);
foreach(const QString &tableName, tableNames)
{
wasDropped = true;
Expand Down Expand Up @@ -462,7 +462,7 @@ class tst_Databases
// blobSize is only used if the db doesn't have a generic blob type
static QString blobTypeName( QSqlDatabase db, int blobSize = 10000 )
{
const QSqlDriver::DBMSType dbType = getDatabaseType(db);
const QSqlDriver::DbmsType dbType = getDatabaseType(db);
if (dbType == QSqlDriver::MySqlServer)
return "longblob";

Expand Down Expand Up @@ -491,7 +491,7 @@ class tst_Databases

static QString dateTimeTypeName(QSqlDatabase db)
{
const QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::PostgreSQL)
return QLatin1String("timestamp");
if (dbType == QSqlDriver::Oracle && getOraVersion(db) >= 9)
Expand All @@ -501,7 +501,7 @@ class tst_Databases

static QString autoFieldName( QSqlDatabase db )
{
const QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::MySqlServer)
return "AUTO_INCREMENT";
if (dbType == QSqlDriver::Sybase || dbType == QSqlDriver::MSSqlServer)
Expand Down Expand Up @@ -538,7 +538,7 @@ class tst_Databases
return result.toLocal8Bit();
}

static QSqlDriver::DBMSType getDatabaseType(QSqlDatabase db)
static QSqlDriver::DbmsType getDatabaseType(QSqlDatabase db)
{
QSqlDriverPrivate *d = static_cast<QSqlDriverPrivate *>(QObjectPrivate::get(db.driver()));
return d->dbmsType;
Expand Down
32 changes: 16 additions & 16 deletions tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ struct FieldDef {
// excluding the primary key field
static int createFieldTable(const FieldDef fieldDefs[], QSqlDatabase db)
{
QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
const QString tableName = qTableName("qtestfields", __FILE__, db);
tst_Databases::safeDropTable(db, tableName);
QSqlQuery q(db);
Expand Down Expand Up @@ -281,7 +281,7 @@ void tst_QSqlDatabase::createTestTables(QSqlDatabase db)
return;
const QString tableName = qTableName("qtest", __FILE__, db);
QSqlQuery q(db);
QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::MySqlServer) {
// ### stupid workaround until we find a way to hardcode this
// in the MySQL server startup script
Expand Down Expand Up @@ -318,7 +318,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db)
if (!db.isValid())
return;

QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::PostgreSQL) {
QSqlQuery q(db);
QVERIFY_SQL( q, exec("set client_min_messages='warning'"));
Expand Down Expand Up @@ -485,7 +485,7 @@ void tst_QSqlDatabase::open()
QVERIFY(!db.isOpenError());
}

QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::SQLite && db.databaseName() == ":memory:") {
// tables in in-memory databases don't survive an open/close
createTestTables(db);
Expand All @@ -498,7 +498,7 @@ void tst_QSqlDatabase::tables()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);

const QString qtest(qTableName("qtest", __FILE__, db)), qtest_view(qTableName("qtest_view", __FILE__, db)), temp_tab(qTableName("test_tab", __FILE__, db));

Expand Down Expand Up @@ -562,7 +562,7 @@ void tst_QSqlDatabase::whitespaceInIdentifiers()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
const QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);

if (testWhiteSpaceNames(db.driverName())) {
const QString tableName(qTableName("qtest", __FILE__, db) + " test");
Expand Down Expand Up @@ -830,7 +830,7 @@ void tst_QSqlDatabase::recordPSQL()

QSqlQuery q(db);

QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::PostgreSQL)
QVERIFY_SQL( q, exec("set client_min_messages='warning'"));
const QString tableName = qTableName("qtestfields", __FILE__, db);
Expand Down Expand Up @@ -1017,7 +1017,7 @@ void tst_QSqlDatabase::recordSQLServer()
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);

QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType != QSqlDriver::MSSqlServer)
QSKIP("SQL server specific test");

Expand Down Expand Up @@ -1076,7 +1076,7 @@ void tst_QSqlDatabase::transaction()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
const QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
const QString qtest(qTableName("qtest", __FILE__, db));

if (!db.driver()->hasFeature(QSqlDriver::Transactions))
Expand Down Expand Up @@ -1124,7 +1124,7 @@ void tst_QSqlDatabase::bigIntField()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
const QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
const QString qtest_bigint(qTableName("qtest_bigint", __FILE__, db));

QSqlQuery q(db);
Expand Down Expand Up @@ -1189,7 +1189,7 @@ void tst_QSqlDatabase::caseSensivity()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
const QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);

bool cs = false;
if (dbType == QSqlDriver::MySqlServer || dbType == QSqlDriver::SQLite || dbType == QSqlDriver::Sybase
Expand Down Expand Up @@ -1222,7 +1222,7 @@ void tst_QSqlDatabase::noEscapedFieldNamesInRecord()
CHECK_DATABASE(db);

QString fieldname("t_varchar");
QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::Oracle || dbType == QSqlDriver::Interbase || dbType == QSqlDriver::DB2)
fieldname = fieldname.toUpper();

Expand Down Expand Up @@ -1405,7 +1405,7 @@ void tst_QSqlDatabase::precisionPolicy()
QString query = QString("SELECT num FROM %1 WHERE id = 1").arg(tableName);
QVERIFY_SQL(q, exec(query));
QVERIFY_SQL(q, next());
QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::SQLite)
QEXPECT_FAIL("", "SQLite returns this value as determined by contents of the field, not the declaration", Continue);
QCOMPARE(q.value(0).type(), QVariant::String);
Expand Down Expand Up @@ -1742,7 +1742,7 @@ void tst_QSqlDatabase::odbc_bindBoolean()
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);

QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::MySqlServer)
QSKIP("MySql has inconsistent behaviour of bit field type across versions.");

Expand Down Expand Up @@ -1777,7 +1777,7 @@ void tst_QSqlDatabase::odbc_testqGetString()
const QString testqGetString(qTableName("testqGetString", __FILE__, db));

QSqlQuery q(db);
QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::MSSqlServer)
QVERIFY_SQL(q, exec("CREATE TABLE " + testqGetString + "(id int, vcvalue varchar(MAX))"));
else if(tst_Databases::isMSAccess(db))
Expand Down Expand Up @@ -1957,7 +1957,7 @@ void tst_QSqlDatabase::odbc_uniqueidentifier()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType != QSqlDriver::MSSqlServer)
QSKIP("SQL Server (ODBC) specific test");

Expand Down
6 changes: 3 additions & 3 deletions tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db)
QSqlQuery q(db);
const QString relTEST1(qTableName("relTEST1", __FILE__, db));

QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::PostgreSQL)
QVERIFY_SQL( q, exec("set client_min_messages='warning'"));

Expand Down Expand Up @@ -122,7 +122,7 @@ void tst_QSqlDriver::record()
QSqlRecord rec = db.driver()->record(tablename);
QCOMPARE(rec.count(), 4);

QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
// QTBUG-1363: QSqlField::length() always return -1 when using QODBC3 driver and QSqlDatabase::record()
if (dbType == QSqlDriver::MSSqlServer && db.driverName().startsWith("QODBC"))
QCOMPARE(rec.field(1).length(), 20);
Expand Down Expand Up @@ -174,7 +174,7 @@ void tst_QSqlDriver::primaryIndex()
QSqlIndex index = db.driver()->primaryIndex(tablename);
QCOMPARE(index.count(), 1);

QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::Interbase || dbType == QSqlDriver::Oracle || dbType == QSqlDriver::DB2)
QCOMPARE(index.fieldName(0), QString::fromLatin1("ID"));
else
Expand Down
Loading

0 comments on commit 6ea6ee7

Please sign in to comment.