diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sql/kernel/qsqlquery.cpp | 8 | ||||
-rw-r--r-- | src/sql/kernel/qsqlresult.cpp | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 6c6436f..430cf1a 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -999,10 +999,18 @@ bool QSqlQuery::execBatch(BatchExecutionMode mode) must be included when specifying the placeholder name. If \a paramType is QSql::Out or QSql::InOut, the placeholder will be overwritten with data from the database after the exec() call. + In this case, sufficient space must be pre-allocated to store + the result into. To bind a NULL value, use a null QVariant; for example, use \c {QVariant(QVariant::String)} if you are binding a string. + Values cannot be bound to multiple locations in the query, eg: + \code + INSERT INTO testtable (id, name, samename) VALUES (:id, :name, :name) + \endcode + Binding to name will bind to the first :name, but not the second. + \sa addBindValue(), prepare(), exec(), boundValue() boundValues() */ void QSqlQuery::bindValue(const QString& placeholder, const QVariant& val, diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 3d63f88..0c0c31c 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -707,7 +707,15 @@ void QSqlResult::bindValue(int index, const QVariant& val, QSql::ParamType param Binds the value \a val of parameter type \a paramType to the \a placeholder name in the current record (row). - Note that binding an undefined placeholder will result in undefined behavior. + Values cannot be bound to multiple locations in the query, eg: + \code + INSERT INTO testtable (id, name, samename) VALUES (:id, :name, :name) + \endcode + Binding to name will bind to the first :name, but not the second. + + \note Binding an undefined placeholder will result in undefined behavior. + + \sa QSqlQuery::bindValue() */ void QSqlResult::bindValue(const QString& placeholder, const QVariant& val, QSql::ParamType paramType) |