def _createInsertString(self, a, b, x, y, length): aHex = util.toHex(a) bHex = util.toHex(b) endHex = util.compress_point(x, y) return "INSERT INTO %s(StartA, StartB, EndPoint, WalkLength) VALUES('%s', '%s', '%s', %d);" % ( self.name, aHex, bHex, endHex, length)
def _createMultipleInsertString(self, points): statement = "INSERT INTO %s(StartA, StartB, EndPoint, WalkLength) VALUES " % (self.name) for i in xrange(len(points)): aHex = util.toHex(points[i]['a']) bHex = util.toHex(points[i]['b']) endHex = util.compress_point(points[i]['x'], points[i]['y']) statement += "('%s', '%s', '%s', %d)" % (aHex, bHex, endHex, points[i]['length']) if i < len(points) - 1: statement += "," statement += ";" return statement;
def _createMultipleInsertString(self, points): statement = "INSERT INTO %s(StartA, StartB, EndPoint, WalkLength) VALUES " % ( self.name) for i in xrange(len(points)): aHex = util.toHex(points[i]['a']) bHex = util.toHex(points[i]['b']) endHex = util.compress_point(points[i]['x'], points[i]['y']) statement += "('%s', '%s', '%s', %d)" % (aHex, bHex, endHex, points[i]['length']) if i < len(points) - 1: statement += "," statement += ";" return statement
def _createReadString(self, x, y): point = util.compress_point(x, y) return "SELECT * FROM %s WHERE EndPoint='%s' LIMIT 1;" % (self.name, point)
def _createInsertString(self, a, b, x, y, length): aHex = util.toHex(a) bHex = util.toHex(b) endHex = util.compress_point(x, y) return "INSERT INTO %s(StartA, StartB, EndPoint, WalkLength) VALUES('%s', '%s', '%s', %d);" % (self.name, aHex, bHex, endHex, length)