Changeset 561 for trunk/src/sql/kernel
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/sql/kernel/qsql.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqlcachedresult.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 185 185 setAt(d->cacheCount()); 186 186 while (at() < i + 1) { 187 if (!cacheNext()) 187 if (!cacheNext()) { 188 if (d->canSeek(i)) 189 break; 188 190 return false; 191 } 189 192 } 190 193 setAt(i); … … 276 279 return false; 277 280 281 if(isForwardOnly()) { 282 d->cache.clear(); 283 d->cache.resize(d->colCount); 284 } 285 278 286 if (!gotoNext(d->cache, d->nextIndex())) { 279 287 d->revertLast(); … … 295 303 } 296 304 305 void 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 297 318 QT_END_NAMESPACE -
trunk/src/sql/kernel/qsqlcachedresult_p.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 90 90 ValueCache &cache(); 91 91 92 void virtual_hook(int id, void *data); 92 93 private: 93 94 bool cacheNext(); -
trunk/src/sql/kernel/qsqldatabase.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 130 130 { 131 131 public: 132 QSqlDatabasePrivate(QSqlDriver *dr = 0): 132 QSqlDatabasePrivate(QSqlDatabase *d, QSqlDriver *dr = 0): 133 q(d), 133 134 driver(dr), 134 135 port(-1) 135 136 { 136 137 ref = 1; 138 if(driver) 139 precisionPolicy = driver->numericalPrecisionPolicy(); 140 else 141 precisionPolicy= QSql::LowPrecisionDouble; 137 142 } 138 143 QSqlDatabasePrivate(const QSqlDatabasePrivate &other); … … 143 148 144 149 QAtomicInt ref; 150 QSqlDatabase *q; 145 151 QSqlDriver* driver; 146 152 QString dbname; … … 152 158 QString connOptions; 153 159 QString connName; 160 QSql::NumericalPrecisionPolicy precisionPolicy; 154 161 155 162 static QSqlDatabasePrivate *shared_null(); … … 165 172 { 166 173 ref = 1; 174 q = other.q; 167 175 dbname = other.dbname; 168 176 uname = other.uname; … … 173 181 connOptions = other.connOptions; 174 182 driver = other.driver; 183 precisionPolicy = other.precisionPolicy; 175 184 } 176 185 … … 217 226 { 218 227 static QSqlNullDriver dr; 219 static QSqlDatabasePrivate n( &dr);228 static QSqlDatabasePrivate n(NULL, &dr); 220 229 return &n; 221 230 } … … 282 291 void QSqlDatabasePrivate::copy(const QSqlDatabasePrivate *other) 283 292 { 293 q = other->q; 284 294 dbname = other->dbname; 285 295 uname = other->uname; … … 289 299 port = other->port; 290 300 connOptions = other->connOptions; 301 precisionPolicy = other->precisionPolicy; 291 302 } 292 303 … … 353 364 354 365 \ingroup database 355 \mainclass 366 356 367 \inmodule QtSql 357 368 … … 379 390 name argument, the default connection is assumed. The following 380 391 snippet shows how to create and open a default connection to a 381 MySQL database:392 PostgreSQL database: 382 393 383 394 \snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 0 … … 444 455 The database connection is referred to by \a connectionName. The 445 456 newly added database connection is returned. 457 458 If \a type is not available or could not be loaded, isValid() returns false. 446 459 447 460 If \a connectionName is not specified, the new connection becomes … … 659 672 QSqlDatabase::QSqlDatabase(const QString &type) 660 673 { 661 d = new QSqlDatabasePrivate( );674 d = new QSqlDatabasePrivate(this); 662 675 d->init(type); 663 676 } … … 671 684 QSqlDatabase::QSqlDatabase(QSqlDriver *driver) 672 685 { 673 d = new QSqlDatabasePrivate( driver);686 d = new QSqlDatabasePrivate(this, driver); 674 687 } 675 688 … … 950 963 The \e{database name} is not the \e{connection name}. The 951 964 connection name must be passed to addDatabase() at connection 952 object create time. 965 object create time. 953 966 954 967 For the QOCI (Oracle) driver, the database name is the TNS … … 1218 1231 \i CLIENT_INTERACTIVE 1219 1232 \i UNIX_SOCKET 1233 \i MYSQL_OPT_RECONNECT 1220 1234 \endlist 1221 1235 … … 1253 1267 \list 1254 1268 \i QSQLITE_BUSY_TIMEOUT 1269 \i QSQLITE_OPEN_READONLY 1255 1270 \endlist 1256 1271 … … 1470 1485 } 1471 1486 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 */ 1504 void 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 */ 1519 QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy() const 1520 { 1521 if(driver()) 1522 return driver()->numericalPrecisionPolicy(); 1523 else 1524 return d->precisionPolicy; 1525 } 1526 1527 1472 1528 #ifndef QT_NO_DEBUG_STREAM 1473 1529 QDebug operator<<(QDebug dbg, const QSqlDatabase &d) -
trunk/src/sql/kernel/qsqldatabase.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 121 121 QString connectOptions() const; 122 122 QString connectionName() const; 123 void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy); 124 QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; 123 125 124 126 QSqlDriver* driver() const; -
trunk/src/sql/kernel/qsqldriver.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 49 49 50 50 QT_BEGIN_NAMESPACE 51 52 static 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 } 51 62 52 63 class QSqlDriverPrivate : public QObjectPrivate … … 62 73 uint isOpenError : 1; 63 74 QSqlError error; 75 QSql::NumericalPrecisionPolicy precisionPolicy; 64 76 }; 65 77 66 78 inline QSqlDriverPrivate::QSqlDriverPrivate() 67 : QObjectPrivate(), isOpen(false), isOpenError(false) 79 : QObjectPrivate(), isOpen(false), isOpenError(false), precisionPolicy(QSql::LowPrecisionDouble) 68 80 { 69 81 } … … 373 385 374 386 The default implementation does nothing. 387 \sa isIdentifierEscaped() 375 388 */ 376 389 QString QSqlDriver::escapeIdentifier(const QString &identifier, IdentifierType) const 377 390 { 378 391 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 */ 406 bool 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 */ 432 QString 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; 379 441 } 380 442 … … 398 460 for (i = 0; i < rec.count(); ++i) { 399 461 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(", ")); 401 463 } 402 464 if (s.isEmpty()) 403 465 return s; 404 466 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); 406 468 break; 407 469 case WhereStatement: 408 470 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 } 412 479 } else { 413 480 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)); 415 482 QString val = formatValue(rec.field(i)); 416 483 if (val == QLatin1String("NULL")) … … 427 494 break; 428 495 case UpdateStatement: 429 s.append(QLatin1String("UPDATE ")).append( escapeIdentifier(tableName, TableName)).append(496 s.append(QLatin1String("UPDATE ")).append(tableName).append( 430 497 QLatin1String(" SET ")); 431 498 for (i = 0; i < rec.count(); ++i) { 432 499 if (!rec.isGenerated(i) || !rec.value(i).isValid()) 433 500 continue; 434 s.append( escapeIdentifier(rec.fieldName(i), FieldName)).append(QLatin1Char('='));501 s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1Char('=')); 435 502 if (preparedStatement) 436 503 s.append(QLatin1Char('?')); … … 445 512 break; 446 513 case DeleteStatement: 447 s.append(QLatin1String("DELETE FROM ")).append( escapeIdentifier(tableName, TableName));514 s.append(QLatin1String("DELETE FROM ")).append(tableName); 448 515 break; 449 516 case InsertStatement: { 450 s.append(QLatin1String("INSERT INTO ")).append( escapeIdentifier(tableName, TableName)).append(QLatin1String(" ("));517 s.append(QLatin1String("INSERT INTO ")).append(tableName).append(QLatin1String(" (")); 451 518 QString vals; 452 519 for (i = 0; i < rec.count(); ++i) { 453 520 if (!rec.isGenerated(i) || !rec.value(i).isValid()) 454 521 continue; 455 s.append( escapeIdentifier(rec.fieldName(i), FieldName)).append(QLatin1String(", "));522 s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", ")); 456 523 if (preparedStatement) 457 vals.append(QLatin1 String("?"));524 vals.append(QLatin1Char('?')); 458 525 else 459 526 vals.append(formatValue(rec.field(i))); … … 465 532 vals.chop(2); // remove trailing comma 466 533 s[s.length() - 2] = QLatin1Char(')'); 467 s.append(QLatin1String("VALUES (")).append(vals).append(QLatin1 String(")"));534 s.append(QLatin1String("VALUES (")).append(vals).append(QLatin1Char(')')); 468 535 } 469 536 break; } … … 560 627 } 561 628 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()); 566 630 break; 567 631 case QVariant::ByteArray : { … … 801 865 } 802 866 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 */ 883 bool 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 */ 906 QString 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 */ 930 void 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 */ 943 QSql::NumericalPrecisionPolicy QSqlDriver::numericalPrecisionPolicy() const 944 { 945 return d_func()->precisionPolicy; 946 } 947 803 948 QT_END_NAMESPACE -
trunk/src/sql/kernel/qsqldriver.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 128 128 QStringList subscribedToNotifications() const; // ### Qt 5: make virtual 129 129 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 130 136 Q_SIGNALS: 131 137 void notification(const QString &name); … … 141 147 QStringList subscribedToNotificationsImplementation() const; // ### Qt 5: eliminate, see subscribedNotifications() 142 148 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 143 152 private: 144 153 Q_DISABLE_COPY(QSqlDriver) -
trunk/src/sql/kernel/qsqldriverplugin.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqldriverplugin.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqlerror.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 49 49 { 50 50 dbg.nospace() << "QSqlError(" << s.number() << ", " << s.driverText() << 51 ", " << s.databaseText() << ")";51 ", " << s.databaseText() << ')'; 52 52 return dbg.space(); 53 53 } -
trunk/src/sql/kernel/qsqlerror.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqlfield.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 515 515 dbg.nospace() << ", typeID: " << f.typeID(); 516 516 if (!f.defaultValue().isNull()) 517 dbg.nospace() << ", auto-value: \"" << f.defaultValue() << "\"";518 dbg.nospace() << ")";517 dbg.nospace() << ", auto-value: \"" << f.defaultValue() << '\"'; 518 dbg.nospace() << ')'; 519 519 return dbg.space(); 520 520 #else -
trunk/src/sql/kernel/qsqlfield.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqlindex.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqlindex.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqlnulldriver_p.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqlquery.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 62 62 QAtomicInt ref; 63 63 QSqlResult* sqlResult; 64 QSql::NumericalPrecisionPolicy precisionPolicy;65 64 66 65 static QSqlQueryPrivate* shared_null(); … … 82 81 */ 83 82 QSqlQueryPrivate::QSqlQueryPrivate(QSqlResult* result) 84 : ref(1), sqlResult(result) , precisionPolicy(QSql::HighPrecision)83 : ref(1), sqlResult(result) 85 84 { 86 85 if (!sqlResult) … … 103 102 \ingroup database 104 103 \ingroup shared 105 \mainclass 104 106 105 \inmodule QtSql 107 106 … … 352 351 bool fo = isForwardOnly(); 353 352 *this = QSqlQuery(driver()->createResult()); 354 d->sqlResult->setNumericalPrecisionPolicy(d-> precisionPolicy);353 d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy()); 355 354 setForwardOnly(fo); 356 355 } else { … … 359 358 d->sqlResult->setLastError(QSqlError()); 360 359 d->sqlResult->setAt(QSql::BeforeFirstRow); 361 d->sqlResult->setNumericalPrecisionPolicy(d-> precisionPolicy);360 d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy()); 362 361 } 363 362 d->sqlResult->setQuery(query.trimmed()); … … 813 812 efficient since results do not need to be cached. It will also 814 813 improve performance on some databases. For this to be true, you must 815 call \c setForward Mode() before the query is prepared or executed.814 call \c setForwardOnly() before the query is prepared or executed. 816 815 Note that the constructor that takes a query and a database may 817 816 execute the query. … … 819 818 Forward only mode is off by default. 820 819 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() 822 826 */ 823 827 void QSqlQuery::setForwardOnly(bool forward) … … 892 896 *this = QSqlQuery(driver()->createResult()); 893 897 setForwardOnly(fo); 894 d->sqlResult->setNumericalPrecisionPolicy(d-> precisionPolicy);898 d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy()); 895 899 } else { 896 900 d->sqlResult->setActive(false); 897 901 d->sqlResult->setLastError(QSqlError()); 898 902 d->sqlResult->setAt(QSql::BeforeFirstRow); 899 d->sqlResult->setNumericalPrecisionPolicy(d-> precisionPolicy);903 d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy()); 900 904 } 901 905 if (!driver()) { … … 1127 1131 precision specified by \a precisionPolicy. 1128 1132 1129 The Oracle driver, for example, retrievesnumerical values as1130 strings by default to prevent the loss of precision. If the high1131 precision doesn't matter, use this method to increase execution1132 s peed 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. 1133 1137 1134 1138 Note: Drivers that don't support fetching numerical values with low … … 1145 1149 void QSqlQuery::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy) 1146 1150 { 1147 d-> precisionPolicy = precisionPolicy;1151 d->sqlResult->setNumericalPrecisionPolicy(precisionPolicy); 1148 1152 } 1149 1153 … … 1155 1159 QSql::NumericalPrecisionPolicy QSqlQuery::numericalPrecisionPolicy() const 1156 1160 { 1157 return d-> precisionPolicy;1161 return d->sqlResult->numericalPrecisionPolicy(); 1158 1162 } 1159 1163 … … 1196 1200 result set and must be navigated to a valid record before data 1197 1201 values can be retrieved. If a new result set isn't available the 1198 function returns false and the thequery is set to inactive. In any1202 function returns false and the query is set to inactive. In any 1199 1203 case the old result set will be discarded. 1200 1204 -
trunk/src/sql/kernel/qsqlquery.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqlrecord.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 590 590 QDebug operator<<(QDebug dbg, const QSqlRecord &r) 591 591 { 592 dbg << "QSqlRecord(" << r.count() << ")";592 dbg << "QSqlRecord(" << r.count() << ')'; 593 593 for (int i = 0; i < r.count(); ++i) 594 594 dbg << '\n' << QString::fromLatin1("%1:").arg(i, 2) << r.field(i) << r.value(i).toString(); -
trunk/src/sql/kernel/qsqlrecord.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/sql/kernel/qsqlresult.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 49 49 #include "qvector.h" 50 50 #include "qsqldriver.h" 51 #include <QDebug> 51 52 52 53 QT_BEGIN_NAMESPACE … … 65 66 QSqlResultPrivate(QSqlResult* d) 66 67 : 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) 68 69 {} 69 70 … … 105 106 QSqlError error; 106 107 bool forwardOnly; 108 QSql::NumericalPrecisionPolicy precisionPolicy; 107 109 108 110 int bindCount; … … 250 252 d = new QSqlResultPrivate(this); 251 253 d->sqldriver = db; 254 if(db) { 255 setNumericalPrecisionPolicy(db->numericalPrecisionPolicy()); 256 } 252 257 } 253 258 … … 555 560 cached. By default, this feature is disabled. 556 561 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() 558 568 */ 559 569 void QSqlResult::setForwardOnly(bool forward) … … 901 911 void QSqlResult::virtual_hook(int, void *) 902 912 { 903 Q_ASSERT(false);904 913 } 905 914 … … 966 975 void QSqlResult::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy) 967 976 { 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 */ 983 QSql::NumericalPrecisionPolicy QSqlResult::numericalPrecisionPolicy() const 984 { 985 return d->precisionPolicy; 970 986 } 971 987 -
trunk/src/sql/kernel/qsqlresult.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtSql module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 136 136 void detachFromResultSet(); 137 137 void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy); 138 QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; 138 139 bool nextResult(); 139 140
Note:
See TracChangeset
for help on using the changeset viewer.