我在MySQL中创建了一个程序。此过程可以像以下一样使用:
IF USERNAME CONTAINS "XXX" THEN REJECT ADD TO THE DATABASE
可以做这样的程序吗?
答案 0 :(得分:1)
我更喜欢一种替代方法(因为您不必执行SELECT或设置其他变量,而是使用LOCATE()
函数。
IF (LOCATE(@username,'xxx') > 0) THEN
{reject this username as xxx was found}
END IF;
答案 1 :(得分:0)
import tkinter as tk
import queue
import threading
import time
def button_pressed():
threading.Thread(target=do_something_on_a_thread).start()
def do_something_on_a_thread():
global new_window
app_queue.put(create_a_new_window)
time.sleep(1)
app_queue.put(new_window.destroy)
def create_a_new_window():
global new_window
new_window = tk.Toplevel()
tk.Label(new_window, text='Temporary Window').grid()
#Check queue and run any function that happens to be in the queue
def check_queue():
while not app_queue.empty():
queue_item = app_queue.get()
queue_item()
app.after(100, check_queue)
#Create tkinter app with queue that is checked regularly
app_queue = queue.Queue()
app = tk.Tk()
tk.Button(app, text='Press Me', command=button_pressed).grid()
create_a_new_window()
new_window.destroy()
app.after(100, check_queue)
tk.mainloop()