Browse Source

Warn of observed oddity, possible Qt bug.

Neal Wilson 11 years ago
parent
commit
90deb9920f
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      src/typica.w

+ 17
- 0
src/typica.w View File

11798
 @ The |database()| method provides access to a database connection for use by
11798
 @ The |database()| method provides access to a database connection for use by
11799
 database aware widgets.
11799
 database aware widgets.
11800
 
11800
 
11801
+\danger Behavior observed on Linux is that this does create a new connection
11802
+which the caller will successfully open, but a |QSqlQuery| created with the
11803
+newly opened |QSqlDatabase| will instead continue to execute queries on the
11804
+default connection instead of the new connection. Replacing the call to
11805
+|QSqlDatabase::database()| with one that does not open the default connection
11806
+or rather than cloning that connection creating a new non-default connection
11807
+results in query execution failing because the connection is not open despite
11808
+the call to |open()| succeeding and |isValid()| and |isOpen()| both returning
11809
+true. If this behavior can be replicated on other platforms, this entire
11810
+exercise would be pointless. At present I believe this to be a bug in Qt, but I
11811
+have not identified it.
11812
+
11801
 @<Application Implementation@>=
11813
 @<Application Implementation@>=
11802
 QSqlDatabase Application::database()
11814
 QSqlDatabase Application::database()
11803
 {
11815
 {
12562
 		settings.setValue("database/dbname", dbname->text());
12574
 		settings.setValue("database/dbname", dbname->text());
12563
 		settings.setValue("database/user", user->text());
12575
 		settings.setValue("database/user", user->text());
12564
 		settings.setValue("database/password", password->text());
12576
 		settings.setValue("database/password", password->text());
12577
+		database.close();
12565
 		accept();
12578
 		accept();
12566
 	}
12579
 	}
12567
 	else
12580
 	else
12597
 {
12610
 {
12598
 	settings.setValue("database/exists", "false");
12611
 	settings.setValue("database/exists", "false");
12599
 }
12612
 }
12613
+else
12614
+{
12615
+	database.close();
12616
+}
12600
 
12617
 
12601
 @** Viewing a record of batches.
12618
 @** Viewing a record of batches.
12602
 
12619
 

Loading…
Cancel
Save