123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import sqlite3
- import Stateful
- deType = "sqlite3"
- dbPath = "dev.db"
- def is_exist(tableName, columnName):
- pass
- def Secondary_response():
- pass
- def Operate_sqlite3(dbPath, commands):
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- v = "SELECT * FROM {tableName} WHERE name={name}".format(tableName=str(commands[1]).capitalize(), name="'"+commands[2]+"'")
-
- con = sqlite3.connect(dbPath)
- cur = con.cursor()
-
- try:
- res = cur.execute(v)
- con.commit()
- print("res: ", res.fetchone() is None)
-
- if res.fetchone() is None == True:
- print("err <Code>: could not found, creat? y/n")
-
-
- matched = Stateful.MatchTomlKeys('dev_config.toml', commands, 'sqlite3')
- print(matched)
- except:
- print("err <Code>: Syntax error")
- con.close()
- if __name__ == "__main__":
- while(1):
- sy_i = input("sql: ").split(" ")
- Operate_sqlite3(dbPath, sy_i)
|