549 | | def writePrinterPrices(self, printer) : |
550 | | """Write the printer's prices back into the storage.""" |
551 | | self.doModify("UPDATE printers SET priceperpage=%s, priceperjob=%s WHERE id=%s" % (self.doQuote(printer.PricePerPage), self.doQuote(printer.PricePerJob), self.doQuote(printer.ident))) |
552 | | |
553 | | def writePrinterDescription(self, printer) : |
554 | | """Write the printer's description back into the storage.""" |
555 | | description = self.userCharsetToDatabase(printer.Description) |
556 | | self.doModify("UPDATE printers SET description=%s WHERE id=%s" % (self.doQuote(description), self.doQuote(printer.ident))) |
557 | | |
558 | | def setPrinterMaxJobSize(self, printer, maxjobsize) : |
559 | | """Write the printer's maxjobsize attribute.""" |
560 | | self.doModify("UPDATE printers SET maxjobsize=%s WHERE id=%s" % (self.doQuote(maxjobsize), self.doQuote(printer.ident))) |
561 | | |
562 | | def setPrinterPassThroughMode(self, printer, passthrough) : |
563 | | """Write the printer's passthrough attribute.""" |
564 | | self.doModify("UPDATE printers SET passthrough=%s WHERE id=%s" % (self.doQuote((passthrough and "t") or "f"), self.doQuote(printer.ident))) |
| 549 | def savePrinter(self, printer) : |
| 550 | """Saves the printer to the database in a single operation.""" |
| 551 | self.doModify("UPDATE printers SET passthrough=%s, maxjobsize=%s, description=%s, priceperpage=%s, priceperjob=%s WHERE id=%s" \ |
| 552 | % (self.doQuote((printer.PassThrough and "t") or "f"), \ |
| 553 | self.doQuote(printer.MaxJobSize), \ |
| 554 | self.doQuote(self.userCharsetToDatabase(printer.Description)), \ |
| 555 | self.doQuote(printer.PricePerPage), \ |
| 556 | self.doQuote(printer.PricePerJob), \ |
| 557 | self.doQuote(printer.ident))) |