Skip to content

Commit

Permalink
[修复]file exec ehandling
Browse files Browse the repository at this point in the history
  • Loading branch information
longfengpili committed Aug 29, 2021
1 parent 178a053 commit aafd031
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ row, action, result = db.execute(sql)
## 支持的操作
+ execute[【db/base.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py)
+ 代码
`db.execute(sql, count=None, ehandling='eraise', verbose=0)`
`db.execute(sql, count=None, ehandling=None, verbose=0)`
+ params
* `count`: 返回结果的数量;
* `ehandling`: sql执行出错的时候处理方式, default: raise
* `ehandling`: sql执行出错的时候处理方式, default: None
* `verbose`: 执行的进度展示方式(0:不打印, 1:文字进度, 2:进度条)
+ select
+ 代码
Expand Down Expand Up @@ -146,10 +146,10 @@ row, action, result = db.execute(sql)
* `kw`: sql文件中需要替换的参数,会替换sqlfile中的arguments;
+ file_exec[【db/fileexec.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/fileexec.py)
+ 代码
`db.file_exec(filepath, ehandling='raise', verbose=0, **kw)`
`db.file_exec(filepath, ehandling=None, verbose=0, **kw)`
+ params
* `filepath`: sql文件路径; 文件名以<font color=red>`test`</font>开始或者结尾会打印sql执行的步骤;
* `ehandling`: sql执行出错的时候处理方式, default: raise
* `ehandling`: sql执行出错的时候处理方式, default: None
* `verbose`: 执行的进度展示方式(0:不打印, 1:文字进度, 2:进度条)
* `kw`: sql文件中需要替换的参数 在sql文件中用`$param`, 会替换sqlfile中的arguments;
+ sql文件格式(在desc中增加<font color=red>`verbose`</font>会打印sql执行的步骤;)
Expand Down
4 changes: 2 additions & 2 deletions pydbapi/db/fileexec.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @Author: chunyang.xu
# @Email: [email protected]
# @Date: 2020-06-08 11:55:54
# @Last Modified time: 2021-08-29 13:18:21
# @Last Modified time: 2021-08-29 13:30:07
# @github: https://github.com/longfengpili

# !/usr/bin/env python3
Expand All @@ -27,7 +27,7 @@ def get_filesqls(self, filepath, **kw):
arguments, sqls = sqlfileparser.get_filesqls(**kw)
return arguments, sqls

def file_exec(self, filepath, ehandling='raise', verbose=0, **kw):
def file_exec(self, filepath, ehandling=None, verbose=0, **kw):
st = time.time()
results = {}
filename = os.path.basename(filepath)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @Author: chunyang.xu
# @Email: [email protected]
# @Date: 2020-06-09 16:46:54
# @Last Modified time: 2021-08-29 13:03:54
# @Last Modified time: 2021-08-29 13:31:08
# @github: https://github.com/longfengpili

# !/usr/bin/env python3
Expand All @@ -12,7 +12,7 @@
import shutil
import setuptools

VERSION = '0.0.69'
VERSION = '0.0.70'
PROJECT_NAME = 'pydbapi'

with open('README.md', 'r', encoding='utf-8') as f:
Expand Down

0 comments on commit aafd031

Please sign in to comment.