diff options
author | diSabler <dissy@ya.ru> | 2013-06-03 00:18:15 +0400 |
---|---|---|
committer | diSabler <dissy@ya.ru> | 2013-06-03 00:18:15 +0400 |
commit | 8d8adb4c35b281d9a40ba576b95eaf23451e44bc (patch) | |
tree | fea66588fb96bc6a7fe514aafa54553c5c89fb6f /kernel.py | |
parent | ae6f26e7e961d2f8c3ed0f0c1d1af2753167259b (diff) |
fix: serv command for mysql and sqlite3 support
Diffstat (limited to 'kernel.py')
-rw-r--r-- | kernel.py | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -53,9 +53,19 @@ def sqlite3_split_part(txt, spltr, cnt): if txt: return (txt.split(spltr) + [''] * (cnt-1))[cnt-1] else: return txt +sqlite3_row_number_last_x = 0 +def sqlite3_row_number(): + global sqlite3_row_number_last_x + sqlite3_row_number_last_x += 1 + return sqlite3_row_number_last_x + def cur_execute_sqlite3(*params): conn = sqlite3.connect(sqlite_base) if 'split_part' in list(params)[0]: conn.create_function('split_part', 3, sqlite3_split_part) + if 'row_number' in list(params)[0]: + global sqlite3_row_number_last_x + sqlite3_row_number_last_x = 0 + conn.create_function('row_number', 0, sqlite3_row_number) cur = conn.cursor() par = True try: @@ -117,6 +127,10 @@ def cur_execute(*params): def cur_execute_fetchone_sqlite3(*params): conn = sqlite3.connect(sqlite_base) if 'split_part' in list(params)[0]: conn.create_function('split_part', 3, sqlite3_split_part) + if 'row_number' in list(params)[0]: + global sqlite3_row_number_last_x + sqlite3_row_number_last_x = 0 + conn.create_function('row_number', 0, sqlite3_row_number) try: cur = conn.cursor() except: return None par = None @@ -186,6 +200,10 @@ def cur_execute_fetchone(*params): def cur_execute_fetchall_sqlite3(*params): conn = sqlite3.connect(sqlite_base) if 'split_part' in list(params)[0]: conn.create_function('split_part', 3, sqlite3_split_part) + if 'row_number' in list(params)[0]: + global sqlite3_row_number_last_x + sqlite3_row_number_last_x = 0 + conn.create_function('row_number', 0, sqlite3_row_number) try: cur = conn.cursor() except: return None par = None |