Changeset 561 for trunk/src/sql/kernel


Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
23 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/sql/kernel/qsql.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqlcachedresult.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    185185        setAt(d->cacheCount());
    186186    while (at() < i + 1) {
    187         if (!cacheNext())
     187        if (!cacheNext()) {
     188            if (d->canSeek(i))
     189                break;
    188190            return false;
     191        }
    189192    }
    190193    setAt(i);
     
    276279        return false;
    277280
     281    if(isForwardOnly()) {
     282        d->cache.clear();
     283        d->cache.resize(d->colCount);
     284    }
     285
    278286    if (!gotoNext(d->cache, d->nextIndex())) {
    279287        d->revertLast();
     
    295303}
    296304
     305void QSqlCachedResult::virtual_hook(int id, void *data)
     306{
     307    switch (id) {
     308    case QSqlResult::DetachFromResultSet:
     309    case QSqlResult::SetNumericalPrecision:
     310        cleanup();
     311        break;
     312    default:
     313        QSqlResult::virtual_hook(id, data);
     314    }
     315}
     316
     317
    297318QT_END_NAMESPACE
  • trunk/src/sql/kernel/qsqlcachedresult_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    9090    ValueCache &cache();
    9191
     92    void virtual_hook(int id, void *data);
    9293private:
    9394    bool cacheNext();
  • trunk/src/sql/kernel/qsqldatabase.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    130130{
    131131public:
    132     QSqlDatabasePrivate(QSqlDriver *dr = 0):
     132    QSqlDatabasePrivate(QSqlDatabase *d, QSqlDriver *dr = 0):
     133        q(d),
    133134        driver(dr),
    134135        port(-1)
    135136    {
    136137        ref = 1;
     138        if(driver)
     139            precisionPolicy = driver->numericalPrecisionPolicy();
     140        else
     141            precisionPolicy= QSql::LowPrecisionDouble;
    137142    }
    138143    QSqlDatabasePrivate(const QSqlDatabasePrivate &other);
     
    143148
    144149    QAtomicInt ref;
     150    QSqlDatabase *q;
    145151    QSqlDriver* driver;
    146152    QString dbname;
     
    152158    QString connOptions;
    153159    QString connName;
     160    QSql::NumericalPrecisionPolicy precisionPolicy;
    154161
    155162    static QSqlDatabasePrivate *shared_null();
     
    165172{
    166173    ref = 1;
     174    q = other.q;
    167175    dbname = other.dbname;
    168176    uname = other.uname;
     
    173181    connOptions = other.connOptions;
    174182    driver = other.driver;
     183    precisionPolicy = other.precisionPolicy;
    175184}
    176185
     
    217226{
    218227    static QSqlNullDriver dr;
    219     static QSqlDatabasePrivate n(&dr);
     228    static QSqlDatabasePrivate n(NULL, &dr);
    220229    return &n;
    221230}
     
    282291void QSqlDatabasePrivate::copy(const QSqlDatabasePrivate *other)
    283292{
     293    q = other->q;
    284294    dbname = other->dbname;
    285295    uname = other->uname;
     
    289299    port = other->port;
    290300    connOptions = other->connOptions;
     301    precisionPolicy = other->precisionPolicy;
    291302}
    292303
     
    353364
    354365    \ingroup database
    355     \mainclass
     366
    356367    \inmodule QtSql
    357368
     
    379390    name argument, the default connection is assumed. The following
    380391    snippet shows how to create and open a default connection to a
    381     MySQL database:
     392    PostgreSQL database:
    382393
    383394    \snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 0
     
    444455    The database connection is referred to by \a connectionName. The
    445456    newly added database connection is returned.
     457
     458    If \a type is not available or could not be loaded, isValid() returns false.
    446459
    447460    If \a connectionName is not specified, the new connection becomes
     
    659672QSqlDatabase::QSqlDatabase(const QString &type)
    660673{
    661     d = new QSqlDatabasePrivate();
     674    d = new QSqlDatabasePrivate(this);
    662675    d->init(type);
    663676}
     
    671684QSqlDatabase::QSqlDatabase(QSqlDriver *driver)
    672685{
    673     d = new QSqlDatabasePrivate(driver);
     686    d = new QSqlDatabasePrivate(this, driver);
    674687}
    675688
     
    950963    The \e{database name} is not the \e{connection name}. The
    951964    connection name must be passed to addDatabase() at connection
    952     object create time. 
     965    object create time.
    953966
    954967    For the QOCI (Oracle) driver, the database name is the TNS
     
    12181231    \i CLIENT_INTERACTIVE
    12191232    \i UNIX_SOCKET
     1233    \i MYSQL_OPT_RECONNECT
    12201234    \endlist
    12211235
     
    12531267    \list
    12541268    \i QSQLITE_BUSY_TIMEOUT
     1269    \i QSQLITE_OPEN_READONLY
    12551270    \endlist
    12561271
     
    14701485}
    14711486
     1487/*!
     1488    \since 4.6
     1489
     1490    Sets the default numerical precision policy used by queries created
     1491    on this database connection to \a precisionPolicy.
     1492
     1493    Note: Drivers that don't support fetching numerical values with low
     1494    precision will ignore the precision policy. You can use
     1495    QSqlDriver::hasFeature() to find out whether a driver supports this
     1496    feature.
     1497
     1498    Note: Setting the default precision policy to \a precisionPolicy
     1499    doesn't affect any currently active queries.
     1500
     1501    \sa QSql::NumericalPrecisionPolicy, numericalPrecisionPolicy(),
     1502    QSqlQuery::setNumericalPrecisionPolicy(), QSqlQuery::numericalPrecisionPolicy()
     1503*/
     1504void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)
     1505{
     1506    if(driver())
     1507        driver()->setNumericalPrecisionPolicy(precisionPolicy);
     1508    d->precisionPolicy = precisionPolicy;
     1509}
     1510
     1511/*!
     1512    \since 4.6
     1513
     1514    Returns the current default precision policy for the database connection.
     1515
     1516    \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(),
     1517    QSqlQuery::numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy()
     1518*/
     1519QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy() const
     1520{
     1521    if(driver())
     1522        return driver()->numericalPrecisionPolicy();
     1523    else
     1524        return d->precisionPolicy;
     1525}
     1526
     1527
    14721528#ifndef QT_NO_DEBUG_STREAM
    14731529QDebug operator<<(QDebug dbg, const QSqlDatabase &d)
  • trunk/src/sql/kernel/qsqldatabase.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    121121    QString connectOptions() const;
    122122    QString connectionName() const;
     123    void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy);
     124    QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
    123125
    124126    QSqlDriver* driver() const;
  • trunk/src/sql/kernel/qsqldriver.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4949
    5050QT_BEGIN_NAMESPACE
     51
     52static QString prepareIdentifier(const QString &identifier,
     53        QSqlDriver::IdentifierType type, const QSqlDriver *driver)
     54{
     55    Q_ASSERT( driver != NULL );
     56    QString ret = identifier;
     57    if (!driver->isIdentifierEscaped(identifier, type)) {
     58        ret = driver->escapeIdentifier(identifier, type);
     59    }
     60    return ret;
     61}
    5162
    5263class QSqlDriverPrivate : public QObjectPrivate
     
    6273    uint isOpenError : 1;
    6374    QSqlError error;
     75    QSql::NumericalPrecisionPolicy precisionPolicy;
    6476};
    6577
    6678inline QSqlDriverPrivate::QSqlDriverPrivate()
    67     : QObjectPrivate(), isOpen(false), isOpenError(false)
     79    : QObjectPrivate(), isOpen(false), isOpenError(false), precisionPolicy(QSql::LowPrecisionDouble)
    6880{
    6981}
     
    373385
    374386    The default implementation does nothing.
     387    \sa isIdentifierEscaped()
    375388 */
    376389QString QSqlDriver::escapeIdentifier(const QString &identifier, IdentifierType) const
    377390{
    378391    return identifier;
     392}
     393
     394/*!
     395    Returns whether \a identifier is escaped according to the database rules.
     396    \a identifier can either be a table name or field name, dependent
     397    on \a type.
     398
     399    \warning Because of binary compatability constraints, this function is not virtual.
     400    If you want to provide your own implementation in your QSqlDriver subclass,
     401    reimplement the isIdentifierEscapedImplementation() slot in your subclass instead.
     402    The isIdentifierEscapedFunction() will dynamically detect the slot and call it.
     403
     404    \sa stripDelimiters(), escapeIdentifier()
     405 */
     406bool QSqlDriver::isIdentifierEscaped(const QString &identifier, IdentifierType type) const
     407{
     408    bool result;
     409    QMetaObject::invokeMethod(const_cast<QSqlDriver*>(this),
     410                            "isIdentifierEscapedImplementation", Qt::DirectConnection,
     411                            Q_RETURN_ARG(bool, result),
     412                            Q_ARG(QString, identifier),
     413                            Q_ARG(IdentifierType, type));
     414    return result;
     415}
     416
     417/*!
     418    Returns the \a identifier with the leading and trailing delimiters removed,
     419    \a identifier can either be a table name or field name,
     420    dependent on \a type.  If \a identifier does not have leading
     421    and trailing delimiter characters, \a identifier is returned without
     422    modification.
     423
     424    \warning Because of binary compatability constraints, this function is not virtual,
     425    If you want to provide your own implementation in your QSqlDriver subclass,
     426    reimplement the stripDelimitersImplementation() slot in your subclass instead.
     427    The stripDelimiters() function will dynamically detect the slot and call it.
     428
     429    \since 4.5
     430    \sa isIdentifierEscaped()
     431 */
     432QString QSqlDriver::stripDelimiters(const QString &identifier, IdentifierType type) const
     433{
     434    QString result;
     435    QMetaObject::invokeMethod(const_cast<QSqlDriver*>(this),
     436                            "stripDelimitersImplementation", Qt::DirectConnection,
     437                            Q_RETURN_ARG(QString, result),
     438                            Q_ARG(QString, identifier),
     439                            Q_ARG(IdentifierType, type));
     440    return result;
    379441}
    380442
     
    398460        for (i = 0; i < rec.count(); ++i) {
    399461            if (rec.isGenerated(i))
    400                 s.append(escapeIdentifier(rec.fieldName(i), FieldName)).append(QLatin1String(", "));
     462                s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", "));
    401463        }
    402464        if (s.isEmpty())
    403465            return s;
    404466        s.chop(2);
    405         s.prepend(QLatin1String("SELECT ")).append(QLatin1String(" FROM ")).append(escapeIdentifier(tableName, TableName));
     467        s.prepend(QLatin1String("SELECT ")).append(QLatin1String(" FROM ")).append(tableName);
    406468        break;
    407469    case WhereStatement:
    408470        if (preparedStatement) {
    409             for (int i = 0; i < rec.count(); ++i)
    410                 s.append(escapeIdentifier(rec.fieldName(i), FieldName)).append(
    411                          QLatin1String(" = ? AND "));
     471            for (int i = 0; i < rec.count(); ++i) {
     472                s.append(prepareIdentifier(rec.fieldName(i), FieldName,this));
     473                if (rec.isNull(i))
     474                    s.append(QLatin1String(" IS NULL"));
     475                else
     476                    s.append(QLatin1String(" = ?"));
     477                s.append(QLatin1String(" AND "));
     478            }
    412479        } else {
    413480            for (i = 0; i < rec.count(); ++i) {
    414                 s.append(escapeIdentifier(rec.fieldName(i), FieldName));
     481                s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this));
    415482                QString val = formatValue(rec.field(i));
    416483                if (val == QLatin1String("NULL"))
     
    427494        break;
    428495    case UpdateStatement:
    429         s.append(QLatin1String("UPDATE ")).append(escapeIdentifier(tableName, TableName)).append(
     496        s.append(QLatin1String("UPDATE ")).append(tableName).append(
    430497                 QLatin1String(" SET "));
    431498        for (i = 0; i < rec.count(); ++i) {
    432499            if (!rec.isGenerated(i) || !rec.value(i).isValid())
    433500                continue;
    434             s.append(escapeIdentifier(rec.fieldName(i), FieldName)).append(QLatin1Char('='));
     501            s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1Char('='));
    435502            if (preparedStatement)
    436503                s.append(QLatin1Char('?'));
     
    445512        break;
    446513    case DeleteStatement:
    447         s.append(QLatin1String("DELETE FROM ")).append(escapeIdentifier(tableName, TableName));
     514        s.append(QLatin1String("DELETE FROM ")).append(tableName);
    448515        break;
    449516    case InsertStatement: {
    450         s.append(QLatin1String("INSERT INTO ")).append(escapeIdentifier(tableName, TableName)).append(QLatin1String(" ("));
     517        s.append(QLatin1String("INSERT INTO ")).append(tableName).append(QLatin1String(" ("));
    451518        QString vals;
    452519        for (i = 0; i < rec.count(); ++i) {
    453520            if (!rec.isGenerated(i) || !rec.value(i).isValid())
    454521                continue;
    455             s.append(escapeIdentifier(rec.fieldName(i), FieldName)).append(QLatin1String(", "));
     522            s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", "));
    456523            if (preparedStatement)
    457                 vals.append(QLatin1String("?"));
     524                vals.append(QLatin1Char('?'));
    458525            else
    459526                vals.append(formatValue(rec.field(i)));
     
    465532            vals.chop(2); // remove trailing comma
    466533            s[s.length() - 2] = QLatin1Char(')');
    467             s.append(QLatin1String("VALUES (")).append(vals).append(QLatin1String(")"));
     534            s.append(QLatin1String("VALUES (")).append(vals).append(QLatin1Char(')'));
    468535        }
    469536        break; }
     
    560627        }
    561628        case QVariant::Bool:
    562             if (field.value().toBool())
    563                 r = QLatin1String("1");
    564             else
    565                 r = QLatin1String("0");
     629            r = QString::number(field.value().toBool());
    566630            break;
    567631        case QVariant::ByteArray : {
     
    801865}
    802866
     867/*!
     868    \since 4.6
     869
     870    This slot returns whether \a identifier is escaped according to the database rules.
     871    \a identifier can either be a table name or field name, dependent
     872    on \a type.
     873
     874    Because of binary compatability constraints, isIdentifierEscaped() function
     875    (introduced in Qt 4.5) is not virtual.  Instead, isIdentifierEscaped() will
     876    dynamically detect and call \e this slot.  The default implementation
     877    assumes the escape/delimiter character is a double quote.  Reimplement this
     878    slot in your own QSqlDriver if your database engine uses a different
     879    delimiter character.
     880
     881    \sa isIdentifierEscaped()
     882 */
     883bool QSqlDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const
     884{
     885    Q_UNUSED(type);
     886    return identifier.size() > 2
     887        && identifier.startsWith(QLatin1Char('"')) //left delimited
     888        && identifier.endsWith(QLatin1Char('"')); //right delimited
     889}
     890
     891/*!
     892    \since 4.6
     893
     894    This slot returns \a identifier with the leading and trailing delimiters removed,
     895    \a identifier can either be a tablename or field name, dependent on \a type.
     896    If \a identifier does not have leading and trailing delimiter characters, \a
     897    identifier is returned without modification.
     898
     899    Because of binary compatability constraints, the stripDelimiters() function
     900    (introduced in Qt 4.5) is not virtual.  Instead, stripDelimiters() will
     901    dynamically detect and call \e this slot.  It generally unnecessary
     902    to reimplement this slot.
     903
     904    \sa stripDelimiters()
     905 */
     906QString QSqlDriver::stripDelimitersImplementation(const QString &identifier, IdentifierType type) const
     907{
     908    QString ret;
     909    if (this->isIdentifierEscaped(identifier, type)) {
     910        ret = identifier.mid(1);
     911        ret.chop(1);
     912    } else {
     913        ret = identifier;
     914    }
     915    return ret;
     916}
     917
     918/*!
     919    \since 4.6
     920
     921    Sets the default numerical precision policy used by queries created
     922    by this driver to \a precisionPolicy.
     923
     924    Note: Setting the default precision policy to \a precisionPolicy
     925    doesn't affect any currently active queries.
     926
     927    \sa QSql::NumericalPrecisionPolicy, numericalPrecisionPolicy(),
     928    QSqlQuery::setNumericalPrecisionPolicy(), QSqlQuery::numericalPrecisionPolicy()
     929*/
     930void QSqlDriver::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)
     931{
     932    d_func()->precisionPolicy = precisionPolicy;
     933}
     934
     935/*!
     936    \since 4.6
     937
     938    Returns the current default precision policy for the database connection.
     939
     940    \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(),
     941    QSqlQuery::numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy()
     942*/
     943QSql::NumericalPrecisionPolicy QSqlDriver::numericalPrecisionPolicy() const
     944{
     945    return d_func()->precisionPolicy;
     946}
     947
    803948QT_END_NAMESPACE
  • trunk/src/sql/kernel/qsqldriver.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    128128    QStringList subscribedToNotifications() const;          // ### Qt 5: make virtual
    129129
     130    bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const; // ### Qt 5: make virtual
     131    QString stripDelimiters(const QString &identifier, IdentifierType type) const;  // ### Qt 5: make virtual
     132
     133    void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy);
     134    QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
     135
    130136Q_SIGNALS:
    131137    void notification(const QString &name);
     
    141147    QStringList subscribedToNotificationsImplementation() const;            // ### Qt 5: eliminate, see subscribedNotifications()
    142148
     149    bool isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const;   // ### Qt 5: eliminate, see isIdentifierEscaped()
     150    QString stripDelimitersImplementation(const QString &identifier, IdentifierType type) const;    // ### Qt 5: eliminate, see stripDelimiters()
     151
    143152private:
    144153    Q_DISABLE_COPY(QSqlDriver)
  • trunk/src/sql/kernel/qsqldriverplugin.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqldriverplugin.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqlerror.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4949{
    5050    dbg.nospace() << "QSqlError(" << s.number() << ", " << s.driverText() <<
    51                      ", " << s.databaseText() << ")";
     51                     ", " << s.databaseText() << ')';
    5252    return dbg.space();
    5353}
  • trunk/src/sql/kernel/qsqlerror.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqlfield.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    515515        dbg.nospace() << ", typeID: " << f.typeID();
    516516    if (!f.defaultValue().isNull())
    517         dbg.nospace() << ", auto-value: \"" << f.defaultValue() << "\"";
    518     dbg.nospace() << ")";
     517        dbg.nospace() << ", auto-value: \"" << f.defaultValue() << '\"';
     518    dbg.nospace() << ')';
    519519    return dbg.space();
    520520#else
  • trunk/src/sql/kernel/qsqlfield.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqlindex.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqlindex.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqlnulldriver_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqlquery.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6262    QAtomicInt ref;
    6363    QSqlResult* sqlResult;
    64     QSql::NumericalPrecisionPolicy precisionPolicy;
    6564
    6665    static QSqlQueryPrivate* shared_null();
     
    8281*/
    8382QSqlQueryPrivate::QSqlQueryPrivate(QSqlResult* result)
    84     : ref(1), sqlResult(result), precisionPolicy(QSql::HighPrecision)
     83    : ref(1), sqlResult(result)
    8584{
    8685    if (!sqlResult)
     
    103102    \ingroup database
    104103    \ingroup shared
    105     \mainclass
     104
    106105    \inmodule QtSql
    107106
     
    352351        bool fo = isForwardOnly();
    353352        *this = QSqlQuery(driver()->createResult());
    354         d->sqlResult->setNumericalPrecisionPolicy(d->precisionPolicy);
     353        d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());
    355354        setForwardOnly(fo);
    356355    } else {
     
    359358        d->sqlResult->setLastError(QSqlError());
    360359        d->sqlResult->setAt(QSql::BeforeFirstRow);
    361         d->sqlResult->setNumericalPrecisionPolicy(d->precisionPolicy);
     360        d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());
    362361    }
    363362    d->sqlResult->setQuery(query.trimmed());
     
    813812  efficient since results do not need to be cached. It will also
    814813  improve performance on some databases. For this to be true, you must
    815   call \c setForwardMode() before the query is prepared or executed.
     814  call \c setForwardOnly() before the query is prepared or executed.
    816815  Note that the constructor that takes a query and a database may
    817816  execute the query.
     
    819818  Forward only mode is off by default.
    820819
    821   \sa isForwardOnly(), next(), seek()
     820  Setting forward only to false is a suggestion to the database engine,
     821  which has the final say on whether a result set is forward only or
     822  scrollable. isForwardOnly() will always return the correct status of
     823  the result set.
     824
     825  \sa isForwardOnly(), next(), seek(), QSqlResult::setForwardOnly()
    822826*/
    823827void QSqlQuery::setForwardOnly(bool forward)
     
    892896        *this = QSqlQuery(driver()->createResult());
    893897        setForwardOnly(fo);
    894         d->sqlResult->setNumericalPrecisionPolicy(d->precisionPolicy);
     898        d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());
    895899    } else {
    896900        d->sqlResult->setActive(false);
    897901        d->sqlResult->setLastError(QSqlError());
    898902        d->sqlResult->setAt(QSql::BeforeFirstRow);
    899         d->sqlResult->setNumericalPrecisionPolicy(d->precisionPolicy);
     903        d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());
    900904    }
    901905    if (!driver()) {
     
    11271131  precision specified by \a precisionPolicy.
    11281132
    1129   The Oracle driver, for example, retrieves numerical values as
    1130   strings by default to prevent the loss of precision. If the high
    1131   precision doesn't matter, use this method to increase execution
    1132   speed by bypassing string conversions.
     1133  The Oracle driver, for example, can retrieve numerical values as
     1134  strings to prevent the loss of precision. If high precision doesn't
     1135  matter, use this method to increase execution speed by bypassing
     1136  string conversions.
    11331137
    11341138  Note: Drivers that don't support fetching numerical values with low
     
    11451149void QSqlQuery::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)
    11461150{
    1147     d->precisionPolicy = precisionPolicy;
     1151    d->sqlResult->setNumericalPrecisionPolicy(precisionPolicy);
    11481152}
    11491153
     
    11551159QSql::NumericalPrecisionPolicy QSqlQuery::numericalPrecisionPolicy() const
    11561160{
    1157     return d->precisionPolicy;
     1161    return d->sqlResult->numericalPrecisionPolicy();
    11581162}
    11591163
     
    11961200  result set and must be navigated to a valid record before data
    11971201  values can be retrieved. If a new result set isn't available the
    1198   function returns false and the the query is set to inactive. In any
     1202  function returns false and the query is set to inactive. In any
    11991203  case the old result set will be discarded.
    12001204
  • trunk/src/sql/kernel/qsqlquery.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqlrecord.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    590590QDebug operator<<(QDebug dbg, const QSqlRecord &r)
    591591{
    592     dbg << "QSqlRecord(" << r.count() << ")";
     592    dbg << "QSqlRecord(" << r.count() << ')';
    593593    for (int i = 0; i < r.count(); ++i)
    594594        dbg << '\n' << QString::fromLatin1("%1:").arg(i, 2) << r.field(i) << r.value(i).toString();
  • trunk/src/sql/kernel/qsqlrecord.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/sql/kernel/qsqlresult.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4949#include "qvector.h"
    5050#include "qsqldriver.h"
     51#include <QDebug>
    5152
    5253QT_BEGIN_NAMESPACE
     
    6566    QSqlResultPrivate(QSqlResult* d)
    6667    : q(d), sqldriver(0), idx(QSql::BeforeFirstRow), active(false),
    67       isSel(false), forwardOnly(false), bindCount(0), binds(QSqlResult::PositionalBinding)
     68      isSel(false), forwardOnly(false), precisionPolicy(QSql::LowPrecisionDouble), bindCount(0), binds(QSqlResult::PositionalBinding)
    6869    {}
    6970
     
    105106    QSqlError error;
    106107    bool forwardOnly;
     108    QSql::NumericalPrecisionPolicy precisionPolicy;
    107109
    108110    int bindCount;
     
    250252    d = new QSqlResultPrivate(this);
    251253    d->sqldriver = db;
     254    if(db) {
     255        setNumericalPrecisionPolicy(db->numericalPrecisionPolicy());
     256    }
    252257}
    253258
     
    555560    cached. By default, this feature is disabled.
    556561
    557     \sa isForwardOnly(), fetchNext()
     562    Setting forward only to false is a suggestion to the database engine,
     563    which has the final say on whether a result set is forward only or
     564    scrollable. isForwardOnly() will always return the correct status of
     565    the result set.
     566
     567    \sa isForwardOnly(), fetchNext(), QSqlQuery::setForwardOnly()
    558568*/
    559569void QSqlResult::setForwardOnly(bool forward)
     
    901911void QSqlResult::virtual_hook(int, void *)
    902912{
    903     Q_ASSERT(false);
    904913}
    905914
     
    966975void QSqlResult::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy)
    967976{
    968     if (driver()->hasFeature(QSqlDriver::LowPrecisionNumbers))
    969         virtual_hook(SetNumericalPrecision, &policy);
     977    d->precisionPolicy = policy;
     978    virtual_hook(SetNumericalPrecision, &policy);
     979}
     980
     981/*! \internal
     982 */
     983QSql::NumericalPrecisionPolicy QSqlResult::numericalPrecisionPolicy() const
     984{
     985    return d->precisionPolicy;
    970986}
    971987
  • trunk/src/sql/kernel/qsqlresult.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtSql module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    136136    void detachFromResultSet();
    137137    void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy);
     138    QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
    138139    bool nextResult();
    139140
Note: See TracChangeset for help on using the changeset viewer.