QSqlDriver functions made virtual
Certain QSqlDriver functions were marked to be made virtual in Qt5. subscribeToNotification, unsubscribeFromNotification, subscribedToNotifications, isIdentifierEscaped, and stripDelimiters. This patch makes them virtual and removes the no longer needed Implementation counterpart functions. It also updates the relevant drivers. This patch has no regressions on the tests in tests/auto/sql/kernel/, tested with sqlite and postgres. Change-Id: Ia2e1c18dfb803531523a456eb4e710031048e594 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
parent
6aded68111
commit
ccf25f1d28
10
dist/changes-5.0.0
vendored
10
dist/changes-5.0.0
vendored
@ -248,6 +248,10 @@ information about a particular change.
|
|||||||
|
|
||||||
- QSqlQueryModel::indexInQuery() is now virtual. See note below under QSql.
|
- QSqlQueryModel::indexInQuery() is now virtual. See note below under QSql.
|
||||||
|
|
||||||
|
- QSqlDriver::subscribeToNotification, unsubscribeFromNotification,
|
||||||
|
subscribedToNotifications, isIdentifierEscaped, and stripDelimiters
|
||||||
|
are now virtual. See note below under QtSql.
|
||||||
|
|
||||||
- qMacVersion() has been removed. Use QSysInfo::macVersion() or
|
- qMacVersion() has been removed. Use QSysInfo::macVersion() or
|
||||||
QSysInfo::MacintoshVersion instead.
|
QSysInfo::MacintoshVersion instead.
|
||||||
|
|
||||||
@ -488,6 +492,12 @@ changes. insertRows() and insertRecord() also respect the edit strategy.
|
|||||||
|
|
||||||
* QSqlTableModel::setData() and setRecord() in OnRowChange no longer have the
|
* QSqlTableModel::setData() and setRecord() in OnRowChange no longer have the
|
||||||
side effect of submitting the cached row when invoked on a different row.
|
side effect of submitting the cached row when invoked on a different row.
|
||||||
|
|
||||||
|
* QSqlDriver::subscribeToNotification, unsubscribeFromNotification,
|
||||||
|
subscribedToNotifications, isIdentifierEscaped, and stripDelimiters
|
||||||
|
are now virtual. Their xxxImplemenation counterparts have been removed
|
||||||
|
now that QSqlDriver subclasses can reimplement these directly.
|
||||||
|
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
* Database Drivers *
|
* Database Drivers *
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
|
@ -1749,7 +1749,7 @@ static isc_callback qEventCallback(char *result, short length, char *updated)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QIBaseDriver::subscribeToNotificationImplementation(const QString &name)
|
bool QIBaseDriver::subscribeToNotification(const QString &name)
|
||||||
{
|
{
|
||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
qWarning("QIBaseDriver::subscribeFromNotificationImplementation: database not open.");
|
qWarning("QIBaseDriver::subscribeFromNotificationImplementation: database not open.");
|
||||||
@ -1798,7 +1798,7 @@ bool QIBaseDriver::subscribeToNotificationImplementation(const QString &name)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QIBaseDriver::unsubscribeFromNotificationImplementation(const QString &name)
|
bool QIBaseDriver::unsubscribeFromNotification(const QString &name)
|
||||||
{
|
{
|
||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
qWarning("QIBaseDriver::unsubscribeFromNotificationImplementation: database not open.");
|
qWarning("QIBaseDriver::unsubscribeFromNotificationImplementation: database not open.");
|
||||||
@ -1827,7 +1827,7 @@ bool QIBaseDriver::unsubscribeFromNotificationImplementation(const QString &name
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QIBaseDriver::subscribedToNotificationsImplementation() const
|
QStringList QIBaseDriver::subscribedToNotifications() const
|
||||||
{
|
{
|
||||||
return QStringList(d->eventBuffers.keys());
|
return QStringList(d->eventBuffers.keys());
|
||||||
}
|
}
|
||||||
|
@ -113,10 +113,9 @@ public:
|
|||||||
|
|
||||||
QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
||||||
|
|
||||||
protected Q_SLOTS:
|
bool subscribeToNotification(const QString &name);
|
||||||
bool subscribeToNotificationImplementation(const QString &name);
|
bool unsubscribeFromNotification(const QString &name);
|
||||||
bool unsubscribeFromNotificationImplementation(const QString &name);
|
QStringList subscribedToNotifications() const;
|
||||||
QStringList subscribedToNotificationsImplementation() const;
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void qHandleEventNotification(void* updatedResultBuffer);
|
void qHandleEventNotification(void* updatedResultBuffer);
|
||||||
|
@ -1534,7 +1534,7 @@ QString QMYSQLDriver::escapeIdentifier(const QString &identifier, IdentifierType
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMYSQLDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const
|
bool QMYSQLDriver::isIdentifierEscaped(const QString &identifier, IdentifierType type) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(type);
|
Q_UNUSED(type);
|
||||||
return identifier.size() > 2
|
return identifier.size() > 2
|
||||||
|
@ -124,8 +124,7 @@ public:
|
|||||||
QVariant handle() const;
|
QVariant handle() const;
|
||||||
QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
||||||
|
|
||||||
protected Q_SLOTS:
|
bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const;
|
||||||
bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool beginTransaction();
|
bool beginTransaction();
|
||||||
|
@ -2540,7 +2540,7 @@ QString QODBCDriver::escapeIdentifier(const QString &identifier, IdentifierType)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QODBCDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType) const
|
bool QODBCDriver::isIdentifierEscaped(const QString &identifier, IdentifierType) const
|
||||||
{
|
{
|
||||||
QChar quote = d->quoteChar();
|
QChar quote = d->quoteChar();
|
||||||
return identifier.size() > 2
|
return identifier.size() > 2
|
||||||
|
@ -135,8 +135,7 @@ public:
|
|||||||
|
|
||||||
QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
||||||
|
|
||||||
protected Q_SLOTS:
|
bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const;
|
||||||
bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool beginTransaction();
|
bool beginTransaction();
|
||||||
|
@ -1283,7 +1283,7 @@ QPSQLDriver::Protocol QPSQLDriver::protocol() const
|
|||||||
return d->pro;
|
return d->pro;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QPSQLDriver::subscribeToNotificationImplementation(const QString &name)
|
bool QPSQLDriver::subscribeToNotification(const QString &name)
|
||||||
{
|
{
|
||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
qWarning("QPSQLDriver::subscribeToNotificationImplementation: database not open.");
|
qWarning("QPSQLDriver::subscribeToNotificationImplementation: database not open.");
|
||||||
@ -1317,7 +1317,7 @@ bool QPSQLDriver::subscribeToNotificationImplementation(const QString &name)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QPSQLDriver::unsubscribeFromNotificationImplementation(const QString &name)
|
bool QPSQLDriver::unsubscribeFromNotification(const QString &name)
|
||||||
{
|
{
|
||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
qWarning("QPSQLDriver::unsubscribeFromNotificationImplementation: database not open.");
|
qWarning("QPSQLDriver::unsubscribeFromNotificationImplementation: database not open.");
|
||||||
@ -1350,7 +1350,7 @@ bool QPSQLDriver::unsubscribeFromNotificationImplementation(const QString &name)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QPSQLDriver::subscribedToNotificationsImplementation() const
|
QStringList QPSQLDriver::subscribedToNotifications() const
|
||||||
{
|
{
|
||||||
return d->seid;
|
return d->seid;
|
||||||
}
|
}
|
||||||
|
@ -134,16 +134,15 @@ public:
|
|||||||
QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
|
||||||
QString formatValue(const QSqlField &field, bool trimStrings) const;
|
QString formatValue(const QSqlField &field, bool trimStrings) const;
|
||||||
|
|
||||||
|
bool subscribeToNotification(const QString &name);
|
||||||
|
bool unsubscribeFromNotification(const QString &name);
|
||||||
|
QStringList subscribedToNotifications() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool beginTransaction();
|
bool beginTransaction();
|
||||||
bool commitTransaction();
|
bool commitTransaction();
|
||||||
bool rollbackTransaction();
|
bool rollbackTransaction();
|
||||||
|
|
||||||
protected Q_SLOTS:
|
|
||||||
bool subscribeToNotificationImplementation(const QString &name);
|
|
||||||
bool unsubscribeFromNotificationImplementation(const QString &name);
|
|
||||||
QStringList subscribedToNotificationsImplementation() const;
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void _q_handleNotification(int);
|
void _q_handleNotification(int);
|
||||||
|
|
||||||
|
@ -417,22 +417,17 @@ QString QSqlDriver::escapeIdentifier(const QString &identifier, IdentifierType)
|
|||||||
\a identifier can either be a table name or field name, dependent
|
\a identifier can either be a table name or field name, dependent
|
||||||
on \a type.
|
on \a type.
|
||||||
|
|
||||||
\warning Because of binary compatibility constraints, this function is not virtual.
|
Reimplement this function if you want to provide your own implementation in your
|
||||||
If you want to provide your own implementation in your QSqlDriver subclass,
|
QSqlDriver subclass,
|
||||||
reimplement the isIdentifierEscapedImplementation() slot in your subclass instead.
|
|
||||||
The isIdentifierEscapedFunction() will dynamically detect the slot and call it.
|
|
||||||
|
|
||||||
\sa stripDelimiters(), escapeIdentifier()
|
\sa stripDelimiters(), escapeIdentifier()
|
||||||
*/
|
*/
|
||||||
bool QSqlDriver::isIdentifierEscaped(const QString &identifier, IdentifierType type) const
|
bool QSqlDriver::isIdentifierEscaped(const QString &identifier, IdentifierType type) const
|
||||||
{
|
{
|
||||||
bool result;
|
Q_UNUSED(type);
|
||||||
QMetaObject::invokeMethod(const_cast<QSqlDriver*>(this),
|
return identifier.size() > 2
|
||||||
"isIdentifierEscapedImplementation", Qt::DirectConnection,
|
&& identifier.startsWith(QLatin1Char('"')) //left delimited
|
||||||
Q_RETURN_ARG(bool, result),
|
&& identifier.endsWith(QLatin1Char('"')); //right delimited
|
||||||
Q_ARG(QString, identifier),
|
|
||||||
Q_ARG(IdentifierType, type));
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -442,23 +437,22 @@ bool QSqlDriver::isIdentifierEscaped(const QString &identifier, IdentifierType t
|
|||||||
and trailing delimiter characters, \a identifier is returned without
|
and trailing delimiter characters, \a identifier is returned without
|
||||||
modification.
|
modification.
|
||||||
|
|
||||||
\warning Because of binary compatibility constraints, this function is not virtual,
|
Reimplement this function if you want to provide your own implementation in your
|
||||||
If you want to provide your own implementation in your QSqlDriver subclass,
|
QSqlDriver subclass,
|
||||||
reimplement the stripDelimitersImplementation() slot in your subclass instead.
|
|
||||||
The stripDelimiters() function will dynamically detect the slot and call it.
|
|
||||||
|
|
||||||
\since 4.5
|
\since 4.5
|
||||||
\sa isIdentifierEscaped()
|
\sa isIdentifierEscaped()
|
||||||
*/
|
*/
|
||||||
QString QSqlDriver::stripDelimiters(const QString &identifier, IdentifierType type) const
|
QString QSqlDriver::stripDelimiters(const QString &identifier, IdentifierType type) const
|
||||||
{
|
{
|
||||||
QString result;
|
QString ret;
|
||||||
QMetaObject::invokeMethod(const_cast<QSqlDriver*>(this),
|
if (isIdentifierEscaped(identifier, type)) {
|
||||||
"stripDelimitersImplementation", Qt::DirectConnection,
|
ret = identifier.mid(1);
|
||||||
Q_RETURN_ARG(QString, result),
|
ret.chop(1);
|
||||||
Q_ARG(QString, identifier),
|
} else {
|
||||||
Q_ARG(IdentifierType, type));
|
ret = identifier;
|
||||||
return result;
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -744,22 +738,16 @@ QVariant QSqlDriver::handle() const
|
|||||||
When an event notification identified by \a name is posted by the database the
|
When an event notification identified by \a name is posted by the database the
|
||||||
notification() signal is emitted.
|
notification() signal is emitted.
|
||||||
|
|
||||||
\warning Because of binary compatibility constraints, this function is not virtual.
|
Reimplement this function if you want to provide event notification support in your
|
||||||
If you want to provide event notification support in your own QSqlDriver subclass,
|
own QSqlDriver subclass,
|
||||||
reimplement the subscribeToNotificationImplementation() slot in your subclass instead.
|
|
||||||
The subscribeToNotification() function will dynamically detect the slot and call it.
|
|
||||||
|
|
||||||
\since 4.4
|
\since 4.4
|
||||||
\sa unsubscribeFromNotification() subscribedToNotifications() QSqlDriver::hasFeature()
|
\sa unsubscribeFromNotification() subscribedToNotifications() QSqlDriver::hasFeature()
|
||||||
*/
|
*/
|
||||||
bool QSqlDriver::subscribeToNotification(const QString &name)
|
bool QSqlDriver::subscribeToNotification(const QString &name)
|
||||||
{
|
{
|
||||||
bool result;
|
Q_UNUSED(name);
|
||||||
QMetaObject::invokeMethod(const_cast<QSqlDriver *>(this),
|
return false;
|
||||||
"subscribeToNotificationImplementation", Qt::DirectConnection,
|
|
||||||
Q_RETURN_ARG(bool, result),
|
|
||||||
Q_ARG(QString, name));
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -774,168 +762,32 @@ bool QSqlDriver::subscribeToNotification(const QString &name)
|
|||||||
After calling \e this function the notification() signal will no longer be emitted
|
After calling \e this function the notification() signal will no longer be emitted
|
||||||
when an event notification identified by \a name is posted by the database.
|
when an event notification identified by \a name is posted by the database.
|
||||||
|
|
||||||
\warning Because of binary compatibility constraints, this function is not virtual.
|
Reimplement this function if you want to provide event notification support in your
|
||||||
If you want to provide event notification support in your own QSqlDriver subclass,
|
own QSqlDriver subclass,
|
||||||
reimplement the unsubscribeFromNotificationImplementation() slot in your subclass instead.
|
|
||||||
The unsubscribeFromNotification() function will dynamically detect the slot and call it.
|
|
||||||
|
|
||||||
\since 4.4
|
\since 4.4
|
||||||
\sa subscribeToNotification() subscribedToNotifications()
|
\sa subscribeToNotification() subscribedToNotifications()
|
||||||
*/
|
*/
|
||||||
bool QSqlDriver::unsubscribeFromNotification(const QString &name)
|
bool QSqlDriver::unsubscribeFromNotification(const QString &name)
|
||||||
{
|
{
|
||||||
bool result;
|
Q_UNUSED(name);
|
||||||
QMetaObject::invokeMethod(const_cast<QSqlDriver *>(this),
|
return false;
|
||||||
"unsubscribeFromNotificationImplementation", Qt::DirectConnection,
|
|
||||||
Q_RETURN_ARG(bool, result),
|
|
||||||
Q_ARG(QString, name));
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a list of the names of the event notifications that are currently subscribed to.
|
Returns a list of the names of the event notifications that are currently subscribed to.
|
||||||
|
|
||||||
\warning Because of binary compatibility constraints, this function is not virtual.
|
Reimplement this function if you want to provide event notification support in your
|
||||||
If you want to provide event notification support in your own QSqlDriver subclass,
|
own QSqlDriver subclass,
|
||||||
reimplement the subscribedToNotificationsImplementation() slot in your subclass instead.
|
|
||||||
The subscribedToNotifications() function will dynamically detect the slot and call it.
|
|
||||||
|
|
||||||
\since 4.4
|
\since 4.4
|
||||||
\sa subscribeToNotification() unsubscribeFromNotification()
|
\sa subscribeToNotification() unsubscribeFromNotification()
|
||||||
*/
|
*/
|
||||||
QStringList QSqlDriver::subscribedToNotifications() const
|
QStringList QSqlDriver::subscribedToNotifications() const
|
||||||
{
|
|
||||||
QStringList result;
|
|
||||||
QMetaObject::invokeMethod(const_cast<QSqlDriver *>(this),
|
|
||||||
"subscribedToNotificationsImplementation", Qt::DirectConnection,
|
|
||||||
Q_RETURN_ARG(QStringList, result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
This slot is called to subscribe to event notifications from the database.
|
|
||||||
\a name identifies the event notification.
|
|
||||||
|
|
||||||
If successful, return true, otherwise return false.
|
|
||||||
|
|
||||||
The database must be open when this \e slot is called. When the database is closed
|
|
||||||
by calling close() all subscribed event notifications are automatically unsubscribed.
|
|
||||||
Note that calling open() on an already open database may implicitly cause close() to
|
|
||||||
be called, which will cause the driver to unsubscribe from all event notifications.
|
|
||||||
|
|
||||||
When an event notification identified by \a name is posted by the database the
|
|
||||||
notification() signal is emitted.
|
|
||||||
|
|
||||||
Reimplement this slot to provide your own QSqlDriver subclass with event notification
|
|
||||||
support; because of binary compatibility constraints, the subscribeToNotification()
|
|
||||||
function (introduced in Qt 4.4) is not virtual. Instead, subscribeToNotification()
|
|
||||||
will dynamically detect and call \e this slot. The default implementation does nothing
|
|
||||||
and returns false.
|
|
||||||
|
|
||||||
\since 4.4
|
|
||||||
\sa subscribeToNotification()
|
|
||||||
*/
|
|
||||||
bool QSqlDriver::subscribeToNotificationImplementation(const QString &name)
|
|
||||||
{
|
|
||||||
Q_UNUSED(name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
This slot is called to unsubscribe from event notifications from the database.
|
|
||||||
\a name identifies the event notification.
|
|
||||||
|
|
||||||
If successful, return true, otherwise return false.
|
|
||||||
|
|
||||||
The database must be open when \e this slot is called. All subscribed event
|
|
||||||
notifications are automatically unsubscribed from when the close() function is called.
|
|
||||||
|
|
||||||
After calling \e this slot the notification() signal will no longer be emitted
|
|
||||||
when an event notification identified by \a name is posted by the database.
|
|
||||||
|
|
||||||
Reimplement this slot to provide your own QSqlDriver subclass with event notification
|
|
||||||
support; because of binary compatibility constraints, the unsubscribeFromNotification()
|
|
||||||
function (introduced in Qt 4.4) is not virtual. Instead, unsubscribeFromNotification()
|
|
||||||
will dynamically detect and call \e this slot. The default implementation does nothing
|
|
||||||
and returns false.
|
|
||||||
|
|
||||||
\since 4.4
|
|
||||||
\sa unsubscribeFromNotification()
|
|
||||||
*/
|
|
||||||
bool QSqlDriver::unsubscribeFromNotificationImplementation(const QString &name)
|
|
||||||
{
|
|
||||||
Q_UNUSED(name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a list of the names of the event notifications that are currently subscribed to.
|
|
||||||
|
|
||||||
Reimplement this slot to provide your own QSqlDriver subclass with event notification
|
|
||||||
support; because of binary compatibility constraints, the subscribedToNotifications()
|
|
||||||
function (introduced in Qt 4.4) is not virtual. Instead, subscribedToNotifications()
|
|
||||||
will dynamically detect and call \e this slot. The default implementation simply
|
|
||||||
returns an empty QStringList.
|
|
||||||
|
|
||||||
\since 4.4
|
|
||||||
\sa subscribedToNotifications()
|
|
||||||
*/
|
|
||||||
QStringList QSqlDriver::subscribedToNotificationsImplementation() const
|
|
||||||
{
|
{
|
||||||
return QStringList();
|
return QStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\since 4.6
|
|
||||||
|
|
||||||
This slot returns whether \a identifier is escaped according to the database rules.
|
|
||||||
\a identifier can either be a table name or field name, dependent
|
|
||||||
on \a type.
|
|
||||||
|
|
||||||
Because of binary compatibility constraints, isIdentifierEscaped() function
|
|
||||||
(introduced in Qt 4.5) is not virtual. Instead, isIdentifierEscaped() will
|
|
||||||
dynamically detect and call \e this slot. The default implementation
|
|
||||||
assumes the escape/delimiter character is a double quote. Reimplement this
|
|
||||||
slot in your own QSqlDriver if your database engine uses a different
|
|
||||||
delimiter character.
|
|
||||||
|
|
||||||
\sa isIdentifierEscaped()
|
|
||||||
*/
|
|
||||||
bool QSqlDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(type);
|
|
||||||
return identifier.size() > 2
|
|
||||||
&& identifier.startsWith(QLatin1Char('"')) //left delimited
|
|
||||||
&& identifier.endsWith(QLatin1Char('"')); //right delimited
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\since 4.6
|
|
||||||
|
|
||||||
This slot returns \a identifier with the leading and trailing delimiters removed,
|
|
||||||
\a identifier can either be a tablename or field name, dependent on \a type.
|
|
||||||
If \a identifier does not have leading and trailing delimiter characters, \a
|
|
||||||
identifier is returned without modification.
|
|
||||||
|
|
||||||
Because of binary compatibility constraints, the stripDelimiters() function
|
|
||||||
(introduced in Qt 4.5) is not virtual. Instead, stripDelimiters() will
|
|
||||||
dynamically detect and call \e this slot. It generally unnecessary
|
|
||||||
to reimplement this slot.
|
|
||||||
|
|
||||||
\sa stripDelimiters()
|
|
||||||
*/
|
|
||||||
QString QSqlDriver::stripDelimitersImplementation(const QString &identifier, IdentifierType type) const
|
|
||||||
{
|
|
||||||
QString ret;
|
|
||||||
if (this->isIdentifierEscaped(identifier, type)) {
|
|
||||||
ret = identifier.mid(1);
|
|
||||||
ret.chop(1);
|
|
||||||
} else {
|
|
||||||
ret = identifier;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 4.6
|
\since 4.6
|
||||||
|
|
||||||
|
@ -110,12 +110,12 @@ public:
|
|||||||
const QString& host = QString(),
|
const QString& host = QString(),
|
||||||
int port = -1,
|
int port = -1,
|
||||||
const QString& connOpts = QString()) = 0;
|
const QString& connOpts = QString()) = 0;
|
||||||
bool subscribeToNotification(const QString &name); // ### Qt 5: make virtual
|
virtual bool subscribeToNotification(const QString &name);
|
||||||
bool unsubscribeFromNotification(const QString &name); // ### Qt 5: make virtual
|
virtual bool unsubscribeFromNotification(const QString &name);
|
||||||
QStringList subscribedToNotifications() const; // ### Qt 5: make virtual
|
virtual QStringList subscribedToNotifications() const;
|
||||||
|
|
||||||
bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const; // ### Qt 5: make virtual
|
virtual bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const;
|
||||||
QString stripDelimiters(const QString &identifier, IdentifierType type) const; // ### Qt 5: make virtual
|
virtual QString stripDelimiters(const QString &identifier, IdentifierType type) const;
|
||||||
|
|
||||||
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy);
|
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy);
|
||||||
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
|
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
|
||||||
@ -129,13 +129,6 @@ protected:
|
|||||||
virtual void setOpenError(bool e);
|
virtual void setOpenError(bool e);
|
||||||
virtual void setLastError(const QSqlError& e);
|
virtual void setLastError(const QSqlError& e);
|
||||||
|
|
||||||
protected Q_SLOTS:
|
|
||||||
bool subscribeToNotificationImplementation(const QString &name); // ### Qt 5: eliminate, see subscribeToNotification()
|
|
||||||
bool unsubscribeFromNotificationImplementation(const QString &name); // ### Qt 5: eliminate, see unsubscribeFromNotification()
|
|
||||||
QStringList subscribedToNotificationsImplementation() const; // ### Qt 5: eliminate, see subscribedNotifications()
|
|
||||||
|
|
||||||
bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const; // ### Qt 5: eliminate, see isIdentifierEscaped()
|
|
||||||
QString stripDelimitersImplementation(const QString &identifier, IdentifierType type) const; // ### Qt 5: eliminate, see stripDelimiters()
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(QSqlDriver)
|
Q_DISABLE_COPY(QSqlDriver)
|
||||||
|
Loading…
Reference in New Issue
Block a user