summaryrefslogtreecommitdiffstats
path: root/src/sql/drivers/tds/qsql_tds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/drivers/tds/qsql_tds.cpp')
-rw-r--r--src/sql/drivers/tds/qsql_tds.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp
index 35195c6f02..f740360550 100644
--- a/src/sql/drivers/tds/qsql_tds.cpp
+++ b/src/sql/drivers/tds/qsql_tds.cpp
@@ -138,10 +138,11 @@ QSqlError qMakeError(const QString& err, QSqlError::ErrorType type, int errNo =
class QTDSDriverPrivate
{
public:
- QTDSDriverPrivate(): login(0) {}
+ QTDSDriverPrivate(): login(0), initialized(false) {}
LOGINREC* login; // login information
QString hostName;
QString db;
+ bool initialized;
};
@@ -537,6 +538,7 @@ QVariant QTDSDriver::handle() const
void QTDSDriver::init()
{
d = new QTDSDriverPrivate();
+ d->initialized = (dbinit() == SUCCEED);
// the following two code-lines will fail compilation on some FreeTDS versions
// just comment them out if you have FreeTDS (you won't get any errors and warnings then)
dberrhandle((QERRHANDLE)qTdsErrHandler);
@@ -578,7 +580,7 @@ bool QTDSDriver::open(const QString & db,
{
if (isOpen())
close();
- if (!dbinit()) {
+ if (!d->initialized) {
setOpenError(true);
return false;
}