]> Shamusworld >> Repos - schematic/blobdiff - src/vendorclassdialog.cpp
Switched to ODBC driver for connections to MySQL database
[schematic] / src / vendorclassdialog.cpp
index d39a5a0f19b3fb1122485079937987aeac6cc7b5..ba670b96894163fad9500962d9ddac0d3c1a5241 100644 (file)
@@ -156,32 +156,33 @@ void VendorClassDialog::LoadList(void)
        std::vector<VendorType> groupList;
 
        // Pull in definitions from DB for Vendor Classes/Groups
-       QSqlQuery query1("SELECT vgid, seqNo, description FROM VendorGroup ORDER BY seqNo");
-       query1.exec();
+       QSqlQuery query;
+       query.prepare("SELECT vgid, seqNo, description FROM VendorGroup ORDER BY seqNo");
+       query.exec();
 
-       while (query1.next())
+       while (query.next())
        {
                VendorType v;
-               v.key         = query1.value(0).toInt();
-               v.seqNo       = query1.value(1).toInt();
-               v.description = query1.value(2).toString();
+               v.key         = query.value(0).toInt();
+               v.seqNo       = query.value(1).toInt();
+               v.description = query.value(2).toString();
                v.isHeader    = true;
 
                groupList.push_back(v);
        }
 
-       QSqlQuery query2("SELECT vtid, vgid, seqNo, description FROM VendorType ORDER BY seqNo");
-       query2.exec();
+       query.prepare("SELECT vtid, vgid, seqNo, description FROM VendorType ORDER BY seqNo");
+       query.exec();
 
        int previousID = -1, groupListIndex = 0;
 
-       while (query2.next())
+       while (query.next())
        {
                VendorType v;
-               v.key         = query2.value(0).toInt();
-               int vgid      = query2.value(1).toInt();
-               v.seqNo       = query2.value(2).toInt();
-               v.description = query2.value(3).toString();
+               v.key         = query.value(0).toInt();
+               int vgid      = query.value(1).toInt();
+               v.seqNo       = query.value(2).toInt();
+               v.description = query.value(3).toString();
                v.isHeader    = false;
 
                // Check to see if we need to insert new header yet.