Browse Source

More fixes

Neal Wilson 11 years ago
parent
commit
1f872f15b2
1 changed files with 15 additions and 2 deletions
  1. 15
    2
      config/Windows/newsamplebatch.xml

+ 15
- 2
config/Windows/newsamplebatch.xml View File

@@ -267,6 +267,19 @@
267 267
 				var attnames = sqlToArray(attributes.columnArray(0, 0));
268 268
 				for(var i = 0; i < attnames.length; i++)
269 269
 				{
270
+					var attname = attnames[i];
271
+					if(attname[0] == '{') {
272
+						attname = attname.substr(1);
273
+					}
274
+					if(attname[0] == ' ') {
275
+						attname = attname.substr(1);
276
+					}
277
+					if(attname[attname.length -1] == '}') {
278
+						attname = attname.substr(0, attname.length - 2);
279
+					}
280
+					if(attname.length == 0) {
281
+						break;
282
+					}
270 283
 					query.prepare("SELECT id FROM item_attributes WHERE name = :name");
271 284
 					query.bind(":name", attnames[i]);
272 285
 					query.exec();
@@ -283,7 +296,7 @@
283 296
 						attributes.setData(i, 0, query.value(0), 32);
284 297
 					}
285 298
 				}
286
-				query.prepare("INSERT INTO coffee_sample_items(DEFAULT, :name, NULL, 'lb', 0, 'Coffee: Green Sample', :arrival, :vendor, :attrids, :attrvals, NULL) RETURNING id");
299
+				query.prepare("INSERT INTO coffee_sample_items VALUES(DEFAULT, :name, NULL, 'lb', 0, 'Coffee: Green Sample', :arrival, :vendor, :attrids, :attrvals, NULL) RETURNING id");
287 300
 				query.bind(":name", name.text);
288 301
 				query.bind(":arrival", arrival.date);
289 302
 				query.bind(":vendor", vendor.text);
@@ -292,7 +305,7 @@
292 305
 				query.exec();
293 306
 				query.next();
294 307
 				var greenId = query.value(0);
295
-				query.prepare("INSERT INTO items(DEFAULT, :name, NULL, 'lb', 0, 'Coffee: Roasted Sample') RETURNING id");
308
+				query.prepare("INSERT INTO items VALUES(DEFAULT, :name, NULL, 'lb', 0, 'Coffee: Roasted Sample') RETURNING id");
296 309
 				query.bind(":name", name.text + " " + profileName.currentText);
297 310
 				query.exec();
298 311
 				query.next();

Loading…
Cancel
Save