src/sql/kernel/qsqlresult.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtSql module of the Qt Toolkit.
     7 ** This file is part of the QtSql module of the Qt Toolkit.
     8 **
     8 **
   134     while (i > 0) {
   134     while (i > 0) {
   135         *(++ptr) = 'a' + i % 16;
   135         *(++ptr) = 'a' + i % 16;
   136         i >>= 4;
   136         i >>= 4;
   137     }
   137     }
   138 
   138 
   139     return QString::fromUtf16(arr, int(ptr - arr) + 1);
   139     return QString(reinterpret_cast<const QChar *>(arr), int(ptr - arr) + 1);
   140 }
   140 }
   141 
   141 
   142 static bool qIsAlnum(QChar ch)
   142 static bool qIsAlnum(QChar ch)
   143 {
   143 {
   144     uint u = uint(ch.unicode());
   144     uint u = uint(ch.unicode());
   561 
   561 
   562     Setting forward only to false is a suggestion to the database engine,
   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
   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
   564     scrollable. isForwardOnly() will always return the correct status of
   565     the result set.
   565     the result set.
       
   566 
       
   567     \note Calling setForwardOnly after execution of the query will result
       
   568     in unexpected results at best, and crashes at worst.
   566 
   569 
   567     \sa isForwardOnly(), fetchNext(), QSqlQuery::setForwardOnly()
   570     \sa isForwardOnly(), fetchNext(), QSqlQuery::setForwardOnly()
   568 */
   571 */
   569 void QSqlResult::setForwardOnly(bool forward)
   572 void QSqlResult::setForwardOnly(bool forward)
   570 {
   573 {
   705     \overload
   708     \overload
   706 
   709 
   707     Binds the value \a val of parameter type \a paramType to the \a
   710     Binds the value \a val of parameter type \a paramType to the \a
   708     placeholder name in the current record (row).
   711     placeholder name in the current record (row).
   709 
   712 
   710     Note that binding an undefined placeholder will result in undefined behavior.
   713    Values cannot be bound to multiple locations in the query, eg:
       
   714    \code
       
   715    INSERT INTO testtable (id, name, samename) VALUES (:id, :name, :name)
       
   716    \endcode
       
   717    Binding to name will bind to the first :name, but not the second.
       
   718 
       
   719     \note Binding an undefined placeholder will result in undefined behavior.
       
   720 
       
   721     \sa QSqlQuery::bindValue()
   711 */
   722 */
   712 void QSqlResult::bindValue(const QString& placeholder, const QVariant& val,
   723 void QSqlResult::bindValue(const QString& placeholder, const QVariant& val,
   713                            QSql::ParamType paramType)
   724                            QSql::ParamType paramType)
   714 {
   725 {
   715     d->binds = NamedBinding;
   726     d->binds = NamedBinding;