From da72e5538ebcc7e6008d0c4b3538d2a994f02a7e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Oct 2014 15:04:42 +0200 Subject: Retrieve auto-value for ODBC fields. Introduce a static function returning the value called from qMakeFieldInfo(SQLHANDLE). The field is currently only populated when executing a query. Populating it from QODBCDriver::record() would require executing a dummy query, which is problematic since QSqlField does not have any provisions for delayed evaluation. Document the limitation. Task-number: QTBUG-39388 Change-Id: Ib2d2f2653b8b757389f627142c61c13a117fef72 Reviewed-by: Leena Miettinen Reviewed-by: Joerg Bornemann --- src/sql/kernel/qsqlfield.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/sql/kernel') diff --git a/src/sql/kernel/qsqlfield.cpp b/src/sql/kernel/qsqlfield.cpp index dfd4712071..2022871432 100644 --- a/src/sql/kernel/qsqlfield.cpp +++ b/src/sql/kernel/qsqlfield.cpp @@ -531,6 +531,12 @@ QDebug operator<<(QDebug dbg, const QSqlField &f) Returns \c true if the value is auto-generated by the database, for example auto-increment primary key values. + \note When using the ODBC driver, due to limitations in the ODBC API, + the \c isAutoValue() field is only populated in a QSqlField resulting from a + QSqlRecord obtained by executing a \c SELECT query. It is \c false in a QSqlField + resulting from a QSqlRecord returned from QSqlDatabase::record() or + QSqlDatabase::primaryIndex(). + \sa setAutoValue() */ bool QSqlField::isAutoValue() const -- cgit v1.2.3