#!/usr/src/python
# -*- coding:utf-8 -*-
# 数据预处理
# 插入数据
def ins_data():
pass
# 删除数据
def del_data():
pass
# 数据更新
def upd_data():
pass
# 数据查询操作
def sel_data():
if 'where' in v_sql:
pass
else:
f = open('mydb/emp', 'r', encoding='utf-8')
data = f.read()
print(data)
f.close()
'''
select * from mydb.emp where a= and b=
UPDATE mydb.emp set a= where a=xxx
DELETE from mydb.emp where a=
insert into mydb.emp values ()
'''
v_sql_str=input('sql>')
v_sql=v_sql_str.lower()
# sql初步解析,进一步的解析在具体操作函数中处理
if 'select * from mydb.emp' in v_sql:
sel_data()
elif 'update' in v_sql:
upd_data()
elif 'delete' in v_sql:
del_data()
elif 'insert' in v_sql:
del_data()
else:
print('dbms不支持此操作')
转载于:https://www.cnblogs.com/geek-ace/p/6875131.html