summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp6
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp19
2 files changed, 18 insertions, 7 deletions
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index 9eeb41d..6834d9a 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -871,7 +871,7 @@ QIBaseResult::~QIBaseResult()
bool QIBaseResult::prepare(const QString& query)
{
- //qDebug("prepare: %s\n", qPrintable(query));
+// qDebug("prepare: %s", qPrintable(query));
if (!driver() || !driver()->isOpen() || driver()->isOpenError())
return false;
d->cleanup();
@@ -1025,7 +1025,7 @@ bool QIBaseResult::exec()
}
if (ok) {
- if (colCount()) {
+ if (colCount() && d->queryType != isc_info_sql_stmt_exec_procedure) {
isc_dsql_free_statement(d->status, &d->stmt, DSQL_close);
if (d->isError(QT_TRANSLATE_NOOP("QIBaseResult", "Unable to close statement")))
return false;
@@ -1039,7 +1039,7 @@ bool QIBaseResult::exec()
return false;
// Not all stored procedures necessarily return values.
- if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda->sqld == 0)
+ if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda && d->sqlda->sqld == 0)
delDA(d->sqlda);
if (d->sqlda)
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index 8dede12..4fa3dc4 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -517,6 +517,8 @@ void tst_QSqlDatabase::tables()
// MySQL doesn't give back anything when calling QSqlDatabase::tables() with QSql::Views
// May be fixable by doing a select on informational_schema.views instead of using the client library api
QEXPECT_FAIL("", "MySQL driver thinks that views are tables", Continue);
+ if(!tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive))
+ qDebug() << "failed to find" << qTableName("qtest_view") << "in" << tables;
QVERIFY(tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive));
}
if (tempTables)
@@ -1880,17 +1882,26 @@ void tst_QSqlDatabase::ibase_procWithReturnValues()
"\nRESULT INTEGER)"
"\nAS"
"\nbegin"
- "\nRESULT = 10;"
+ "\nRESULT = 10 * ABC;"
"\nsuspend;"
"\nend"));
// Interbase procedures can be executed in two ways: EXECUTE PROCEDURE or SELECT
QVERIFY_SQL(q, exec(QString("execute procedure %1(123)").arg(procName)));
QVERIFY_SQL(q, next());
- QCOMPARE(q.value(0).toInt(), 10);
+ QCOMPARE(q.value(0).toInt(), 1230);
QVERIFY_SQL(q, exec(QString("select result from %1(456)").arg(procName)));
QVERIFY_SQL(q, next());
- QCOMPARE(q.value(0).toInt(), 10);
+ QCOMPARE(q.value(0).toInt(), 4560);
+ QVERIFY_SQL(q, prepare(QLatin1String("execute procedure ")+procName+QLatin1String("(?)")));
+ q.bindValue(0, 123);
+ QVERIFY_SQL(q, exec());
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 1230);
+ q.bindValue(0, 456);
+ QVERIFY_SQL(q, exec());
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 4560);
q.exec(QString("drop procedure %1").arg(procName));
}
@@ -2276,7 +2287,7 @@ void tst_QSqlDatabase::db2_valueCacheUpdate()
void tst_QSqlDatabase::sqlStatementUseIsNull_189093()
{
- // NULL = NULL is unknow, the sqlStatment must use IS NULL
+ // NULL = NULL is unknown, the sqlStatment must use IS NULL
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);