def insertPostcode(self, post, kal, kec, kab, prov): sql = "INSERT INTO postcodes \ (kelurahan, kecamatan, kabupaten, province, postcode) \ VALUES (?, ?, ?, ?, ?)" data = [kal, kec, kab, prov, post] #rint'insertPostcode ', sql, data; return fetch.updateDB_data(sql, data)
def updatePostcode(self, post, kal, kec, kab, prov): sql = "UPDATE postcodes \ (kelurahan, kecamatan, kabupaten, province) \ VALUES (?, ?, ?, ?) \ WHERE postcode =%d" % post data = [kal, kec, kab, prov] #rint'updatePostcode' , sql, data; return fetch.updateDB_data(sql, data)
def insertAddress(self): house, street, estate, block, road, post, kal, kec, kab, prov = self.getValues() if house and (street or road) and post: sql = """INSERT INTO addresses \ (house, street, estate, block, road, postcode) \ VALUES (?, ?, ?, ?, ?, ?) """ data = [house, street, estate, block, road, post] ##rintsql, data; return fetch.updateDB_data(sql, data) else: fetch.msg("house, post code street or road missing")
def insertPostcode(self): house, street, estate, block, road, post, kal, kec, kab, prov = self.getValues() if post: sql = ( "INSERT INTO postcodes \ SET kelurahan, kecamatan, kabupaten, province \ VALUES (?, ?, ?, ?, ?)\ WHERE postcode = %d" % post ) data = [kal, kec, kab, prov] # rint'insertPostcode ', sql, data; return fetch.updateDB_data(sql, data)
def updateAddress(self): house, street, estate, block, road, post, kal, kec, kab, prov = self.getValues() sql = "UPDATE addresses \ SET number, street, estate, block, road, postcode \ VALUES (%, %, %, %, %, %) \ WHERE self.addr_id=%d" data = (house, street, estate, block, road, post, self.addr_id) # rintsql, data; return fetch.updateDB_data(sql, data) if self.postcodeExists(postcode): self.updatePostcode() else: self.insertPostcode()
def updatePostcode(self): house, street, estate, block, road, post, kal, kec, kab, prov = self.getValues() if post: sql = ( "UPDATE postcodes \ (kelurahan, kecamatan, kabupaten, province) \ VALUES (?, ?, ?, ?) \ WHERE postcode =%d" % post ) data = [kal, kec, kab, prov] # rint'updatePostcode' , sql, data; return fetch.updateDB_data(sql, data) else: fetch.msg("house, post code street or road missing")