Browse Source

Plug database connection leak.

Neal Wilson 11 years ago
parent
commit
4b5880a082
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      config/Reports/dailyproductiondetail.xml

+ 6
- 3
config/Reports/dailyproductiondetail.xml View File

@@ -135,10 +135,10 @@
135 135
 					output.writeEndElement();
136 136
 					var unroastedList = sqlToArray(query.value(4));
137 137
 					output.writeStartElement("td");
138
+					var greensQuery = new QSqlQuery();
139
+					greensQuery.prepare("SELECT name, reference FROM coffees WHERE id = :id");
138 140
 					for(var i = 0;  i < unroastedList.length; i++)
139
-					{
140
-						var greensQuery = new QSqlQuery();
141
-						greensQuery.prepare("SELECT name, reference FROM coffees WHERE id = :id");
141
+					{	
142 142
 						greensQuery.bind(":id", Number(unroastedList[i]));
143 143
 						greensQuery.exec();
144 144
 						if(i != 0)
@@ -148,6 +148,7 @@
148 148
 						greensQuery.next();
149 149
 						output.writeCDATA(greensQuery.value(0) + " (" + unroastedList[i] + ")" + (greensQuery.value(1) == "" ? "" : " ref: " + greensQuery.value(1)));
150 150
 					}
151
+					greensQuery = greensQuery.invalidate();
151 152
 					output.writeEndElement();
152 153
 					switch(unitBox.currentIndex)
153 154
 					{
@@ -371,6 +372,8 @@
371 372
 					output.writeTextElement("td", query.value(2));
372 373
 					output.writeEndElement();
373 374
 				}
375
+				query = query.invalidate();
376
+				subQuery = subQuery.invalidate();
374 377
 				output.writeEndElement();
375 378
 				output.writeStartElement("tfoot");
376 379
 				

Loading…
Cancel
Save