[Kst] [Bug 130195] Datasources should enforce field uniquity

Andrew Walker arwalker at sumusltd.com
Mon May 7 22:42:56 CEST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=130195         
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2007-05-07 22:42 -------
SVN commit 662309 by arwalker:

BUG:130195 warn the user if there are duplicate field names in their data source

 M  +18 -0     kstdatasource.cpp  


--- branches/work/kst/1.5/kst/src/libkst/kstdatasource.cpp #662308:662309
 @ -334,6 +334,24  @
     QString typeSuggestion;
     rc = (*i).plugin->fieldList(kConfigObject, fn, QString::null, &typeSuggestion, complete);
     if (!rc.isEmpty()) {
+      //
+      // check for duplicate field names and warn the user if necessary...
+      //
+      QStringList::const_iterator it = rc.begin();
+      QString str;
+
+      for (; it != rc.end(); ) {
+        str = (*it);
+        ++it;
+        if (it != rc.end()) {
+          if (rc.find(it, str) != rc.end()) {
+            KstDebug::self()->log(i18n( "The datasource has at least one duplicate field name; '%1'. As a result one or more fields will not be accessible." ).arg(str), KstDebug::Error);
+
+            break;
+          }
+        }
+      }
+
       if (outType) {
         if (typeSuggestion.isEmpty()) {
           *outType = (*i).plugin->provides()[0];


More information about the Kst mailing list