1. 程式人生 > 其它 >sql報錯:You can't specify target table 'tb_cr_circulate_gtsc' for update in FROM clause

sql報錯:You can't specify target table 'tb_cr_circulate_gtsc' for update in FROM clause



class Link:
class Node:
def __init__(self, item, next=None):
self.item = item
self.next = next

class LinkListIterator:
def __init__(self, node):
self.node = node

def __next__(self):
if self.node:
cur_node = self.node
self.node = self.node.next
return cur_node.item
else:
raise StopIteration

def __iter__(self):
pass

def __init__(self, iterable=None):
self.head = None
self.tail = None
self.size = 0
if iterable:
self.extend(iterable)

def ins_head(self, item):
new_node = Link.Node(item, None)
if self.size == 0:
self.tail = new_node
else:
new_node.next = self.head
self.head = new_node
self.size += 1

def ins_tail(self, item):
new_node = Link.Node(item, None)
if self.size == 0:
self.head = new_node
else:
self.tail.next = new_node
self.tail = new_node
self.size += 1

def print_link(self):
for i in self:
print(i, end=' ')
print()

def del_head(self):
if self.size > 0:
temp = self.head
self.head = self.head.next
self.size -= 1
return temp
else:
raise IndexError

def del_item(self, item):
if self.size > 0:
cur_node = self.head
for i in range(self.size):
if cur_node.next and cur_node.next.item == item:
temp = cur_node.next
cur_node.next = cur_node.next.next
self.size -= 1
return temp.item
cur_node = cur_node.next
else:
print('找不到要刪除的元素')
return None
else:
raise IndexError

def find(self, item):
for i in self:
if i == item:
return True
else:
return False

def extend(self, iterable):
for i in iterable:
self.ins_tail(i)

def __iter__(self):
return self.LinkListIterator(self.head)

def __str__(self):
return '<<' + ','.join(map(str, self)) + '>>'

__repr__ = __str__


if __name__ == '__main__':
link = Link(['a', 'b', 'c'])
link.ins_head(1)
link.ins_head(2)
link.ins_head(3)
link.print_link()
link.ins_tail(4)
link.ins_tail(5)
link.ins_tail(6)
link.print_link()
print('-------------')
print('--', link.del_item(5))
print(link)