File indexing completed on 2025-01-05 04:46:58

0001 /*
0002     SPDX-FileCopyrightText: 2012 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "dbtype.h"
0008 
0009 using namespace Akonadi::Server;
0010 
0011 DbType::Type DbType::type(const QSqlDatabase &db)
0012 {
0013     return typeForDriverName(db.driverName());
0014 }
0015 
0016 DbType::Type DbType::typeForDriverName(const QString &driverName)
0017 {
0018     if (driverName.startsWith(QLatin1StringView("QMYSQL"))) {
0019         return MySQL;
0020     }
0021     if (driverName == QLatin1StringView("QPSQL")) {
0022         return PostgreSQL;
0023     }
0024     if (driverName == QLatin1StringView("QSQLITE") || driverName == QLatin1StringView("QSQLITE3")) {
0025         return Sqlite;
0026     }
0027     return Unknown;
0028 }