更新本地运行相关。
This commit is contained in:
parent
00107a3756
commit
dfde3d3387
Binary file not shown.
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,22 @@
|
||||||
|
sql_path = rf"E:\workspace\szsd\database-win-pkg\src\datas\init.sql"
|
||||||
|
|
||||||
|
def set_replace():
|
||||||
|
with open(sql_path, 'r', encoding='utf-8') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
modified = False
|
||||||
|
new_lines = []
|
||||||
|
for line in lines:
|
||||||
|
if 'CREATE TABLE' in line and 'IF NOT EXISTS' not in line:
|
||||||
|
new_line = line.replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS ')
|
||||||
|
new_lines.append(new_line)
|
||||||
|
modified = True
|
||||||
|
else:
|
||||||
|
new_lines.append(line)
|
||||||
|
|
||||||
|
# 如果有修改,则写回文件
|
||||||
|
if modified:
|
||||||
|
with open(sql_path, 'w', encoding='utf-8') as file:
|
||||||
|
file.writelines(new_lines)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
set_replace()
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue