Skip to content

Commit

Permalink
Rename "Db"/"DB" in API to "Database"
Browse files Browse the repository at this point in the history
Motivations:
- consistency - we generally use expanded names, and this also
matches Qt API which uses Database instead of Db
- avoids unpredictable capitalization throughout API (mix of "Db"
and "DB")
  • Loading branch information
nyalldawson committed Feb 6, 2017
1 parent 64748aa commit d47d31d
Show file tree
Hide file tree
Showing 63 changed files with 350 additions and 295 deletions.
36 changes: 36 additions & 0 deletions doc/api_break.dox
Expand Up @@ -83,6 +83,7 @@ Renamed Classes {#qgis_api_break_3_0_renamed_classes}
<tr><td>QgsCptCityColorRampV2DialogBase<td>QgsCptCityColorRampDialogBase
<tr><td>QgsCurvePolygonV2<td>QgsCurvePolygon
<tr><td>QgsCurveV2<td>QgsCurve
<tr><td>QgsDbFilterProxyModel<td>QgsDatabaseFilterProxyModel
<tr><td>QgsDiagramRendererV2<td>QgsDiagramRenderer
<tr><td>QgsEditorWidgetV2<td>QgsEditorWidget
<tr><td>QgsEllipseSymbolLayerV2<td>QgsEllipseSymbolLayer
Expand Down Expand Up @@ -399,6 +400,17 @@ QgsAdvancedDigitizingDockWidget {#qgis_api_break_3_0_QgsAdvancedDigitizin
- canvasReleaseEvent takes now QgsAdvancedDigitizingDockWidget::CaptureMode as second argument.


QgsApplication {#qgis_api_break_3_0_QgsApplication}
--------------

- qgisMasterDbFilePath() was renamed to qgisMasterDatabaseFilePath()
- qgisMasterDatabaseFilePath() was renamed to qgisUserDatabaseFilePath()
- qgisAuthDbFilePath() was renamed to qgisAuthDatabaseFilePath()
- srsDbFilePath() was renamed to srsDatabaseFilePath()
- setAuthDbDirPath() was renamed to setAuthDatabaseDirPath()
- createDB() was renamed to createDatabase()


QgsAtlasComposition {#qgis_api_break_3_0_QgsAtlasComposition}
-------------------

Expand Down Expand Up @@ -437,6 +449,19 @@ QgsAuthConfigUriEdit {#qgis_api_break_3_0_QgsAuthConfigUriEdit}
- hasConfigID() has been renamed to hasConfigId()


QgsAuthManager {#qgis_api_break_3_0_QgsAuthManager}
--------------

- authDbConnection() was renamed to authDatabaseConnection()
- authDbConfigTable() was renamed to authDatabaseConfigTable()
- authDbServersTable() was renamed to authDatabaseServersTable()
- authenticationDbPath() was renamed to authenticationDatabasePath()
- masterPasswordHashInDb() was renamed to masterPasswordHashInDatabase()
- scheduledAuthDbErase() was renamed to scheduledAuthDatabaseErase()
- setScheduledAuthDbErase() was renamed to setScheduledAuthDatabaseErase()
- setScheduledAuthDbEraseRequestEmitted() was renamed to setScheduledAuthDatabaseEraseRequestEmitted()


QgsAuthMethod {#qgis_api_break_3_0_QgsAuthMethod}
-------------

Expand Down Expand Up @@ -699,6 +724,7 @@ called if changes are made to the CRS database.
- geographicCRSAuthId() has been renamed to geographicCrsAuthId()
- geographicFlag() was renamed to isGeographic()
- axisInverted() was renamed to hasAxisInverted()
- syncDb() was renamed to syncDatabase()


QgsCoordinateTransform {#qgis_api_break_3_0_QgsCoordinateTransform}
Expand Down Expand Up @@ -1316,6 +1342,8 @@ screenUpdateRequested() were removed. These members have had no effect for a num
- writeLayerXML() was renamed to writeLayerXml()
- capitaliseLayerName() was renamed to capitalizeLayerName() <!--#spellok-->
- asLayerDefinition(), fromLayerDefinition(), fromLayerDefinitionFile() were moved to QgsLayerDefinition class and renamed to exportLayerDefinitionLayers() resp. loadLayerDefinitionLayers()
- loadNamedStyleFromDb() was renamed to loadNamedStyleFromDatabase()



QgsMapLayerRegistry {#qgis_api_break_3_0_QgsMapLayerRegistry}
Expand Down Expand Up @@ -1430,6 +1458,13 @@ QgsOSMElement {#qgis_api_break_3_0_QgsOSMElement}
- elemID() has been renamed to elemId()


QgsOSMXmlImport {#qgis_api_break_3_0_QgsOSMXmlImport}
-------------

- setOutputDbFileName() and outputDbFileName() have been renamed to setOutputDatabaseFileName()
and outputDatabaseFileName()


QgsOwsConnection {#qgis_api_break_3_0_QgsOwsConnection}
----------------

Expand Down Expand Up @@ -1906,6 +1941,7 @@ capabilities have been removed, as they were unused and had no effect.
clause fragment which must be evaluated by the provider in order to calculate the default value. In
QGIS 3.0 defaultValue() only returns literal, constant defaultValues. A new method defaultValueClause
has been added which returns the SQL clause fragments which must be evaluated by the provider itself.
- isSaveAndLoadStyleToDBSupported() was renamed to isSaveAndLoadStyleToDatabaseSupported()


QgsVectorJoinInfo {#qgis_api_break_3_0_QgsVectorJoinInfo}
Expand Down
4 changes: 2 additions & 2 deletions python/analysis/openstreetmap/qgsosmimport.sip
Expand Up @@ -19,8 +19,8 @@ class QgsOSMXmlImport : public QObject
void setInputXmlFileName( const QString& xmlFileName );
QString inputXmlFileName() const;

void setOutputDbFileName( const QString& dbFileName );
QString outputDbFileName() const;
void setOutputDatabaseFileName( const QString& fileName );
QString outputDatabaseFileName() const;

/**
* Run import. This will parse the XML file and store the data in a SQLite database.
Expand Down
18 changes: 9 additions & 9 deletions python/core/auth/qgsauthmanager.sip
Expand Up @@ -27,13 +27,13 @@ class QgsAuthManager : QObject
~QgsAuthManager();

/** Set up the application instance of the authentication database connection */
QSqlDatabase authDbConnection() const;
QSqlDatabase authDatabaseConnection() const;

/** Name of the authentication database table that stores configs */
const QString authDbConfigTable() const;
const QString authDatabaseConfigTable() const;

/** Name of the authentication database table that stores server exceptions/configs */
const QString authDbServersTable() const;
const QString authDatabaseServersTable() const;

/** Initialize QCA, prioritize qca-ossl plugin and optionally set up the authentication database */
bool init( const QString& pluginPath = QString::null );
Expand All @@ -45,9 +45,9 @@ class QgsAuthManager : QObject
const QString disabledMessage() const;

/** The standard authentication database file in ~/.qgis3/ or defined location
* @see QgsApplication::qgisAuthDbFilePath
* @see QgsApplication::qgisAuthDatabaseFilePath
*/
const QString authenticationDbPath() const;
const QString authenticationDatabasePath() const;

/** Main call to initially set or continually check master password is set
* @note If it is not set, the user is asked for its input
Expand All @@ -72,7 +72,7 @@ class QgsAuthManager : QObject
bool masterPasswordIsSet() const;

/** Verify a password hash existing in authentication database */
bool masterPasswordHashInDb() const;
bool masterPasswordHashInDatabase() const;

/** Clear supplied master password
* @note This will not necessarily clear authenticated connections cached in network connection managers
Expand All @@ -95,7 +95,7 @@ class QgsAuthManager : QObject

/** Whether there is a scheduled opitonal erase of authentication database.
*/
bool scheduledAuthDbErase();
bool scheduledAuthDatabaseErase();

/** Schedule an optional erase of authentication database, starting when mutex is lockable.
* @note When an erase is scheduled, any attempt to set the master password,
Expand All @@ -107,7 +107,7 @@ class QgsAuthManager : QObject
* through the given application, to prompt the erase operation (e.g. via a dialog);
* if no access to user interaction occurs wihtin 90 seconds, it cancels the schedule.
*/
void setScheduledAuthDbErase( bool scheduleErase );
void setScheduledAuthDatabaseErase( bool scheduleErase );

/** Re-emit a signal to schedule an optional erase of authentication database.
* @note This can be called from the slot connected to a previously emitted scheduling signal,
Expand All @@ -116,7 +116,7 @@ class QgsAuthManager : QObject
* @param emitted Setting to false will cause signal to be emitted by the schedule timer.
* Setting to true will stop any emitting, but will not stop the schedule timer.
*/
void setScheduledAuthDbEraseRequestEmitted( bool emitted );
void setScheduledAuthDatabaseEraseRequestEmitted( bool emitted );

/** Simple text tag describing authentication system for message logs */
QString authManTag() const;
Expand Down
12 changes: 6 additions & 6 deletions python/core/qgsapplication.sip
Expand Up @@ -168,16 +168,16 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
static QString i18nPath();

//! Returns the path to the master qgis.db file.
static QString qgisMasterDbFilePath();
static QString qgisMasterDatabaseFilePath();

//! Returns the path to the settings directory in user's home dir
static QString qgisSettingsDirPath();

//! Returns the path to the user qgis.db file.
static QString qgisUserDbFilePath();
static QString qgisUserDatabaseFilePath();

//! Returns the path to the user authentication database file: qgis-auth.db.
static QString qgisAuthDbFilePath();
static QString qgisAuthDatabaseFilePath();

//! Returns the path to the splash screen image directory.
static QString splashPath();
Expand All @@ -186,7 +186,7 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
static QString iconsPath();

//! Returns the path to the srs.db file.
static QString srsDbFilePath();
static QString srsDatabaseFilePath();

//! Returns the paths to svg directories.
static QStringList svgPaths();
Expand Down Expand Up @@ -287,13 +287,13 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
static void setDefaultSvgPaths( const QStringList& pathList );

//! Alters authentication data base directory path - used by 3rd party apps
static void setAuthDbDirPath( const QString& theAuthDbDirPath );
static void setAuthDatabaseDirPath( const QString& theAuthDbDirPath );

//! loads providers
static void initQgis();

//! initialize qgis.db
static bool createDB( QString* errorMessage = 0 );
static bool createDatabase( QString* errorMessage = 0 );

//! Create the users theme folder
static bool createThemeFolder();
Expand Down
6 changes: 3 additions & 3 deletions python/core/qgscoordinatereferencesystem.sip
Expand Up @@ -87,13 +87,13 @@
* CRS Database and Custom CRS
* ===========================
*
* The database of CRS shipped with QGIS is stored in a SQLite database (see QgsApplication::srsDbFilePath())
* The database of CRS shipped with QGIS is stored in a SQLite database (see QgsApplication::srsDatabaseFilePath())
* and it is based on the data files maintained by GDAL project (a variety of .csv and .wkt files).
*
* Sometimes it happens that users need to use a CRS definition that is not well known
* or that has been only created with a specific purpose (and thus its definition is not
* available in our database of CRS). Whenever a new CRS definition is seen, it will
* be added to the local databse (in user's home directory, see QgsApplication::qgisUserDbFilePath()).
* be added to the local databse (in user's home directory, see QgsApplication::qgisUserDatabaseFilePath()).
* QGIS also features a GUI for management of local custom CRS definitions.
*
* There are therefore two databases: one for shipped CRS definitions and one for custom CRS definitions.
Expand Down Expand Up @@ -496,7 +496,7 @@ class QgsCoordinateReferenceSystem
* negative number of failed updates in case of errors.
* @note This is used internally and should not be necessary to call in client code
*/
static int syncDb();
static int syncDatabase();


/** Save the proj4-string as a custom CRS
Expand Down
6 changes: 3 additions & 3 deletions python/core/qgsdbfilterproxymodel.sip
@@ -1,11 +1,11 @@
class QgsDbFilterProxyModel: QSortFilterProxyModel
class QgsDatabaseFilterProxyModel: QSortFilterProxyModel
{
%TypeHeaderCode
#include <qgsdbfilterproxymodel.h>
%End
public:
QgsDbFilterProxyModel( QObject* parent /TransferThis/ = 0 );
~QgsDbFilterProxyModel();
QgsDatabaseFilterProxyModel( QObject* parent /TransferThis/ = 0 );
~QgsDatabaseFilterProxyModel();
/** Calls QSortFilterProxyModel::setFilterWildcard and triggers update*/
void _setFilterWildcard( const QString& pattern );
/** Calls QSortFilterProxyModel::setFilterRegExp and triggers update*/
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsmaplayer.sip
Expand Up @@ -425,7 +425,7 @@ class QgsMapLayer : QObject
* @param qml will be set to QML style content from database
* @returns true if style was successfully loaded
*/
virtual bool loadNamedStyleFromDb( const QString &db, const QString &uri, QString &qml /Out/ );
virtual bool loadNamedStyleFromDatabase( const QString &db, const QString &uri, QString &qml /Out/ );

/**
* Import the properties of this layer from a QDomDocument
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsvectordataprovider.sip
Expand Up @@ -405,15 +405,15 @@ class QgsVectorDataProvider : QgsDataProvider
* It returns false by default.
* Must be implemented by providers that support saving and loading styles to db returning true
*/
virtual bool isSaveAndLoadStyleToDBSupported() const;
virtual bool isSaveAndLoadStyleToDatabaseSupported() const;

/**
* Checks if the provider supports style removal
* Must be implemented by providers that support delete styles from db returning true
* @note added in QGIS 3.0
* @return true if delete operation is supported by the provider
*/
virtual bool isDeleteStyleFromDbSupported() const;
virtual bool isDeleteStyleFromDatabaseSupported() const;

static QVariant convertValue( QVariant::Type type, const QString& value );

Expand Down
6 changes: 3 additions & 3 deletions python/core/symbology-ng/qgsstyle.sip
Expand Up @@ -215,7 +215,7 @@ class QgsStyle : QObject
* \note added in QGIS 3.0
* \see createMemoryDb()
*/
bool createDb( const QString& filename );
bool createDatabase( const QString& filename );

/** Creates a temporary memory database
*
Expand All @@ -224,7 +224,7 @@ class QgsStyle : QObject
* \note added in QGIS 3.0
* \see createDb()
*/
bool createMemoryDb();
bool createMemoryDatabase();

/** Creates tables structure for new database
*
Expand Down Expand Up @@ -305,7 +305,7 @@ class QgsStyle : QObject

protected:
//! Convenience function to open the DB and return a sqlite3 object
bool openDB( const QString& filename );
bool openDatabase( const QString& filename );

/** Convenience function that would run queries which don't generate return values
* \param query query to run
Expand Down
13 changes: 11 additions & 2 deletions src/analysis/openstreetmap/qgsosmimport.h
Expand Up @@ -42,8 +42,17 @@ class ANALYSIS_EXPORT QgsOSMXmlImport : public QObject
void setInputXmlFileName( const QString& xmlFileName ) { mXmlFileName = xmlFileName; }
QString inputXmlFileName() const { return mXmlFileName; }

void setOutputDbFileName( const QString& dbFileName ) { mDbFileName = dbFileName; }
QString outputDbFileName() const { return mDbFileName; }
/**
* Sets the filename for the output database.
* @see outputDatabaseFileName()
*/
void setOutputDatabaseFileName( const QString& fileName ) { mDbFileName = fileName; }

/**
* Returns the filename for the output database.
* @see setOutputDatabaseFileName()
*/
QString outputDatabaseFileName() const { return mDbFileName; }

/**
* Run import. This will parse the XML file and store the data in a SQLite database.
Expand Down
2 changes: 1 addition & 1 deletion src/app/main.cpp
Expand Up @@ -1040,7 +1040,7 @@ int main( int argc, char *argv[] )
// set authentication database directory
if ( !authdbdirectory.isEmpty() )
{
QgsApplication::setAuthDbDirPath( authdbdirectory );
QgsApplication::setAuthDatabaseDirPath( authdbdirectory );
}

//set up splash screen
Expand Down
4 changes: 2 additions & 2 deletions src/app/openstreetmap/qgsosmimportdialog.cpp
Expand Up @@ -92,7 +92,7 @@ void QgsOSMImportDialog::onOK()
}

mImport->setInputXmlFileName( editXmlFileName->text() );
mImport->setOutputDbFileName( editDbFileName->text() );
mImport->setOutputDatabaseFileName( editDbFileName->text() );

buttonBox->setEnabled( false );
QApplication::setOverrideCursor( Qt::WaitCursor );
Expand All @@ -114,7 +114,7 @@ void QgsOSMImportDialog::onOK()
{
// create connection - this is a bit hacky, sorry for that.
QSettings settings;
settings.setValue( QStringLiteral( "/SpatiaLite/connections/%1/sqlitepath" ).arg( editConnName->text() ), mImport->outputDbFileName() );
settings.setValue( QStringLiteral( "/SpatiaLite/connections/%1/sqlitepath" ).arg( editConnName->text() ), mImport->outputDatabaseFileName() );
}

QMessageBox::information( this, tr( "OpenStreetMap import" ), tr( "Import has been successful." ) );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -634,7 +634,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
qApp->processEvents();
// Do this early on before anyone else opens it and prevents us copying it
QString dbError;
if ( !QgsApplication::createDB( &dbError ) )
if ( !QgsApplication::createDatabase( &dbError ) )
{
QMessageBox::critical( this, tr( "Private qgis.db" ), dbError );
}
Expand Down Expand Up @@ -11916,7 +11916,7 @@ void QgisApp::eraseAuthenticationDatabase()
if ( layertree && layertree->customProperty( QStringLiteral( "loading" ) ).toBool() )
{
QgsDebugMsg( "Project loading, skipping auth db erase" );
QgsAuthManager::instance()->setScheduledAuthDbEraseRequestEmitted( false );
QgsAuthManager::instance()->setScheduledAuthDatabaseEraseRequestEmitted( false );
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsbookmarks.cpp
Expand Up @@ -69,12 +69,12 @@ QgsBookmarks::QgsBookmarks( QWidget *parent )

// open the database
QSqlDatabase db = QSqlDatabase::addDatabase( QStringLiteral( "QSQLITE" ), QStringLiteral( "bookmarks" ) );
db.setDatabaseName( QgsApplication::qgisUserDbFilePath() );
db.setDatabaseName( QgsApplication::qgisUserDatabaseFilePath() );
if ( !db.open() )
{
QMessageBox::warning( this, tr( "Error" ),
tr( "Unable to open bookmarks database.\nDatabase: %1\nDriver: %2\nDatabase: %3" )
.arg( QgsApplication::qgisUserDbFilePath(),
.arg( QgsApplication::qgisUserDatabaseFilePath(),
db.lastError().driverText(),
db.lastError().databaseText() )
);
Expand Down

0 comments on commit d47d31d

Please sign in to comment.